- J, drift - With angles from the downward vertical, the Lagrangian is L = T - V, T = ½(m1+m2)L1²θ1'² + ½m2L2²θ2'² + m2L1L2θ1'θ2' cos(θ1-θ2), V = -(m1+m2)gL1 cosθ1 - m2gL2 cosθ2. Euler-Lagrange gives two coupled nonlinear ODEs, solved with 4th-order Runge-Kutta (6 sub-steps per frame).
No friction, so total energy E = T + V must stay constant; the readout shows its relative drift as an independent numerical check (accepted below 1e-4). Chaos means the trajectory is still unpredictable long-term; a drifting E would signal integrator error, not physics. Simplifications: ideal massless rods, point-like bobs, no air drag, planar motion only.