Presets
Playback
Masses and gravity
Rod lengths and masses change the energy scale and the chaos threshold.
Start state and butterfly size
Pendulum number k starts k x 10^-n rad further round than number 0 (white).
Numerics
Try Euler to see why the integrator matters.
Layers
Model checks
The science
Equations
Two point masses m1, m2 hang from rigid massless rods l1, l2; angles are measured from the downward vertical. The Lagrangian is L = T - V with
T = 1/2 (m1+m2) l1^2 w1^2 + 1/2 m2 l2^2 w2^2 + m2 l1 l2 w1 w2 cos(th1 - th2) and V = -(m1+m2) g l1 cos th1 - m2 g l2 cos th2. The Euler-Lagrange equations are integrated with fourth-order Runge-Kutta in steps of 1/480 s.
The butterfly effect
The fan holds up to 60 pendulums whose upper angles differ by 10^-n rad. For a chaotic orbit two nearby states separate as d(t) = d0 e^(lambda t) until they reach the size of the whole phase space. The graph shows log10 d: a straight rising line has slope lambda / ln 10.
Lyapunov exponent (Benettin method)
A shadow trajectory is kept at distance d0 = 1e-7 from the real one; every 0.05 s the log growth ln(d / d0) is added to a running sum and the shadow is pulled back to distance d0. The exponent is the sum divided by the elapsed time. It converges slowly (tens of seconds) and depends on the starting state: near the bottom it tends to zero (regular motion).
Poincare section
Each time the upper rod passes the vertical going the same way (theta1 = 0, omega1 > 0) the point (theta2, omega2) is plotted. Regular, quasi-periodic motion fills closed curves; chaos scatters the points over an area. This is only a slice through a four-dimensional phase space.
Energy check
The system is frictionless, so E = T + V must stay constant. Its drift is the honest measure of numerical error: RK4 keeps it near 1e-8 to 1e-6, explicit Euler gains energy steadily (try the Euler preset).
Simplifications
Point masses, perfectly rigid massless rods, no friction or air drag, planar motion. A real double pendulum has finite-size arms, joint friction and slop, which limit how long its motion can be predicted even more severely than the numerical error here.
What to try
- Chaotic fan: all pendulums start within 2.4e-5 rad. Watch the fan stay together for a few seconds, then explode.
- Increase n to 12: the fan starts 1e-12 rad apart yet still opens up after roughly twice as long, because the growth is exponential. The time scale is ln(10) n / lambda.
- Near linear preset: the same tiny differences never grow and the Lyapunov estimate falls toward zero. Chaos needs energy.
- Euler preset: the energy graph climbs, the pendulum gains energy from the algorithm alone.
- Look at the Poincare graph: for small amplitudes it is a closed curve, for the chaotic fan it is a cloud.