\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{restart;with(DEtools):with(linalg):with(plots):}{%
}
\end{mapleinput}

\end{maplegroup}
\begin{maplegroup}
An example of using Maple to find solutions to IVP for a given ODE

 {\large (Text, problem 4.8.37).}

 Consider the ODE (linear, homogeneous, constant coefficients):

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{de1 := D(D(y))(x) - 4*D(y)(x) + 5*y(x) =
exp(5*x)+x*sin(3*x)-cos(3*x);}{%
}
\end{mapleinput}

\mapleresult
\begin{maplelatex}
\mapleinline{inert}{2d}{de1 := `@@`(D,2)(y)(x)-4*D(y)(x)+5*y(x) =
exp(5*x)+x*sin(3*x)-cos(3*x);}{%
\[
\mathit{de1} := (\mathrm{D}^{(2)})(y)(x) - 4\,\mathrm{D}(y)(x) + 
5\,\mathrm{y}(x)=e^{(5\,x)} + x\,\mathrm{sin}(3\,x) - \mathrm{cos
}(3\,x)
\]
%
}
\end{maplelatex}

\end{maplegroup}
\begin{maplegroup}
The initial conditions are

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{init_con := y(0) = 0, D(y)(0) = 0;}{%
}
\end{mapleinput}

\mapleresult
\begin{maplelatex}
\mapleinline{inert}{2d}{init_con := y(0) = 0, D(y)(0) = 0;}{%
\[
\mathit{init\_con} := \mathrm{y}(0)=0, \,\mathrm{D}(y)(0)=0
\]
%
}
\end{maplelatex}

\end{maplegroup}
\begin{maplegroup}
We now compute the solution using DSOLVE:

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{solution := dsolve(\{de1, init_con\},\{y(x)\});}{%
}
\end{mapleinput}

\mapleresult
\begin{maplelatex}
\mapleinline{inert}{2d}{solution := y(x) =
-157/400*exp(2*x)*sin(x)-7/50*exp(2*x)*cos(x)+1/400*(30*x+16)*cos(3*x)
-1/40*x*sin(3*x)+1/10*exp(5*x)+13/400*sin(3*x);}{%
\maplemultiline{
\mathit{solution} := \mathrm{y}(x)= - {\displaystyle \frac {157}{
400}} \,e^{(2\,x)}\,\mathrm{sin}(x) - {\displaystyle \frac {7}{50
}} \,e^{(2\,x)}\,\mathrm{cos}(x) + {\displaystyle \frac {1}{400}
} \,(30\,x + 16)\,\mathrm{cos}(3\,x) - {\displaystyle \frac {1}{
40}} \,x\,\mathrm{sin}(3\,x) \\
\mbox{} + {\displaystyle \frac {1}{10}} \,e^{(5\,x)} + 
{\displaystyle \frac {13}{400}} \,\mathrm{sin}(3\,x) }
%
}
\end{maplelatex}

\end{maplegroup}
\begin{maplegroup}
Now some MAPLE esoterica: convert the FUNCTION y(x) to an EXPRESSION
that can be evaluated and plotted;

this is done with the command subs:

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{expr := subs(solution,y(x)):}{%
}
\end{mapleinput}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\mapleinline{active}{1d}{plot(expr,x=-15..0.6, axes=BOXED,title="solution to a 2nd order
IVP");}{%
}
\end{mapleinput}

\mapleresult
\begin{center}
\mapleplot{gen01.eps}
\end{center}

\end{maplegroup}
\begin{maplegroup}
\begin{mapleinput}
\end{mapleinput}

\end{maplegroup}
%% End of Maple 7.00 Output
