Chaotic Pendulums

This page is an archive of blocks that used to be hosted on bl.ocks.org, which appears to have silently shut down in late 2022.

Double Pendulums

This is the one that started it all. I saw a wonderful gif on reddit of 41 triple pendulums with very slightly different initial conditions. Gifs are nice, but interactive animations are better. So I took a crack at modeling a double pendulum, because, frankly, the equations for triple pendulums are less-than-pleasant.

Click on the canvas to restart the simulation from a different position

For this system, I used the Hamiltonion formulation, and coded a 4-th order Runge-Kutta solver. What I love about this visualization is that the impact of seeing all of the different pendulums explode into chaos is fundamentally linked to what makes this mathematically chaotic—specifically, that chaotic systems have "sensitive dependence to intial conditions". Put simply, that means that no matter how close you start out, even the slightest difference will eventually lead to drastically different outcomes.

Triple Pendulums

Because the gif that inspired me to start this was a triple pendulum, I kept coming back to the double pendulum I had created and tried to get it working for a triple pendulum. Repeatedly, I would fight with the mess of equations, attempt to code them up, and create some horribly glitchy mess because of a misplaced parentheses. I came across this blog post by Diego Assencio, which was very helpful.

Press play to start the simulation. Click on the canvas to restart the simulation from a different position

n-Tuple Pendulums

Funnily enough, the breakthrough that helped me figure out the triple pendulum case was to give up on trying to figure out the specific triple pendulum case, and instead tackle the general n-tuple pendulum case, and then just set n equal to 3. Inspired by Diego's blog post, I created my own explainer for the n-tuple pendulum simulator.

Press play to start the simulation. Click on the canvas to restart the simulation from a different position