Skip to content
ScienceQuest
Mechanics Simulator Undergraduate

Double Pendulum Simulator

Released high, a double pendulum is chaotic. Simulate one from its exact equations and watch a ghost started a millionth of a degree away drift apart.

Simulator

Drag either bob to set its starting angle. The left and right arrow keys turn the upper arm, and the up and down arrow keys the lower arm. Space plays and pauses.

Visibly apart after
The first moment the two lower bobs are more than a tenth of the pendulum’s full reach apart, 20 cm at these lengths. Worked out by stepping the model ahead of the animation, so it is known before you press Play.
…
Growth rate λ
The λ in δ(t) ≈ δ₀e^(λt), averaged from the release to the moment of parting. There is none to average while the two have not parted.
…
Gap between lower bobs
Straight-line distance between the pendulum’s lower bob and the ghost’s, now.
1.75 × 10⁻⁸ m
Energy drift
How far the computed total energy has moved from its starting value, as a fraction of it. The ideal pendulum conserves energy exactly, so this is the integrator’s error, not physics.
0
Total energy
Measured from the hanging rest position: the work it takes to lift both bobs to their starting angles.
44.1 J
Enough energy to flip
An arm can only go over the top if the energy covers the lift. The lower arm needs more than 2m₂gL₂, 19.62 J here, and the upper arm more than 2(m₁ + m₂)gL₁, 39.24 J. Enough energy makes a flip possible, not certain.
Both arms
Small-swing periods
The two normal modes of small swings: the arms in step, with the lower one swinging 1.41 times as far as the upper, and opposed, at 1.41 times as far the other way. Small swings are a mix of the two and are never chaotic.
2.62, 1.09 s
Parameters
°

From straight down. Drag the upper bob to set it.

°

Also from straight down, not from the upper arm.

m
m

Only the ratio of the two lengths shapes the motion. Longer arms make the same swing more slowly.

kg
kg

Only the ratio of the two masses changes the motion. Doubling both doubles the energy and nothing else.

m/s²

Earth 9.81, the Moon 1.62. Gravity sets only the pace: a quarter of it gives the same swing, twice as slowly.

Added to the ghost’s upper arm. Everything else about the two is identical.

The last three seconds of each lower bob’s path.

The distance between the pendulum’s lower bob and the ghost’s over the first 20 seconds, on a logarithmic scale. A straight rising stretch is exponential growth, and the dashed line is a tenth of the reach, where the two count as visibly apart.
The lower arm’s angular velocity against its angle over the first 20 seconds. Regular motion traces a tidy band. Chaotic motion wanders across the plane, and the line breaks where the arm goes over the top and its angle jumps from 180 to minus 180 degrees.

Citing this tool

Last updated . Add the date you accessed it as well, which a citation of a page that can change asks for. If a specific result matters, cite the permalink from the tool’s share row instead of this page: it reproduces the exact parameters.

Teaching with this? You can put it on a class page or LMS for free, with no ads inside the frame. Get the embed code.

The equation

δ(t)≈δ0 eλt\delta(t) \approx \delta_0\,e^{\lambda t}

Lyapunov (1892), measured on a double pendulum by Shinbrot, Grebogi, Wisdom and Yorke (1992)

Is a double pendulum chaotic?

Yes, once it swings high enough. A double pendulum is a pendulum hung from the bob of another, and released from large angles its motion is chaotic: two releases that differ by far less than anything you could measure end up swinging completely differently within seconds. This simulator solves its exact equations of motion twice at once, for the pendulum and for a ghost whose upper arm starts a millionth of a degree further round, and at the default release, both arms at 120°, the two lower bobs are visibly apart after 12.1 seconds.

What grows is the gap between them, and it grows roughly exponentially, δ(t) ≈ δ₀ e^(λt), where δ₀ is the starting gap and λ the growth rate. That is why a tiny head start is no protection. At the default release the gap doubles about every half second, so 17 nanometres becomes 20 centimetres in about 23 doublings.

The equations of motion

Measure both angles from straight down and call them θ₁ and θ₂, with ω₁ and ω₂ their rates of change, and write d = θ₁ − θ₂. For two point masses on light rigid rods, Lagrange’s equations give the two angular accelerations exactly:

  • α₁ = [−m₂L₂ω₂² sin d − (m₁ + m₂)g sin θ₁ − m₂ cos d (L₁ω₁² sin d − g sin θ₂)] / [L₁(m₁ + m₂ sin² d)]
  • α₂ = [(m₁ + m₂)(L₁ω₁² sin d − g sin θ₂) + cos d (m₂L₂ω₂² sin d + (m₁ + m₂)g sin θ₁)] / [L₂(m₁ + m₂ sin² d)]

