This is an implementation of the double pendulum example given in Leonard Susskind’s lecture on classical mechanics. The goal of this post is to explain the derivation and implementation of the equations of motion for coupled pendulums.
I’ll start with the drawing given in Professor Susskind’s lecture with one exception. The angle $\alpha$ will be called $\theta_2$ and it will be the angle with respect to the rod securing the apparatus (same relationship as $\theta_1$) rather than the angle with respect to $\theta_1$.
Using the image above and some basic trigonometry we can derive the following equations for the $x$, $y$ positions of the pendulums:
Note: In this inertial reference frame the positive y direction is down.
Differentiating with respect to time we get:
Our Lagrangian is of the form $T-V$ where $T$ is the kinetic energy and $V$ is the potential energy.
Let’s calculate the kinetic energy $T$:
And now the potential energy $V$:
Now we can compute our Lagrangian $\mathcal{L}$:
Time to get the terms for the Euler-Lagrange equation for the coordinate $\theta_1$:
And now the terms for the Euler-Lagrange equation for the coordinate $\theta_2$:
Solving for $\ddot \theta_1$ and $\ddot \theta_2$ we get:
Note: I didn’t do some crazy mental variable substitutions/arithmetic. I got these expressions using sympy:
solution
Now that we have coupled differential equations we can solve for motion. We will need to solve numerically and by reframing this system of second order ODEs as four first order differential equations we will be able to do so: