Simulate a double pendulum using the real Lagrangian equations of motion. Adjust masses, lengths, gravity and damping, and watch a ghost copy started a ten-thousandth of a radian away diverge completely.
Knobs patch the running animation live. A few (marked in the code as baked-in values like particle counts) restart the preview.
The real equations of motion, plus a ghost copy to show the chaos.
Your code runs in a sandboxed frame with no access to this page, and it is never sent to a server. three.js demos load the library from jsDelivr; the rest need nothing but the browser.
Nothing in this simulation is random. It integrates the equations of motion each frame, and identical starting conditions always produce identical motion. What makes a double pendulum chaotic is not randomness but sensitivity: differences in the starting state grow exponentially rather than staying proportional.
The ghost pendulum makes this concrete. It begins one ten-thousandth of a radian from the main one, a difference far too small to see. The two move as a single pendulum for several seconds, separate slightly, and are then doing entirely unrelated things. No better measurement of the starting angle would fix this - it would only postpone the divergence.
This is the same property that limits weather forecasting. The equations are known; the starting conditions can never be measured precisely enough.
Masses and lengths change the physics rather than the appearance. A heavy lower bob on a long lower arm stores more energy in the second segment and produces wilder motion.
Gravity scales the whole system's speed. Lower it towards lunar values and the same starting position unfolds slowly enough to follow by eye.
Damping is the one control that removes the chaos. At zero, energy is conserved and the motion never settles. Raise it and the pendulum loses energy until it drops into a predictable swing and finally stops.
A real simulation. It integrates the Lagrangian equations of motion for a double pendulum each frame, so masses, lengths, gravity and damping all change the behaviour the way they would physically.
It starts one ten-thousandth of a radian away from the main pendulum and is otherwise identical. The two track each other for a few seconds, then diverge completely. That is sensitive dependence on initial conditions, shown rather than asserted.
Because it is a nonlinear system with enough freedom for tiny differences to grow exponentially. A single pendulum is predictable indefinitely. Adding a second segment makes long-term prediction impossible in practice, even though the equations are completely deterministic.
Yes. A heavy lower mass on a long lower arm produces wilder motion, and raising damping settles the system into a predictable swing. Setting damping to zero conserves energy and the motion never settles.
Entirely. Nothing random is involved. The same starting conditions always produce the same motion; it is the sensitivity to those conditions, not randomness, that makes it unpredictable.