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 x-axis represents a horizontal ceiling and the origin is the point where the top of the pendulum is attached. The y-axis 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 two-object 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 two-object 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, second-order, 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 re-run 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.