They come from the Lagrangian Landau and Lifshitz give for the coplanar double pendulum, L = ½(m₁ + m₂)L₁²ω₁² + ½m₂L₂²ω₂² + m₂L₁L₂ω₁ω₂ cos d + (m₁ + m₂)gL₁ cos θ₁ + m₂gL₂ cos θ₂, and nothing in them is approximated: there is no small-angle assumption anywhere. Many references print the same equations with a denominator of 2m₁ + m₂ − m₂ cos(2θ₁ − 2θ₂), which is twice m₁ + m₂ sin² d. The simulator integrates them with fourth-order Runge-Kutta at a step of 1 ms or less and checks itself against the one quantity the true motion must keep fixed, the total energy E = ½(m₁ + m₂)L₁²ω₁² + ½m₂L₂²ω₂² + m₂L₁L₂ω₁ω₂ cos d + (m₁ + m₂)gL₁(1 − cos θ₁) + m₂gL₂(1 − cos θ₂), measured from the hanging rest position. The Energy drift readout is how far the computed value has strayed from its start.

Worked example: how long until the ghost parts company?

Take the defaults: 1 m arms, 1 kg bobs, g = 9.81 m/s², both arms released from rest at 120°, and the ghost’s upper arm a millionth of a degree further round.

  1. The energy. Each bob is lifted from its lowest point, so E = (m₁ + m₂)gL₁(1 − cos θ₁) + m₂gL₂(1 − cos θ₂) = 2 × 9.81 × 1.5 + 9.81 × 1.5 = 44.1 J. That is more than both flip thresholds, 2m₂gL₂ = 19.62 J for the lower arm and 2(m₁ + m₂)gL₁ = 39.24 J for the upper, so either arm may go over the top and the Enough energy to flip readout says Both arms.
  2. The starting gap. Turning the upper arm by δ carries the whole lower arm with it, so the lower bob moves by 2L₁ sin(δ/2): 2 × 1 m × sin(0.0000005°) = 1.75 × 10⁻⁸ m, about 17 nanometres.
  3. The line to cross. Visibly apart means more than a tenth of the full reach, 0.1 × (1 m + 1 m) = 0.2 m.
  4. The moment. Stepping both pendulums, the gap first passes 0.2 m at 12.077 s, which the Visibly apart after readout shows as 12.1 s.
  5. The growth rate. λ = ln(0.2 m / 1.75 × 10⁻⁸ m) / 12.077 s = 16.25 / 12.077 s = 1.35 per second, the Growth rate λ readout. The gap therefore doubled on average every ln 2 / λ = 0.515 s.

Precision buys time only slowly

Change the ghost’s head start and watch the Visibly apart after readout. At the default release:

  • a head start of 1°: visibly apart after 3.37 s
  • 0.001°: after 8.55 s
  • 0.000001°, a millionth of a degree: after 12.1 s
  • 0.000000001°, a billionth of a degree: after 17.1 s

Each thousandfold improvement in how precisely the start is known buys only 3.5 to 5.2 more seconds of agreement. That is exponential growth seen from the other side: if the gap grows as e^(λt), shrinking the starting gap a thousandfold delays any given gap by only ln(1000)/λ, which is 4.9 s at the λ of about 1.4 per second that a long run of this release settles on. Knowing the angles to a billionth of a degree, far finer than any protractor or camera could manage, would still predict this pendulum for under 20 seconds.

That is what separates chaos from ordinary uncertainty. In an ordinary calculation an uncertainty in an input carries through to the answer in proportion, which is what the error propagation calculator works out: halve the uncertainty and the answer is twice as precise. Here halving it buys about half a second. Gravity can behave the same way: the single planet in the orbit simulator follows a regular ellipse, and a second body can make the problem chaotic.

When the double pendulum is not chaotic

Small swings are perfectly regular. With both angles small, sin θ ≈ θ, the equations become linear, and the motion is a mix of two normal modes whose angular frequencies are

  • ω² = g/(2m₁L₁L₂) × [(m₁ + m₂)(L₁ + L₂) ∓ √((m₁ + m₂)((m₁ + m₂)(L₁ + L₂)² − 4m₁L₁L₂))]

For 1 m arms and 1 kg bobs that gives periods of 2.62 s, with the arms swinging in step and the lower one √2, about 1.41, times as far, and 1.09 s, with the arms swinging opposite ways. Each mode on its own is simple harmonic motion, the kind the mass spring simulator shows, and the Small-swing periods readout gives both for whatever you set. Release the pendulum from 5° and 7°, close to that √2 ratio, and it swings almost purely in the slow mode: the fast mode’s amplitude is only 0.5 percent of the slow mode’s. Release it from 30° and 30° and the ghost keeps company with it: after 20 seconds the gap is 21 nanometres, hardly more than the 17 it started at. A single arm is never chaotic, whatever the amplitude, which is why the simple pendulum simulator can give an exact period for any release.

