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)

\begin{displaymath}\omega_0=(k/m)^{1/2},\ \ \omega_0=(g/l)^{1/2},\ \ \ \omega_0=(1/LC)^{1/2}
\end{displaymath} (1)

If we add a small amount of damping or ``dissipation'' to any of these systems, the amplitude of oscillation decreases slowly with time. This is the ``underdamped'' limit. If the dissipation is large the system is ``overdamped'' and the oscillatory behavior ceases altogether. If we also add a sinusoidal driving force, then the frequency of the driving force competes with the ``natural'' frequency of the system. However at a special frequency called the ``resonant frequency'', the driving frequency matches the natural frequency, and the amplitude of oscillations can get very large. Resonance is a very important practical phenomena. For example bridge designers must ensure that the typical winds in an area cannot resonate with a natural frequency of the bridge or disasters can happen. The same is true of skyscraper design.

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 $dx/dt = (x(t+\delta t) - x(t))/\delta t$.

(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.