How to play
This is a sandbox, not a game with a score. A double pendulum is one rod hanging from a pivot with a second rod hanging from its end. Grab either bob and drag it to choose the starting angles, then let go. The simulation runs as soon as you release. Watch the second bob: for small swings it moves in a neat, almost repeating pattern, but with a bigger start it wanders in a way that looks random, even though every step follows exact laws.
Try the presets first. “Small swing” is nearly periodic, “Large swing” is chaotic, and “Chaos fan” launches 100 pendulums whose starting angles differ by only one hundred-thousandth of a radian. At first they move as one. After a while the fan tears apart into every colour of the rainbow.
Controls
- Mouse: press and drag a bob to set its angle. Release to run.
- Touch: drag a bob with your finger. The page does not scroll while your finger is on the simulation area, so use the space around it to scroll.
- Keyboard: focus the simulation, then use Space (play/pause), the period key (one step), R (reset) and the arrow keys (left and right change θ1, up and down change θ2).
- Buttons: Play/Pause, Step (advances about 1/60 of a simulated second), Reset (back to the starting angles) and a speed slider from 0.25× to 4×.
- Sliders: rod lengths, masses, gravity and damping. Damping 0 is the ideal, loss-free pendulum.
The equations
Each angle θ is measured from straight down. Write Δ = θ1 − θ2, ω = dθ/dt and α = dω/dt. The point masses hang on massless rods, and the equations of motion, derived from the Lagrangian, are:
m2L2α2 + m2L1α1 cosΔ = m2L1ω1² sinΔ − m2g sinθ2
These are two linear equations in α1 and α2, so the simulator solves them at every step. It then advances the angles and angular velocities with the fourth-order Runge–Kutta method (RK4) using a fixed step of 2 milliseconds. The damping slider adds a friction torque −cω at each joint. The total energy is:
With damping at zero, energy should stay constant. The “Energy drift” readout shows the change since the start as a percentage of the energy above the resting position. It stays tiny, which shows that the numerical method is doing its job. With damping above zero, energy only ever goes down.
Why it is chaotic
Chaos here means sensitive dependence on starting conditions: two runs that begin almost identically separate faster and faster. Turn on Chaos mode and open the divergence chart. It plots the angle difference of the first two pendulums on a logarithmic scale, so a steady rise means roughly exponential growth. Nothing random is involved. The motion is fully determined, but any tiny error or rounding difference gets amplified, so long-term prediction is practically impossible. Small swings are different: the pendulum behaves almost like two coupled simple oscillators and stays regular.
The phase-space plot draws θ2 against ω2. Regular motion gives tidy closed loops; chaotic motion fills the plane in a tangle.
Tips and strategy
- Start with both bobs at the same small angle, then raise the angles a little at a time and notice where regular motion becomes messy.
- Drop the pendulum from an almost upside-down position to see how a tiny change in angle decides which way it falls.
- Give the bottom bob a large mass (“Heavy bottom”) or shrink it and compare the patterns. A tiny m2 makes the top rod behave like a plain pendulum with period 2π√(L1/g) for small swings.
- Use Step with the trace on to study a single turn slowly, or 4× speed for a long exposure.
- In Chaos mode try a difference of 10−6 versus 10−3 and compare how long the pendulums stay together.
Frequently asked questions
Is the double pendulum really random?
No. The equations are deterministic. It only looks random because tiny differences grow so quickly that you cannot predict the far future from a measured start.
Why does the energy drift a little?
Any numerical integrator has a small error. RK4 with a 2 ms step keeps it far below a thousandth of a percent over a minute of simulated time in typical runs, but it is not exactly zero.
Why do my results differ from someone else’s run?
Different step sizes, methods or rounding lead to different paths once the motion is chaotic, even though all are “correct” in a statistical sense.
What does the damping slider do?
It adds a friction torque proportional to each joint’s angular velocity. Energy then only decreases, and the pendulum slowly settles to hang straight down.
Is this physically accurate for a real toy?
It is the ideal model: point masses, massless rigid rods, no air drag unless you add damping. Real pendulums have rod inertia and friction, so their details differ.