Energy draws a sharper line. An arm can only go over the top if the energy covers lifting it there, which takes more than 2m₂gL₂ for the lower arm and more than 2(m₁ + m₂)gL₁ for the upper. Each is a plain mgh, the sum the gravitational potential energy calculator does, with m the mass lifted and h twice the arm’s length. Released from 90° and 90°, the pendulum has 29.43 J against thresholds of 19.62 J and 39.24 J, so the lower arm may flip but the upper arm never will, however long it swings. With equal masses and equal arms, neither arm can flip whenever 2 cos θ₁ + cos θ₂ is 1 or more.

Why the swing on screen is not the true motion for ever

Numerical error grows the same way the ghost’s offset does. At the default release the 1 ms Runge-Kutta step is accurate to about 7 × 10⁻⁹ rad over the first five seconds, but runs at that step and at half of it put the lower bob a tenth of the reach apart after 15.6 seconds. Beyond that the swing on screen still keeps its energy to a few parts in a billion, but it is no longer the swing that began from exactly the angles you set. The billionth-of-a-degree ghost above parts after that horizon, which is why its moment depends on the step: 17.1 s at 1 ms, 17.0 s at a quarter of it. No finite step escapes this, and a smaller one only postpones it by the same slow, logarithmic amount the ghost shows. The model notes below give the measured figures.

The same sensitivity is why the simulator carries its own sine and cosine. JavaScript lets each browser engine round Math.sin in its own way, and measured on a Mac the engines behind Chrome and Safari disagree in the last binary digit of about 4 percent of sines. With the built-in functions, the default swing put the lower bob more than 10 cm apart in the two engines after 25 seconds, so one shared link would have shown two readers two different pendulums. The simulator’s functions use only arithmetic that every engine rounds identically, so a link reproduces the same run everywhere.

Reading the two plots

The upper plot is the gap between the lower bobs on a logarithmic scale, so exponential growth is a straight line, rising λ/ln 10 decades a second. The gap climbs in a ragged ramp from its starting size to the dashed line at a tenth of the reach and then levels off, because two lower bobs on pendulums of the same size can never be more than twice the reach apart. The lower plot is the lower arm’s phase portrait, its angular velocity against its angle. Regular motion draws a tidy band that it keeps retracing. Chaotic motion wanders over a whole region, and every break in the line is the arm going over the top, where its angle jumps between 180° and −180°.

What this model leaves out

  • Friction and air. The pivots are frictionless and there is no drag, so the energy is constant and the chaos never dies away. A real double pendulum loses energy to its bearings and the air, so its swings shrink until the motion is small and regular.
  • Arms with mass. The rods are massless and the bobs are points. Arms with mass change the equations through their moments of inertia and move the flip thresholds, but not the chaos: Shinbrot, Grebogi, Wisdom and Yorke, reporting on a real double pendulum in 1992, measured small uncertainties growing exponentially at about 7.5 per second on their apparatus.
  • The third dimension. Both arms stay in one vertical plane. A real joint can let the lower arm wobble out of that plane, which a planar model cannot represent.
  • A perfect ghost. Nobody can release a real pendulum twice from angles a billionth of a degree apart, or even from the same angle twice. That impossibility is the lesson: the ghost is the only way to watch two nearly identical releases side by side.

Common mistakes

  • Thinking chaos means randomness. Nothing here is random. The same start always gives the same swing, which is why a shared link reproduces a run exactly. The difficulty is that the same start has to be exactly the same.
  • Expecting a better computer to predict it for ever. Precision buys time logarithmically: a start known a thousand times more precisely buys about 5 more seconds.
  • Assuming every double pendulum is chaotic. Small swings are regular: released from 30° and 30°, the ghost is still within 21 nanometres of the pendulum after 20 seconds.
  • Treating it as one long pendulum. Swinging in step at small angles, the default pendulum has a period of 2.62 s, not the 2.84 s of a single 2 m pendulum, because half its mass is the upper bob, which hangs only 1 m down, where a pendulum swings in 2.01 s.
  • Reading the energy drift as the chaos. The drift is the integrator’s error, a few parts in a billion over a minute at the default settings. The chaos is in the gap, which grows more than ten millionfold.
  • Measuring the lower angle from the upper arm. Here, as in most textbooks, both angles are measured from straight down, so θ₂ is not the bend at the middle joint.

Model and assumptions

