mljr.eu
Back

Double Pendulum

Chaotic motion from hinged pendulum segments — tiny changes in the starting angle send it on a wildly different path. Add segments or change the physics parameters below and hit Reset.

Segment 1
Segment 2
Segment 3

How it works

The original was a mislabeled three-body physics toy running on a CDN-loaded engine, not an actual double pendulum. This is a real from-scratch rebuild: a generalized chain of 2 to 5 rigid pendulum segments, each with its own length and mass.

The equations of motion come from Lagrangian mechanics: at every step, a mass matrix that couples every segment to every other segment is solved to get each segment's angular acceleration, then integrated forward with fourth-order Runge-Kutta. RK4 was chosen over a simpler integrator because energy errors compound fast once more than two segments are coupled — a cruder method visibly drifted and sped up over time instead of conserving energy.

Segment count, per-segment length and mass, gravity, and simulation speed are all adjustable below — change them and hit Apply & Reset to see how the chaos responds. More segments and wider starting angles make the motion noticeably more unpredictable.

θ₁m₁, l₁θ₂m₂, l₂...continues for each added segment