Double pendulum: divergence from nearby initial states
Open the double pendulum. Two pendulums overlap, drawn with solid and dashed rods. Their initial upper angles differ by only radians. Let them run, then pause to compare their endpoint trails: nearby starting states can produce visibly different paths.
Controls
Changing the initial-angle slider restarts the experiment. Drag a bob to change the configuration; this clears angular velocities and trails and creates two new states separated by radians. Pause and use Step to inspect successive updates.
With the canvas focused, move the square cursor with the arrow keys and press Enter or Space to set an angle at that position. Reset restores the default upper angle of ; the lower angle starts radians beyond it.
Model and integration
The equations follow the myPhysicsLab double-pendulum derivation. This implementation uses equal point masses, rigid massless rods of unit length, and gravity . The state contains two angles measured from downward vertical and their angular velocities.
The pure model module advances the state with fourth-order Runge–Kutta (RK4), using an internal step of . Each simulation update performs four substeps, advancing model time units. Both states use the same algorithm; their difference comes from the initial conditions, not random noise.
Reading the trails
Canvas 2D draws the rods, bobs and latest 700 endpoint positions. Old trail points disappear because history is bounded. Changing the initial state clears that history so separate experiments do not share a trail.
Energy should remain constant in this undamped model. An energy function lets the tests check integration drift, but numerical error remains, so long trajectories are not exact predictions. Nearby states need not separate immediately: the initial configuration and elapsed time matter. Compare this with the Rössler attractor, another continuous dynamical system.