# Double Pendulum Simulator

##### A flash application to simulate the dynamic behaviour of a double pendulum system

Double Pendulum Simulator is created with Adobe Flash and ActionScript 3.0 language to simulate the dynamic behaviour of the system. This application can trace the path of child pendulum. Various presets are available with predefined initial conditions though they can be adjusted manually.

### What is Double Pendulum

Skip this section if you are already familiar with Double Pendulum System

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.

#### Real Double Pendulum

### The Simulator

Several preset are provided with the application though every parameter can be manually adjusted. Please, let me know if you find any interesting combination of them. I suggest to keep refresh time 20 seconds otherwise the computation slows down the system. Note that, the clock in the application may not identical to real time.

### Screenshot

Screenshot of star shaped motion traced for 19.17 seconds. Various insets show different results that can be achieved.

### Download Executable Version

An executable (.exe) version for windows platform can be downloaded, so that you can run this application at offline. You do not need flash player installed on your system to run this executable file.

Download executable version of Double Pendulum Simulator for offline play

Here is it's screenshot on windows platform.

### Behind the Scene

Explaining the physics of the system and key ideas to program it

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

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