A double pendulum consists of two connected pendulums, rotating under the force of gravity. The pendulum below is a compound double pendulumn, meaning the mass is distributed along the length of the arms (here uniformly) rather than concentrated at a single point.
Iterating a compound double pendulum is a simple matter of stepping the governing ordinary differential equation (ODE) in time. Wikipedia has a nice summary.
Sam Maksimovich recently created a lovely video in which he simultaneously plots all possible double pendulums starting with zero velocity, using color to illustrate their trajectories. The explanation is far better than anything you’ll find here. You should watch it!
At the end he mentions it took six hours to render the video. I’m confident I would not be able to create a lovelier or more effective explanation video, but the visualization is exactly the sort of thing GPUs do very well, so it seemed like it would be fun to plug this into WebGL and make a quick, interactive visualization of the pendulum. A major shortcoming is that WebGL only does single precision, and chaotic simulations definitely benefit from at least double precision, but maybe we’ll see what we can get away with.
The visualization below uses the regl WebGL library to compute and visualize the angle of the of the first (x-axis) and second (y-axis) arms of all compound double pendulums starting with the specified velocities. This amounts to a two-dimensional slice (just the angular positions) of the four-dimensional phase space (two positions and two velocities).
Adjust the initial velocities and zoom in on regions below and observe…… pretty colors! 🌈