Hamiltonian systems are a very important class of dynamical systems. The Simple Pendulum is a well-known example. In general, the motion of Hamiltonian systems is very complex, but seems to fall into three classes: integrable, chaotic, and mixed. The double pendulum is an example of a dynamical system that can exhibit chaotic behavior. This system consists of two point masses $m_1$ and $m_2$, suspended by rigid weightless rods of lengths $L_1$ and $L_2$, respectively. (An analytical treatment of this problem is given here.) Because there is no friction, this system is clearly an example of a Hamiltonian system.

This program solves the coupled equations of motion of a double pendulum to simulate chaos for large amplitude oscillations.

$\displaystyle{ \ddot{\theta_1} = \frac{-g (2 m_1 + m_2) \sin \theta_1 - m_2 g \sin (\theta_1 - 2 \theta_2) - 2 \sin (\theta_1 - \theta_2) m_2 \left[ \dot{\theta}_2^2 L_2 + \dot{\theta}_1^2 L_1 \cos (\theta_1 - \theta_2) \right] }{L_1 \left[ 2 m_1 + m_2 - m_2 \cos (2 \theta_1 - 2 \theta_2) \right] } }$

$\displaystyle{ \ddot{\theta_2} = \frac{2 \sin (\theta_1 - \theta_2) \left[ \dot{\theta}_1^2 L_1 (m_1 + m_2) + g (m_1 + m_2) \cos \theta_1 + \dot{\theta}_2^2 L_2 m_2 \cos(\theta_1 - \theta_2) \right] }{L_2 \left[ 2 m_1 + m_2 - m_2 \cos (2 \theta_1 - 2 \theta_2) \right] } }$