To check out Double pendulum demonstration, please visit this link.
A double pendulum system is considered a chaotic dynamic system. It is very sensitive to initial conditions. Slightly different initial position and velocity result in a drastically divergent pattern.
A double pendulum system consists two point masses:
To find the equation of motion for this system, we will use Lagrangian mechanics.
$L = T_{total} - V_{total}$
where $T_{total}$ is the total kinetic energy of the system, and $V_{total}$ is the total potential energy of the system.
Total kinetic energy is simply equal to:
$T_{total} = T_1 + T_2$
$T_{total} = \frac{1}{2}m_1v_1^2 + \frac{1}{2}m_2v_2^2$
$T_{total} = \frac{1}{2}m_1(\dot{x}_1^2+\dot{y}_1^2) + \frac{1}{2}m_2(\dot{x}_2^2+\dot{y}_2^2)$
And total potential energy (gravitational potential energy) is:
$V_{total} = V_1 + V_2$
$V_{total} = m_1gy_1 + m_2gy_2$
NOTE: I take upwards as the positive y-direction. My y-coordinates will be negative as the origin is at the fixed point.
Now I have to rewrite those energy terms in terms of generalized coordinates. In total, there are:
We will choose $\theta_1$ and $\theta_2$ (as shown in the diagram) as our generalized coordinates. The next step will be to convert the Cartesian coordinates to the genearlized coordinates.
The equation to convert our Cartesian coordinates to the generalized coordinates are:
$x_1 = l_1 \sin\theta_1$
$y_1 = -l_1 \cos\theta_1$
$x_2 = l_1 \sin\theta_1 + l_2 \sin\theta_2$
$y_2 = -l_1 \cos\theta_1 - l_2 \cos\theta_2$
NOTE: We have a minus sign for the y-coordinates because our y-coordinates have negative values.
Now we need to differentiate with respect to time the above expressions to obtain the generalized velocities:
$\dot{x}_1 = l_1 \dot{\theta_1} \cos\theta_1$
$\dot{y_1} = l_1 \dot{\theta_1} \sin\theta_1$
$\dot{x_2} = l_1 \dot{\theta_1} \cos\theta_1 + l_2 \dot{\theta_2} \cos\theta_2$
$\dot{y_1} = l_1 \dot{\theta_1} \sin\theta_1 + l_2 \dot{\theta_2} \sin\theta_2$
We now substitute these back into our expressions for total kinetic energy and total potential energy:
$T_{total} = \bigg( \frac{1}{2}m_1l_1^2\dot{\theta}_1^2 \bigg) + \bigg( \frac{1}{2}m_2l_1^2\dot{\theta}_1^2 + \frac{1}{2}m_2l_2^2\dot{\theta}_2^2 + m_2l_1l_2\dot{\theta}_1\dot{\theta}_2\cos\theta_1\cos\theta_2 + m_2l_1l_2\dot{\theta}_1\dot{\theta}_2\sin\theta_1\sin\theta_2 \bigg)$
$T_{total} = m_1l_1^2\dot{\theta}_1^2 + \frac{1}{2}m_2l_2^2\dot{\theta}_2^2 + m_2l_1l_2\dot{\theta}_1\dot{\theta}_2 \big( \cos\theta_1\cos\theta_2 + \sin\theta_1\sin\theta_2 \big)$
$T_{total} = m_1l_1^2\dot{\theta}_1^2 + \frac{1}{2}m_2l_2^2\dot{\theta}_2^2 + m_2l_1l_2\dot{\theta}_1\dot{\theta}_2 \cos(\theta_1-\theta_2)$
$V_{total} = m_1g(-l_1\cos\theta_1) + m_2g(-l_1\cos\theta_1-l_2\cos\theta_2)$
$V_{total} = -(m_1+m_2)gl_1\cos\theta_1 - m_2gl_2\cos\theta_2$
Our Lagrangian will be:
$L = T_{total} - V_{total}$
$L = m_1l_1^2\dot{\theta}_1^2 + \frac{1}{2}m_2l_2^2\dot{\theta}_2^2 + m_2l_1l_2\dot{\theta}_1\dot{\theta}_2 \cos(\theta_1-\theta_2) + (m_1+m_2)gl_1\cos\theta_1 + m_2gl_2\cos\theta_2$
The Lagrange's equations are:
$\frac{d}{dt} \frac{\partial L}{\partial\dot{\theta}_1} = \frac{\partial L}{\partial\theta_1}$
$\frac{d}{dt} \frac{\partial L}{\partial\dot{\theta}_2} = \frac{\partial L}{\partial\theta_2}$
The rest is just muscle work:
$\frac{\partial L}{\partial\theta_1} = - m_2l_1l_2\dot{\theta}_1\dot{\theta}_2 \sin(\theta_1-\theta_2) - (m_1+m_2)gl_1\sin\theta_1$
$\frac{\partial L}{\partial\dot{\theta}_1} = 2m_1l_1^2\dot{\theta}_1 + m_2l_1l_2\dot{\theta}_2 \cos(\theta_1-\theta_2)$
$\frac{d}{dt} \frac{\partial L}{\partial\dot{\theta}_1} = 2m_1l_1^2\ddot{\theta}_1 + m_2l_1l_2\ddot{\theta}_2 \cos(\theta_1-\theta_2) - m_2l_1l_2\dot{\theta}_2(\dot{\theta}_1-\dot{\theta}_2)\sin(\theta_1-\theta_2)$
Now we get our first equation of motion:
$\frac{d}{dt} \frac{\partial L}{\partial\dot{\theta}_1} = \frac{\partial L}{\partial\theta_1}$
$2m_1l_1^2\ddot{\theta}_1 + m_2l_1l_2\ddot{\theta}_2 \cos(\theta_1-\theta_2) + m_2l_1l_2\dot{\theta}_2^2\sin(\theta_1-\theta_2) = -(m_1+m_2)gl_1\sin\theta_1$
We can divide both sides of the equation by $l_1l_2$ to make it simpler:
$2m_1\frac{l_1}{l_2}\ddot{\theta}_1 + m_2 \cos(\theta_1-\theta_2) \ddot{\theta}_2 = - m_2\dot{\theta}_2^2\sin(\theta_1-\theta_2) - (m_1+m_2)\frac{g}{l_2}\sin\theta_1$
Similarly, we can obtain our second equation of motion:
$m_2\frac{l_2}{l_1}\ddot{\theta}_2 + m_2 \cos(\theta_1-\theta_2) \ddot{\theta}_1 = m_2\dot{\theta}_1^2\sin(\theta_1-\theta_2) - m_2\frac{g}{l_1}\sin\theta_2$
Treating this as a system of equations for $\ddot{\theta}_1$ and $\ddot{\theta}_2$, we can solve for $\ddot{\theta}_1$ and $\ddot{\theta}_2$.
And that, we are done!
The above solution sure looks ugly! To gain insights into the dynamics of a double pendulum system, let us consider the special case where two masses have the same value for mass and length.
$2\ddot{\theta}_1 + \cos(\theta_1-\theta_2) \ddot{\theta}_2 = - \dot{\theta}_2^2\sin(\theta_1-\theta_2) - 2\frac{g}{l}\sin\theta_1$
$\cos(\theta_1-\theta_2)\ddot{\theta}_2 + \cos^2(\theta_1-\theta_2) \ddot{\theta}_1 = \cos(\theta_1-\theta_2)\dot{\theta}_1^2\sin(\theta_1-\theta_2) - \cos(\theta_1-\theta_2)\frac{g}{l}\sin\theta_2$
$\big[2-\cos^2(\theta_1-\theta_2)\big]\ddot{\theta}_1 = -\sin(\theta_1-\theta_2)\big[\dot{\theta}_2^2+\cos(\theta_1-\theta_2)\dot{\theta}_1^2\big] + \frac{g}{l}\big[\cos(\theta_1-\theta_2)\sin\theta_2 - 2\sin\theta_1\big]$
$\ddot{\theta}_1 = \frac{-\sin(\theta_1-\theta_2)\big[\dot{\theta}_2^2+\cos(\theta_1-\theta_2)\dot{\theta}_1^2\big] + \frac{g}{l}\big[\cos(\theta_1-\theta_2)\sin\theta_2 - 2\sin\theta_1\big]}{2-\cos^2(\theta_1-\theta_2)}