Method
Runge-Kutta 4th order
Largest step
0.001 s
Repeatability
Deterministic. The same link gives the same numbers on any machine.

What it assumes

  • Two point masses on light rigid rods swinging in one vertical plane, with frictionless pivots and no air resistance, so the true motion keeps its total energy exactly.
  • The exact nonlinear equations from Lagrange’s equations are integrated, with no small-angle approximation anywhere; the small-swing periods are the separate closed-form normal modes.
  • The ghost is a second, independent pendulum started with its upper arm a set angle further round, stepped in lockstep by the same integrator.
  • The step is 1 ms, split into as many as six substeps where heavy lower bobs, short arms and strong gravity let an arm turn faster than 0.02 rad a step, a limit set from an energy bound on angular speed.
  • Sine and cosine are computed by the model from basic arithmetic alone, because browsers may round Math.sin differently in the last digit and chaos would turn that into a different swing within half a minute.

Where it stops holding. Long runs of a chaotic release. The integrator’s own error grows exponentially like the ghost’s offset, so at the default release runs at 1 ms and at 0.5 ms put the lower bob a tenth of the reach apart after 15.6 s. Beyond that the swing still keeps its energy but is no longer the one that began from exactly those angles. A real pendulum also has arms with mass and friction at its pivots, which this model leaves out.

Numerical accuracy

Estimated error
7.3e-9 rad in the upper arm angle, about 3.1e-9 of the largest value reached
How that was obtained
Running the same problem again at half the step changed the answer by at most 6.8e-9 rad over the first 5 s of the default release. Richardson extrapolation of that difference gives the figure above.
Observed order
3.97, measured from a second halving rather than assumed
Conditions
both arms released from rest at 120 degrees, 1 m arms, 1 kg bobs, 9.81 m/s², the shipped defaults

A chaotic run does not keep an error this small. It grows as fast as the ghost’s offset does, and runs at this step and at half of it put the lower bob a tenth of the reach apart after 15.6 s, after which the swing on screen is no longer the one that began from exactly the angles set. Energy is the better check on the physics: over the first minute of the default release it stays within 3.2e-9 of its starting value.

Double Pendulum Simulator: the logarithm of the gap between two double pendulums released almost together, growing with time.
The logarithm of the gap between two double pendulums released almost together, growing with time, computed by the simulator’s own model. Image © ScienceQuest, CC BY 4.0. Free to reuse with credit and a link to this page; how to reuse it. Download PNG

Common questions

Why is a double pendulum chaotic?

Because at large swings its equations are strongly nonlinear and it has enough freedom for nearby motions to pull apart. Its state needs four numbers, two angles and their rates, and a small difference between two releases gets stretched by a roughly constant factor every second, so it grows exponentially. At the default release the gap between the pendulum and its ghost grows by a factor of e about every 0.7 seconds. A single pendulum, with one angle and one rate, cannot do this, which is why its motion stays regular.

Is a double pendulum always chaotic?

No. Small swings are regular: the motion is a mix of two normal modes, the arms swinging in step or opposed, with periods of 2.62 s and 1.09 s for 1 m arms and 1 kg bobs. Released from 30° and 30°, the ghost here is still only 21 nanometres from the pendulum after 20 seconds, barely more than the 17 it started at. Chaos needs large swings: from 120° and 120° the two are 20 cm apart after 12.1 seconds.

How far ahead can you predict a double pendulum?

Only a few seconds more for every thousandfold improvement in how precisely the start is known. At the default release a ghost 0.001° away parts company after 8.55 s, one a millionth of a degree away after 12.1 s, and one a billionth of a degree away after about 17 s. Because the gap grows exponentially, shrinking it a thousandfold delays the parting by only ln(1000)/λ, about 5 seconds here, so no achievable precision predicts this pendulum for long.

Can the arms of a double pendulum flip over the top?

Only if the pendulum has more energy than the lift needs. The lower arm needs more than 2m₂gL₂ and the upper arm more than 2(m₁ + m₂)gL₁, which for 1 kg bobs on 1 m arms at 9.81 m/s² are 19.62 J and 39.24 J. Released from rest at 90° and 90°, the pendulum has 29.43 J, so the lower arm may flip but the upper arm never can, however long it swings. The Enough energy to flip readout does this check for whatever you set.

Why does this simulator compute its own sine and cosine?

So that a shared link gives the same swing in every browser. JavaScript lets each engine round Math.sin in its own way, and measured on a Mac the engines behind Chrome and Safari disagree in the last binary digit of about 4 percent of sines. Chaos magnifies that: with the built-in functions, the default swing put the lower bob more than 10 cm apart in the two engines after 25 seconds. The simulator’s own functions use only arithmetic that every engine rounds identically, so both produce the identical run.