PHY201 (C++) -- Worksheet 2, Spring 2012
Driven, damped, linear oscillations
Initial value problems in ODE's
In many oscillatory physical systems, the 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'' (generally measured 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 Runga Kutta method (you can use the C code in numerical recipes as a starting point).
Discussion of various methods for solving these initial value problems can be found in Chapter 16 of numerical recipes 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 Runga Kutta.