Double Pendulum

This webpage implements a simple, frictionless double pendulum solver using Runge-Kutta integration. According to Wikipedia:

"In physics and mathematics, in the
area of dynamical systems, a double
pendulum is a pendulum with another
pendulum attached to its end, and
is a simple physical system that
exhibits rich dynamic behavior with
a strong sensitivity to initial
conditions. The motion of a double
pendulum is governed by a set of
coupled ordinary differential
equations and is chaotic."

In other words, the double pendulum is two rigid rods attached by bearings. The combination of the two points of freedom make the system extremely variable and small changes in starting positions, velocities, and mass can result in wildly different pendulum trajectories.

This makes the double pendulum a surprisingly enjoyable device to sit and watch, and has lead to numerous DIY projects for building your own. However, not everyone can afford the luxury of a real double pendulum desk toy, so I made this simple page to allow people to check it out for themselves and observe how changing initial conditions leads to very different paths and behaviors.

The solver computes the next position and velocity of the pendulum based on its current position and velocity. This is what is called an ordinary differential equation, where the second derivative of the angle (ie. the angular acceleration) is based on both the current velocity (first derivative of position) and the current position. Multiple methods exist to solve differential equations, but the one used here is called the Runge-Kutta RK4 method. This method uses four different approximations of these derivatives and averages them to find its solution. This means the RK4 method is 4th-order, and is adequately close to an exact solution for our uses.

Try messing around with the sliders to see how that changes the behavior of the pendulum.