PHY301 - Worksheet 2, Fall 2005
Driven, damped, linear oscillations
Initial value problems in ODE's
Due: Oct 7, 2005 (three weeks)
In most oscillatory physical systems, small amplitude
oscillations obey simple harmonic motion. Examples which
you study in undergraduate physics include a mass+spring
system, a pendulum, and an LC circuit. Each of these
examples has a ``natural frequency'' (in radians/sec):
(1) |
PROBLEMS
Problem 1. Find the differential equation for driven (with
a sinusoidal drive), damped linear oscillations.
Give examples of what each
term in the equation corresponds to in the cases of:
A mass+spring system; A pendulum; A linear(i.e. just
resistors, capacitors and inductors) electical circuit. In the
mass+spring and pendulum cases, consider dissipation
to be due to a ``drag'' force (ie. proportional to
velocity).
Problem 2. Mathematica can
analytically solve the differential equation for driven
damped linear oscillations. Write a Mathematica
code to do this and then use your code to plot the behavior
as a function of time. For initial conditions, let the
position and velocity both be zero at time t=0. Let the
frequency of the driving term be equal to the natural frequency
of oscillation.
Plot data which
illustrate the following cases: Underdamped motion;
Overdamped motion, and Critically Damped motion.
Problem 3. The final problem in this worksheet will be to
write a c++ program to solve the differential equation you found in
problem 1. But before undertaking that, it will be helpful to warm up
with an easier problem: one that involves a first-order differential
equation instead of a second-order equation.
(a) Solve the equation dx/dt - 2*x + 4*t = 0
for x(t) with the
boundary condition x(0)=0, and graph the resulting x(t) in the region
0 < t < 1 using Mathematica's DSOLVE to obtain an explicit solution.
(b) Repeat part (a) using Mathematica's NDSOLVE to obtain a
numerical solution.
(c) Repeat part (a) by writing a c++ program that solves the
differential equation numerically by dividing the time interval
0 < t < 1 into small equal steps and moving from one time step to
the next using Euler's method: x(t + delta) = x(t) + delta*x'(t),
with x'(t) taken from the differential equation.
(d) Repeat part (c) but improve it by using the Runge-Kutta
method in place of Euler's method to move from each step to the next.
You can use either second-order or fourth-order Runge-Kutta.
(Discussion of various methods for solving initial value problems
like this can be found in
Chapter 16 of
Numerical Recipes online,
particularly sections 16.0-16.1.
You may also be able to use
GNU Scientific Library -- look under Ordinary Differential Equations).
Problem 4. Now go back to the second order differential equation of problem 1. Rewrite it as a first order equation for a two-dimensional vector object whose components are x and dx/dt. Revise your Euler and Runge-Kutta programs to numerically integrate this first order equation and check that your results agree with those obtained using Mathematica.
Illustrate the case of underdamped driven oscillations using
your code (i.e., write a data set to a file and
then plot it using xmgrace). Choose the overall time for the plot
such that approximately 20 oscillations occur. Choose the damping
parameter such that damping is strong enough to be seen.
Make plots using the Euler and Runge-Kutta methods, and investigate how
small the time step must be in order to get accurate results.
(Note that Runge-Kutta is an old workhorse and works well for many
problems. However in some research problems, more elaborate methods
such as ``Verlet'', ``Bulirsch-Stoers'' are preferred. Some equations
are not well approximated by any explicit method, so that an ``implicit''
method is needed. We will return to this later in the course when we
consider partial differential equations, in particular the Schroedinger
equation.)