next up previous
Next: About this document Up: Maple and differential equations Previous: Linear first-order equations

Linear second order equations with constant coefficients

For this section we consider the following second order differential equation with constant coefficents

displaymath427

where m, c and k are constants. The procedure for using Maple to solve this second order equation is very similar to what we did in the previous section, but there are two main differences.

To proceed, we first define our differential equation and give it a label. This will save some typing later on.

  > de1 := m*diff(x(t),t,t)+c*diff(x(t),t) + k*x(t) = 0;

displaymath428

Next, we define a set of values for our parameters.

  > par1 := {m=1, c= 1/10, k=4};

displaymath429

Finally, we substitute the parameter values and solve the IVP

displaymath430

with the command

  > sol3 := dsolve(subs(par1,{de1,D(x)(0) = 0, x(0) = 1}), x(t));

eqnarray197

Note how the initial condition for x' is specified. We can extract the solution the same way we did before, with the command

  > x3 := rhs(sol3);

displaymath431

This result can now be plotted or otherwise manipulated as desired.

As a final example, note that above we substituted the parameter values in the differential equation and then solved it. You can proceed by first solving and then substituting parameter values, as we did for the first order equation, but substituting and then solving is usually preferable.

To see this, suppose we solve the IVP with new initial conditions x(0) = and x'(0) = 1 without substituting parameter values first, as shown below.

  > sol4 := dsolve({de1,D(x)(0) = 1,x(0) = 0},x(t));

displaymath432

Here is the result of substituting our parameter values.

  > subs(par1,sol4);

eqnarray279

If we do things in the opposite order, the result is simpler, as shown below.

  > sol5 := dsolve(subs(par1,{de1,D(x)(0) = 1,x(0) = 0}),x(t));

displaymath433


next up previous
Next: About this document Up: Maple and differential equations Previous: Linear first-order equations

William W. Farr
Thu Oct 24 13:25:12 EDT 1996