Chaos theory - 2D twin double pendulums

Two double pendulums that differ by a hair: watch the gap grow exponentially until the motions are unrelated.

Switch to 3D

Presets

Playback

Parameters

Model checks

The science

The double pendulum

Two point masses m1, m2 on rigid massless rods l1, l2 have the Lagrangian L = ½(m1 + m2) l1² θ1'² + ½ m2 l2² θ2'² + m2 l1 l2 θ1' θ2' cos(θ1 − θ2) + (m1 + m2) g l1 cosθ1 + m2 g l2 cosθ2. Its Euler-Lagrange equations are coupled and nonlinear, with no closed form for large angles; here they are solved with a fourth-order Runge-Kutta scheme.

Sensitive dependence

For two trajectories that start a distance d0 apart, chaos means d(t) ≈ d0 eλt with a positive Lyapunov exponent λ, until the gap saturates at the size of the accessible space. The slope of ln d against time in the growing region is estimated live (a typical value for a vigorous double pendulum is a few per second). Reducing the initial difference by a factor of a million only delays the divergence by ln(106)/λ seconds: this is the butterfly effect, and it limits long-range prediction.

Order and chaos

Small angles give nearly harmonic motion with two normal modes (for equal masses and lengths ω² = (g/l)(2 ± √2)); then λ is about zero and the twins stay together. Energy is conserved by the physics, so the energy-error graph is a test of the numerical method, not of the system.

Honest simplifications: frictionless pivots unless damping is switched on (damping drains energy and tames the chaos), rigid massless rods, no air, fixed time step, and floating-point rounding that itself acts as a tiny perturbation: after a long time even the 'identical' runs of a computer would eventually part.

What to try
  • Start from the Small swing preset: the twins stay together, because small oscillations are regular.
  • Use Horizontal release and watch the separation graph climb as a straight line on the log scale.
  • Change the initial difference from 10-6 to 10-10 rad and note that divergence is only delayed.
  • Add damping and see the chaos die out.
Separation of the twins in angle space, log scale (slope = Lyapunov exponent)
Relative energy error of the integrator, log scale
Phase portrait of the upper arm: angle against angular velocity