Double pendulum

step 0
Loading the engineShared by all simulations, so the next one opens instantly.
λ₁ (Lyapunov)·
The physics

Hang a second pendulum from the bob of the first and you have one of the simplest mechanical systems that is chaotic. At small amplitudes it behaves like two coupled oscillators and can be solved on paper. At large amplitudes the lower arm starts to flip over the top, and two runs that begin a fraction of a degree apart soon look nothing alike.

What you see

Two rods with point masses at their ends swing from a fixed pivot, and the lower bob leaves a fading trail. With Number of pendula above 1, several copies start together, each with its upper angle shifted by a further ε, drawn in the colors of the chosen Color theme. For a while they move as one, then they fan out. The λ₁ (Lyapunov) readout estimates the largest Lyapunov exponent with Benettin’s method: a positive value means nearby trajectories separate exponentially. It takes about 10 seconds to settle.

chaotic (large angle): the rods start at rest at 120° and −70° from the vertical. The lower rod soon makes full turns, and the motion never repeats.

small-angle (linear): both rods start at 10°. The motion stays close to a sum of the two normal modes and remains regular.

in-phase normal mode: the upper rod starts at 8° and the lower at about 11.3°, √2 times as far, both to the same side. For equal masses and lengths the slow normal mode has both rods swinging together at ω−=(2−2)g/l.

out-of-phase normal mode: the upper rod starts at 5° and the lower at about 7.1° to the other side. The fast mode, with the rods bending against each other, has ω+=(2+2)g/l.

Governing equation

With both angles measured from the vertical and Δ=θ1−θ2, Lagrange’s equations for two point masses give

θ¨1=−g(2m1+m2)sin⁡θ1−m2gsin⁡(θ1−2θ2)−2m2sin⁡Δ(l2θ˙22+l1θ˙12cos⁡Δ)2l1(m1+m2sin2⁡Δ),
θ¨2=sin⁡Δ[(m1+m2)(l1θ˙12+gcos⁡θ1)+m2l2θ˙22cos⁡Δ]l2(m1+m2sin2⁡Δ).

The simulation adds a damping term −γθ˙i to each and, if switched on, a periodic drive Acos⁡(ωt) on the upper arm. It integrates the four first-order equations for (θ1,θ2,θ˙1,θ˙2) with fourth-order Runge-Kutta by default, in four substeps per step.

Parameters

Mass m₁ (kg), Mass m₂ (kg): the upper and lower bob, 0.1 to 5 kg. Unequal masses shift the normal-mode frequencies.

Length l₁ (m), Length l₂ (m): the rod lengths, 0.1 to 3 m. The frequencies scale as g/l.

Gravity g (m/s²): gravitational acceleration, 0.1 to 25.

Damping γ (s⁻¹): linear damping of both angular velocities.

drive amp, drive freq: amplitude A and angular frequency ω of the driving torque. An amplitude of 0 turns it off.

Number of pendula, Initial separation ε: up to 20 pendula, the i-th starting with its upper angle raised by iε, with ε between 10−6 and 0.1 rad. The smaller ε, the longer the copies stay together before the exponential growth shows.