Double Pendulum illustration

Double Pendulum

The double pendulum is the textbook example of deterministic chaos: two rigid arms swinging from each other, governed by fully nonlinear equations of motion that the simulator integrates with fourth-order Runge–Kutta. Set the two lengths, the two masses, gravity and the release angle, and watch the glowing tip trace fading trails across a dark canvas. The pendulum-count slider turns on ghost-swarm mode: up to 60 pendulums start just 0.0001 radians apart, coloured by hue across the spectrum, and stay visually identical for a few swings before diverging into rainbow chaos. A trail toggle switches the glow off, elapsed simulation time is shown live, and the total energy of the first pendulum is reported together with its drift so you can check the integrator against the exact conservation law. Export any frame as a PNG.

Runs 100% in your browser — simulations are computed locally on your device.

Notes

  • The equations of motion couple the arms through sin(θ₁−θ₂) terms and the squared angular velocities; no closed-form solution exists, so numerical integration is the only way in.
  • Trajectories released 10⁻⁴ rad apart separate exponentially — the hallmark of a positive Lyapunov exponent. After the first flip of the inner arm, prediction is effectively hopeless.
  • The ideal frictionless pendulum conserves total energy exactly; the drift readout shows how far the RK4 integrator strays from that invariant over time.
  • Runs 100% in your browser — simulations are computed locally on your device.