+
Double Pendulum
Developed by Derrick Hylton  Published July 24, 2020
This Exercise Set allows the student to apply the Lagrangian formalism to develop, solve, and make predictions about the double pendulum. This should be useful to students who learn this formalism but has not yet seen its value as compared to Newtonian formalism. Lagrange's equations of motion lead to coupled differential equations for the two angles as functions of time.
Students will use the modified Euler's method to solve these equations and plot the solutions. They will check the convergence to determine a threefigure accuracy. In addition, students will use their own Fourier transform program (as opposed to a given Fast Fourier transform package) to analyze the solution to determine the frequencies of the motion. As a result, the frequencies can be analyzed to see how they qualitatively depend on the masses and lengths of strings.
Subject Area  Mechanics 

Level  Advanced 
Available Implementation  IPython/Jupyter Notebook 
Learning Objectives 
1. Derive the equations of motion for a double pendulum using the Lagrangian formalism. Evaluate the Lagrangian approach in comparison to a Newtonian approach. (Exercises 1, 6)
2. Create a plan to numerically solve the coupled differential equations for the double pendulum using Euler’s or modified Euler’s method. (Exercise 2)
3. Write a code to implement the plan or verify that a given code is consistent with the created plan. (Exercise 3)
4. Create a plan to analyze the numerical solution using the Fourier transform to extract the frequencies of oscillations. Write or verify a python code to determine the frequency or frequencies of the motion. (Exercise 4)
5. Apply the code to make predictions about the double pendulum, such as how the frequency of oscillations depends on the masses and lengths. (Exercise 5)

