**Harmonic Oscillators with Maple**

**Copyright © 2002, 2003 by James F. Hurley, University of Connecticut Department of Mathematics, 196 Auditorium Road, Unit 3009, Storrs CT 06269-3009. All rights reserved.**

**1. Damped Oscillators.**
Maple's plotting commands easily generate plots of solution functions for a damped harmonic oscillator with equation

* *
=
.

The following routine plots an overdamped case, for which recall that
. In this plot, the graph is that of the solution function

.

Compare Figure 3.4.2 of Florin Diacu,
*Introduction to Differential Equations: Order and Chaos*
, Freeman, 2000.

`> `
**plot(0.2*exp(-t/2) + exp(-t/3), t = 0..6);**

Next, let's plot a typical solution in the underdamped case, that is, one for which
.

Compare the plot with Figure 3.4.4 of
*Diacu*
.

`> `
**plot( exp(-t/8)*(sin(2*t) + cos(2*t)), t = 0..10);**

Finally, it is just as easy to generate a plot of a solution in the critically damped case, for which
. Compare the output of the following to Figure 3.4.3 of Section 3.4 of
*Diacu*
.

`> `
**plot( (0.1 + t)*exp(-t), t = 0..6) ;
**

**2. Forced Undamped Oscillations.**
The model for such a system is Equation (1) on p.113 of
*Diacu*
:

=
.

The derivation on pp. 113 and 114 of Section 3.4 shows that this problem has solution of the form
*x*
(
*t*
) =
*
A*
(

*A*
(
*t*
) =
.

The next Maple routine plots that solution function for the equation
*x*
' ' + 4.81
*x*
= 0.81 cos(2
*t*
), with initial conditions
*x*
(0) =
*x*
'(0) = 0 from Example 1 of Section 3.4 of
*Diacu*
. The plot illustrates the phenomenon of
*beats*
.

`> `
**plot (2*sin(t/10)*sin(21*t/10), t = 0..65) ;**

`> `

The final routine graphs the solution function for a resonant system, namely the one from Example 2 of Section 3.4 of Diacu:
*x*
' ' + 4.81
* x*
= 0.81 cos(2.2
*t*
), with the same initial conditions as before:
*x*
'(0) =
*x*
(0) = 0. Note the steadily increasing amplitude of the oscillation.

`> `
**plot((0.81*t/4.4)*sin(2.2*t), t = 0..100);**

`> `

Maple
^{TM} is a registered trademark of Waterloo Maple Inc.

Math rendered by
WebEQ