Double Pendulum ActionSript

I do not exactly remember that how I came across the term Double Pendulum but I can recall that the following figure inspired me to create a simulation program for it. It was my first attempt on a pure physics problem by solving a set of ordinary differential equation using Runge Kutta Method . I used ActionScript to program this.



Recorded GIF

Here is the pre-recorded animated gif of the application. You can play with different motion preset or can adjust manually.



Flash Application

Click on Play button (green one) to start the motion of the pendulum. Few motion presets are there, but you can adjust them manually using the sliders located below.




What is a Double Pendulum?

The double pendulum consists of two point masses \(m_1\) and \(m_2\) at the end of two massless rods of length \(l_1\) and \(l_2\). Each mass plus rod is a regular simple pendulum but the two pendula are joined together and the system is free to oscillate in a plane. Double pendulum system is very sensitive to initial angles \(\theta_1\) and \(\theta_2\) which may cause very different results due to a deviation of 0.0001\(^\circ\) when swings starts.

At most of the initial conditoins, the child pendulum traces a chaotic path but for some special initial conditions, it can results many regular shapes like simple pendulum, four petals, flower, star or hourglass.

Key Ideas to Program

The ultimate goal of the program is to find the exact position of the parent and child bob at a specific time \(t\). To do this, we need to define a coordiate system first. If the center of parent bob is considered as the origin, then the locations of the bobs are,

\begin{align} x_1 &= l_1 \sin{\theta_1} \\ y_1 &= l_1 \cos{\theta_1} \\ x_2 &= x_1 + l_2 \sin{\theta_2} \\ y_2 &= y_1 + l_2 \cos{\theta_2} \end{align}

Since \(l_1\) and \(l_2\) are known, we need to find the values of angle \( \theta_1\) and \( \theta_2\) at that specific time \(t\) to find the position of the bobs.

Now, let \( \omega_1\) and \( \omega_2 \) are angular velocities at time \(t\), of parent and child bob respectively. Then,

\begin{align} \frac{d\theta_1}{dt} &= \omega_1 \\ \frac{d\theta_2}{dt} &= \omega_2 \end{align}

Let, \(\Delta = \theta_2 - \theta_1 \) and by some further analysis, we find,

\begin{align} \frac{d\omega_1}{dt} &= \frac{ m_2 l_1 \omega_1^2 \sin\Delta \cos\Delta + m_2 g \sin \theta_2 \cos\Delta + m_2 l_2 \omega_2^2 \sin\Delta - (m_1+m_2) g \sin \theta_1 } { (m_1+m_2) l_1 - m_2 l_1 \cos^2 \Delta } \\ \frac{d\omega_2}{dt} &= \frac{ - m_2 l_2 \omega_2^2 \sin\Delta \cos\Delta + (m_1 + m_2 ) ( g \sin \theta_1 \cos\Delta - l_1 \omega_1^2 \sin \Delta - g \sin \theta_2 ) } { (m_1+m_2) l_2 - m_2 l_2 \cos^2 \Delta } \end{align}

Now, the last two equations of \( \omega_1 \) and \(\omega_2 \) are first order differential equations. We need to solve them simultaneously for that specific time \(t \). If \(\omega_1\) and \(\omega_2\) can be calculated, then from other two differential equations the value of \(\theta_1\) and \(\theta_2\) can be found which can ultimately be used to calculate \( x_1, x_2, y_1, y_2 \) i.e. our ultimate goal.

Since differential equations are not easy to solve algebrically, numeric approximation is required here. To solve all the differential equations, Fourth Order Runge-Kutta Method (RK4) was adopted. For this, initial boundary conditions of \(\theta_1 , \theta_2 , \omega_1 , \omega_2 \) must be known at time \( t = t_0 \), only then, the actual value of \( \theta_1 , \theta_2 , \omega_1 , \omega_2 \) at time \(t = t_0 + dt \) can be calculated by RK4 method.

External Links

1. Double Pendulum at ScienceWorld by Wolfram Research.
2. Double Pendulum at MyPhysicsLab.
3. The Double Pendulum at School of Physics, University of Sydney.