Chaos Pendulum
A double pendulum is two arms joined end to end. Started from a small angle it swings in a fairly regular way, but launched from a large one it moves in a way that is hard to predict. This simulator lets you set the starting angles, arm lengths and gravity, then drops the pendulum and traces the path of the outer bob as a color-cycling trail. The result is part physics demo, part generative art, and you can save the canvas as a PNG.
How to play
- Set Initial Angle 1 and Initial Angle 2 (0 to 360 degrees, measured from hanging straight down). Moving them while stopped repositions the arms.
- Adjust Length 1 and Length 2 (50 to 200 px), Trail Length (100 to 5000 points) and Gravity (0.5x to 2x).
- Press Start. The stats panel shows elapsed time, an Energy value that counts only how high the bobs are (not how fast they move), a Speed figure built from the two angular velocities, and the number of trail points.
- Press Reset to return to the angle sliders' values, Clear Trail to wipe the drawing while it keeps swinging, or Save Art to download the canvas as a PNG.
- Change one angle by a single degree, reset and start again to see how a tiny difference grows into a different path.
Why it behaves chaotically, and how literal this is
A single pendulum is regular, but adding a second arm makes the motion depend sensitively on where it starts, at least once there is enough energy for the arms to whip around. Two runs that begin one degree apart can follow similar paths for a while and then diverge completely. That sensitivity is what chaos means here, and it is why long-term prediction fails even though the equations are fully deterministic. Try 10 and 10 degrees against 120 and 180 to see both regimes.
The simulation uses the standard equations of motion for two equal point masses on weightless rigid arms. It advances them with a semi-implicit Euler step (update the velocity, then the angle) at a fixed step size, about 600 steps per second of real time. Every step also multiplies both angular velocities by 0.9999, which compounds to roughly a 6 percent loss per second, so the swing visibly winds down over a minute or two. This keeps the animation lively, but it is not a precision solver, and the stats are in arbitrary units, not joules.
Treat it as a visual explorer rather than a measurement tool, and do not compare its numbers to a textbook solution. The elapsed time is wall-clock time, not simulated time. Changing the angle sliders while it runs does nothing until you press Reset, while length and gravity changes apply mid-swing. Resizing the window clears the trail, and switching tabs pauses the run until you press Start again.