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

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.

- The differential equation has more than one parameter. This
means that set notation will be necessary if the
`subs`command is used to set parameter values. - Initial conditions will involve values of the first derivative
of
*x*as well as values of*x*. The Maple syntax for specifying values of derivatives is not what you might expect; the`diff`command cannot be used. Instead we will have to use the Maple derivative operator,`D`.

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;

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

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

Finally, we substitute the parameter values and solve the IVP

with the command

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

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);

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));

Here is the result of substituting our parameter values.

> subs(par1,sol4);

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));

Thu Oct 24 13:25:12 EDT 1996