Double Pendulum Simulator

Drag either arm to set the starting position. Run a dozen copies that differ in the ninth decimal place and watch how long it takes before they are visibly different — that waiting time is what “chaos” actually measures.

6
1e-9
1.0
1.0
1.00
1.00
0.00
1.00×

Drag either bob to reposition the arms · releasing restarts every copy from that position.

Simulated time0.00 s
Total energy—
Energy drift—
Spread of copies—

Separation between the first copy and each of the others, log scale. A straight line on this plot is exponential growth, and its slope is the Lyapunov exponent. The curve flattens once the copies are as far apart as the system allows — that ceiling is where prediction has completely failed.

Starting positions worth trying

What makes this chaotic and a single pendulum not

One pendulum is integrable: its motion is a closed curve, and knowing the initial angle to three decimal places tells you where it will be an hour later to about three decimal places. Attach a second arm and the phase space becomes four-dimensional with only two conserved quantities, which is exactly enough room for trajectories to separate exponentially instead of drifting apart linearly.

At small amplitude none of that shows. Load Small swing and the copies stay together indefinitely, because near the bottom the equations linearise into two independent normal modes and the system is effectively integrable. Push the starting angle past roughly 90° and the second arm can go over the top, and from there the separation plot turns into a straight line.

Precision buys you almost nothing

Set the offset to 1e-3 and note how long it takes for the copies to visibly separate. Now set it to 1e-12 — a billion times more precise — and time it again. It does not take a billion times longer. It takes a fixed extra amount, because exponential growth means that every factor of ten in initial accuracy buys the same small constant of extra predictable time.

The same effect measured properly on the Lorenz system: improving the initial precision by a factor of ten extended the useful prediction window by only 2.7 time units, every time. Ten times the accuracy, a fixed small bonus — not ten times the forecast. The measurement is here. This is the reason weather forecasts stop at about two weeks and will still stop at about two weeks with far better instruments.

Why the energy readout is on the page

A chaotic simulation is easy to fake: any integrator will produce plausible-looking wild motion, including one that is quietly injecting energy. So the total energy is displayed along with its drift from the starting value. This page integrates the exact equations with classical fourth-order Runge–Kutta at a fixed small step, which typically holds the drift below a part in a million over a minute of simulated time. If the number starts climbing, the motion on screen is the integrator’s and not the pendulum’s — and now you can see that happening instead of having to trust it.

The equations

With δ = θ₁ − θ₂ and D = 2m₁ + m₂ − m₂cos2δ:

θ₁″ = [−g(2m₁+m₂)sinθ₁ − m₂g·sin(θ₁−2θ₂) − 2sinδ·m₂(ω₂²L₂ + ω₁²L₁cosδ)] / (L₁D)

θ₂″ = 2sinδ[ω₁²L₁(m₁+m₂) + g(m₁+m₂)cosθ₁ + ω₂²L₂m₂cosδ] / (L₂D)

These are the exact equations for two point masses on rigid massless rods, with no small-angle assumption anywhere. Damping, when you turn it on, is added as a term proportional to angular velocity — that is a modelling choice rather than something derived, and it is off by default so that the energy figure means what it says.

What will you try next?

Share this tool

Part of Shake AI Lab — interactive experiments in mathematics and machine learning. · More tools · 日本語の解説記事