Time to Complete  240 min 
These exercises are not tied to a specific programming language. Example implementations are provided under the Code tab, but the Exercises can be implemented in whatever platform you wish to use (e.g., Excel, Python, MATLAB, etc.).
**Exercise 1**
Consider the system of a double pendulum as shown in the Figure below. The xaxis represents a horizontal ceiling and the origin is the point where the top of the pendulum is attached. The yaxis is vertical. The objects oscillate, so that the coordinates $x_1$, $x_2$, $y_1$, $y_2$, and $\theta_1$, $\theta_2$ vary with time. The lengths of string are labeled $l_1$ and $l_2$.
![](images/dpend/dpend1.png "")
a) Assuming that the objects move in the $xy$plane, explain why only two generalized coordinates are necessary in the Lagrangian formalism.
b) Choose the two generalized coordinates to be the two angles shown in the Figure. Derive an expression for the kinetic energy of the twoobject system in terms of these generalized coordinates. Use the gravitational potential energy near the surface of the Earth.
c) Derive an expression for the gravitational potential energy of the twoobject system in terms of the generalized coordinates of part (b). For convenience, choose the ceiling as the zero of gravitational potential energy.
d). Construct the Lagrangian of the system, and derive the two equations of motion, one for each generalized coordinate. (Do not simplify yet or solve for any quantities, but go ahead and cancel terms to clean up your expressions.)
**Exercise 2**
Consider a single, secondorder, differential equation of the form
$$
\ddot{x}=f(x,\dot{x},t)\;\;,\nonumber
$$
where $f(x,\dot{x},t)$ is a known function. A numerical plan to solve this equation is to define a new quantity $w=\dot{x}$. This leads to two equations
$$
\begin{aligned}
\dot{w}&=f(x,w,t)\\
\dot{x}&=w\;\;.
\end{aligned}
$$
This can be solved by choosing a time step $\Delta t$, and the solution can be determined by iteratively solving (Euler’s method)
$$
\begin{aligned}
w(t_2 )&=w(t_1 )+f(x(t_1 ),w(t_1 ),t_1 ) \Delta t\\
x(t_2 )&=x(t_1 )+w(t_1 ) \Delta t\;\;.
\end{aligned}
$$
Since both $w(t_2 )$ and $w(t_1 )$ are known when the second equation above is computed, the average of these two quantities may be used instead of $w(t_1 )$ in the second equation (modified Euler’s method).
Using the above technique, create a plan to solve the equations of motion for the double pendulum. You will need to manipulate the equations of motion from Exercise 1 algebraically to put them in the form amenable to the above technique.
**Exercise 3**
Consider the double pendulum with initial conditions: $\theta_1 (0)=0$ , $\theta_2 (0)=30^0=\pi/6$ , and $\dot{\theta}_1(0)=\dot{\theta}_2 (0)=0$. Also consider masses and lengths: $m_1=m_2=0.50\;{\rm kg} , l_1=l_2=0.25\;{\rm m}$.
(a) Write or verify a code to numerically solve the equations of motion from 0 to 5 sec. Use Euler’s method or modified Euler’s method. Run the code and check for convergence to at least two figures. Convergence to at least two figures mean that when a much smaller time step is used, the solution remains the same for at least two figures.
(b) Graph the solutions and discuss the periodicity of the solution, such as whether it is simple harmonic or not.
**Exercise 4**
Analyze the numerical solution to extract the frequency or frequencies of the motion using the Fourier transform. Write (or plan or verify a given) code to determine the Fourier transform according to the following:
a) The Fourier transform, $g(\omega)$, of a function $f(t)$ is given by
$$
g(\omega)=\frac{1}{\sqrt{2\pi}}\int_{\infty}^{\infty}f(t) e^{i\omega t} dt\nonumber
$$
It is directly related to the coefficient of the expansion of the function, $f(t)$, in terms of trigonometric functions of angular frequencies, $\omega$. Thus, the greater the modulus of $g(\omega)$, the greater the contribution for that angular frequency.
b) Numerically, the Fourier transform can be approximated using a series for the integral. We assume that we know $f(t)$ for a set of values $t=t_1,t_2,\cdots,t_N$, each separated by $\Delta t$. Then,
$$
g(\omega)\approx\frac{1}{\sqrt{2\pi}}\left[ \sum_{j=1}^N f(t_j) e^{i\omega t_j}\right]\Delta t\;\;.
$$
Write, plan, or verify a code to calculate the expression within the square brackets to represent the Fourier transform, as a function of $\omega$.
c) Using a numerical graphing routine, graph the modulus of the Fourier transform as a function of frequency, $\nu$ , where $\omega=2\pi\nu$. Create a set of $t$’s for a function such as $f(t)=\sin 40\pi t+0.5 \sin 80 \pi t$ to test the program. The graph of $g(\omega)$ vs. $\nu$ should have peaks at $\nu=20$ and $40$. Note that for a complex number $z=a+bi$, the modulus, denoted $z$, is a real number similar to the magnitude of a vector with scalar components $a$ and $b$. Thus, $z=\sqrt{a^2+b^2}$. In programming languages, such as python, that includes complex numbers as a data type, the modulus is a callable function in packages such as numpy. Use np.abs(z).
d) Analyze the results of the numerical solution for the angles of the double pendulum to determine the frequencies.
**Exercise 5**
a) Predict how the frequencies of the double pendulum qualitatively change with masses and lengths of strings, and state your reasons. You may think about a simple pendulum and how its frequency of oscillation depends on the mass of the object and length of the spring.
b) Using your Fourier transform program, test your predictions. Compare to the frequency for a simple pendulum. To test your predictions, you need to change the masses and lengths (only one at a time) and rerun the entire code.
**Exercise 6**.
Try solving for the double pendulum’s equation(s) of motion by using Newton’s formalism instead of Lagrange’s. Is this simpler or more difficult? What are some key differences between the ideologies of these two formalisms? It is not necessary to get the final solution using the Newtonian approach, Work it as far as you can to get an idea of how the two methods compare.
Download Options
Share a Variation
Did you have to edit this material to fit your needs? Share your changes by
Creating a Variation
Credits and Licensing
Derrick Hylton, "Double Pendulum," Published in the PICUP Collection, July 2020.
The instructor materials are ©2020 Derrick Hylton.
The exercises are released under a Creative Commons AttributionNonCommercialShareAlike 4.0 license