Double Pendulum Exercise

Background

In this exercise we will explore the dynamics of the double pendulum. This is a classic example of a chaotic system. It will give a rather brief overview of some of the concepts you would see in a nonlinear dynamics class. The double pendulum, illustrated to the right, is a much richer system than the simple pendulum. The equations of motion involve four variables: theta1,theta2,omega1,omega2. These are derived in several places. For example: MathWorld, Wikipedia, and myphysicslab.

Learning Goals

Science: The double pendulum will illustrate a simple chaotic system. You will learn how to deal with time series data, how to make Poincare sections, and how to diagnose chaos.

Computation: You will learn how to deal with multidimensional data sets in an interactive environment.

Procedure

Setup

  1. It is strongly recommended that you first do the Pendulum Exercises. Much of the current exercise will make more sense after understand how to work with that simpler system.
  2. This exercise is written assuming you will use odeint as your integrator. Feel free to use smartodeint instead. Some of the exercises (such as making the Poincare section) will then be a little easier. You will however need to write a parametricplotfunction routine, which can be modelled off of plotfunction.
  3. Create a new directory
  4. Download the following files:
  5. Rename DoublePendulumHints.py as DoublePendulum.py, and open it in a text editor (for example, kate, gedit, or emacs).
  6. Move to the correct directory and start Python with ipython -pylab.
  7. The equations of motion for the Double Pendulum are given in the hints file as DoublePendulumDerivArray. This routine is alread filled in so that you don't have to go through the tedium of copying/coding formulas. The math to calculate these derivatives is straightforward -- we urge you to write down the Lagrangian and work out the dynamics, and see if you agree with what we wrote. Note that DoublePendulumDerivArray is called by not only vars and t but also by all of the relevant parameters: (l1,l2,m1,m2,g). There are several methods of sending these parameters to the function. We will use a technique which is common in Python interfaces. In the method used here, every time we call DoublePendulumDerivArray we will include the parameters. This means that the integrator, odeint needs to know about the parameters. This is done through the use of the args argument, which is a tuple which is unpacked and then fed into the derivative function.
  8. Calling odeint with DoublePendulumDerivArray, and dealing with the output can cause headaches. Good programing practice would have you write a wrapper around odeint which takes care of all of these issues.
  9. Experiment with the case l1=l2=m1=m2=1. Start with small values of initial_omega1. For example, try the following: traj1= DoublePendulumTrajectory(initial_omega1=0.1,timestep=0.1,numstep=2000). Does the result make sense? Plot everything that might be relevant (eg. all of the state variable against eachother).
  10. Try larger amplitudes. You may find it useful to type something like triallist=[(s,DoublePendulumTrajectory(initial_omega1=s,timestep=0.1,numstep=2000)) for s in arange(0.1,3,0.1)].
  11. Lets make a few more functions which can be used to investigate this system.

Poincare Section

  1. You have probably found that it is hard to extract too much info from these time series. The basic problem is that this is a multidimensional data set: we have four state variables, plus time. We can however use a technique from nonlinear dynamics to reduce the size of the data set -- this approach is to make a "Poincare Section", a 2-dimensional cut through the phase space of the system. The first thing to note is that we do not actually have a 5D problem.
  2. Examine the poincare sections for small amplitude motion. For example longtraj1= DoublePendulumTrajectory(initial_omega1=0.1,timestep=0.1,numstep=60000) then ShowDoublePendulumPoincare(longtraj1). How does this compare to the case when you excite only the in-phase mode?
  3. Examine larger amplitude motion, for example with initial_omega1=1.3. What feature of the Poincare section is different? Note this is still regular motion. Investigate the time series. What aspect of the motion can be associated with the change in the behavior of the Poincare section?
  4. Look at even larger amplitude motion, say initial_omega1=1.5. What happens to the Poincare section? This is indicative of Chaos. What does the fourier spectrum of the time series look like?
  5. To see what the Poincare sections should look like, see Introduction to Pendulum Module.

Sensitive dependance on initial conditions

  1. Explore how sensitive the trajectories of the pendulum are to small changes in initial conditions. Compare the case where the motion is regular to that of the chaotic regime.

Animation

  1. Download the file AnimateDoublePendulum.py. This animation was put together by Bruce Sherwood at North Carolina State. It is covered by a Creative Commons Attribution 2.5 License which essentially means you can use it as you like -- but should properly cite the source. For a list of some of Bruce's other demos (and those of his collaborators), see Public Programs VI and Public Programs VII. Many of these are good examples of making interactive graphics, where you can use the mouse to manipulate things.
  2. Start a new python session -- do not use the -pylab flag. Type %run AnimateDoublePendulum.py. Watch the behavior. Play with the different parameters -- the lengths of the various bars, the initial conditions, etc.
  3. Use this animation to visualize the various different behaviors you saw previously.

Useful Constructions/Syntax

Science Concepts

Files

Links


James P. Sethna, Christopher R. Myers, Erich J. Mueller.

Last modified: September 25, 2008

Statistical Mechanics: Entropy, Order Parameters, and Complexity, now available at Oxford University Press (USA, Europe).

Notes