> restart;with(DEtools):with(linalg):with(plots): # An example of using Maple to find solutions to IVP for a given ODE # (Text, problem 4.8.37). # Consider the ODE (linear, homogeneous, constant coefficients): > de1 := D(D(y))(x) - 4*D(y)(x) + 5*y(x) = exp(5*x)+x*sin(3*x)-cos(3*x); (2) de1 := (D )(y)(x) - 4 D(y)(x) + 5 y(x) = exp(5 x) + x sin(3 x) - cos(3 x) # The initial conditions are > init_con := y(0) = 1, D(y)(0) = 0; init_con := y(0) = 1, D(y)(0) = 0 # We now compute the solution using DSOLVE (if only interested in # particular solution, neglect homogeneous part): > solution := dsolve({de1, init_con},{y(x)}); 957 43 solution := y(x) = - --- exp(2 x) sin(x) + -- exp(2 x) cos(x) 400 50 13 + 1/400 (16 + 30 x) cos(3 x) + 1/10 exp(5 x) + --- sin(3 x) 400 - 1/40 x sin(3 x) # 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: > expr := subs(solution,y(x)); 957 43 expr := - --- exp(2 x) sin(x) + -- exp(2 x) cos(x) 400 50 13 + 1/400 (16 + 30 x) cos(3 x) + 1/10 exp(5 x) + --- sin(3 x) 400 - 1/40 x sin(3 x) > plot(expr,x=-20..1, axes=BOXED,title="solution to a 2nd order IVP"); >