Lab 4: Differential Equations Solutions Example
As per usual, we will start by clearing Maple's memory:
In this week's lab we are going to be making spherical plots, so I am going to load the "plots" package Maple uses for some high end plotting with the command:
Problem 1: Damped Simple Harmonic Oscillator
a. We start attacking problem 1 by entering the differential equation and the initial conditions.
| > |
ode
:= (diff(x(eta), eta$2))+B*(diff(x(eta), eta))+(2*Pi)^2*x(eta) = 0; |
 |
(1.1) |
| > |
ics := x(0) = 1, D(x)(0) = 0; |
 |
(1.2) |
Now we use dsolve to solve the differential equation...
| > |
dsolve({ode, ics}, x(eta)); |

 |
(1.3) |
Oh... that's pretty.
b. Let's grab the right hand side of that equation, the solution, and save it into a function name so that we can plot it.

 |
(1.4) |
Now I use the animate command to create a plot for eta running from 0 to 5 (horizontal), x running -1 to 1 (vertical), and a value of B, the damping constant, which changes from 0 [no damping] to 20 [mucho damping].
| > |
animate(plot, [soln, eta = 0 .. 5, x = -1 .. 1], B = 0 .. 20, frames = 50); |
c. For B=0, there is no damping, and the system behaves just like a classical Hooke's Law simple harmonic oscillator. However, as B increases, damping increases. Initially (for B ~ 1), the solution shows an oscillator whose amplitude keeps decreasing with continued damping. As B continues increases, eventually we reach the point where damping forces are comparable to the Hooke's law force and the system just simply slowly slides into equilibrium. The transition from damped oscillating to a slow slide occurs at B~12.
Problem 2: Damped Driven Simple Harmonic Oscillator
a. We attack the second problem by again entering the differential equation and its initial conditions, then using dsolve to get the solution.
| > |
odeb := (diff(y(eta), eta$2))+bb*(diff(y(eta), eta))+(2*Pi)^2*y(eta) = f*cos(omgT*eta); |
 |
(2.1) |
| > |
icsb := y(0) = 0, D(y)(0) = 0; |
 |
(2.2) |
| > |
dsolve({odeb, icsb}, y(eta)); |
b. Now that we have that beautiful analytical solution, we again copy the right hand side into a function we can plot... but this time we are going to simplify it as well.
Set the natural frequency of the oscillator.
 |
(2.6) |
Set the driving amplitude.
 |
(2.7) |
Make an animated plot for t=0 to 25, y=-5 to 5, where we vary the driving frequency from 0.2 to 80.
| > |
animate(plot, [[soly,cos(omgT*eta)], eta = 0 .. 25, y = -5 .. 5, numpoints = 100], omgT = .2..10); |
c. For low values of the driving frequency, omgT, the amplitude is low and quickly dies out. However, as omgT approachs the natural frequency of the system, 2*pi, then the amplitude increases rapidly. Once omgT is significantly higher than the natural frequency of 2*pi, the amplitude settles down to be roughly half the driving amplitude.
d. For low values of omgT, we see the oscillator (red lines) gets closer and closer to being in phase with the driving force (green line) as the frequency increases. But as the frequency omgT increases and eventually surpasses the natural frequency of the system (2*pi), the oscillator switches to moving out of phase with the driving force. It may be easier to see this if you stretch out the horizontal axis.
e. The
driving frequency, omgT,
which triggers a massive increase in the amplitude of the system is when omgT is
near 2*pi , which is the natural frequency of the system when undriven (I
know this by looking at the original differential equation and noting the
term in front of the 'x', which is omega^2 = 4pi?^2, so omega=2*pi?).