PHY301 - Worksheet 2, Fall 2003
Driven, damped, linear oscillations
Initial value problems in ODE's
Due: Oct 10
In many oscillatory physical systems the small amplitude
oscillations obey simple harmonic motion. Examples which
you study in undergrad. 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. Plot data which
illustrate the following behaviors: Underdamped motion;
Overdamped motion and; Resonance (here an animation is
particularly impressive).
Problem 3. Write a c++ program to solve the differential equation you found in problem 1:
(a) Using the simple (Euler) forward time difference .
(b) Using the Runge-Kutta method (you can examine the C code in numerical recipes as a starting point; or you can use routines from the GNU Scientific Library -- look under Ordinary Differential Equations).
To use the GNU Scientific Library, the compiler needs to be told about it. Use for example
  g++ -o test.x test.cpp -lgsl -lgslcblas
  ./test6.x
to compile and run a test of the Bessel Function routine:
#include < stdio.h>
#include <./gsl/gsl_sf_bessel.h>
int main()
{
double x = 5.0;
double y = gsl_sf_bessel_J0 (x);
printf ("J0(%g) = %.18e\n", x, y);
return 0;
}
Discussion of various methods for solving these initial value problems can be found in Chapter 16 of Numerical Recipes online and you should read through that chapter, particularly sections 16.1-16.4.
Illustrate the case of underdamped driven oscillations using
your code (ie. write a data set to a file and
then plot it using xmgrace). Plot and compare your data for the
code (a) and for the code (b) with the same time
interval. Explain the difference between a ``first order method''
and a ``second order method'' for solving ODE's and hence
why the Euler method is poor compared to Runge-Kutta. Note that
Runge-Kutta is an old workhorse and a good place to start in
understanding higher order ``explicit'' methods. However in
research problems other explicit methods such as ``Verlet'', ``Bulirsch-Stoers''
etc. are preferred. Some equations are not well approximated by
any explicit method, so that an ``implicit'' method is needed. We
shall return to this later in the course when we consider partial
differential equations, in particular the Schrodinger equation.