Double Pendulum - Maple Help

The Double Pendulum

Main Concept

In this Math App we explore the motion of the double pendulum in a constant gravitational field. It is a rather simple physical model, but nevertheless has a rich dynamics as it undergoes chaotic motion.

 Fig. 1 Setup of the double pendulum   The double pendulum consists of two single pendula, with one being attached at the end of the other. We consider idealized simple pendula, i.e. all their mass is concentrated at the end point of each cord and they move without any friction. The lengths of the pendula are denoted by $\mathrm{l__1}$ and $\mathrm{l__2}$, their masses by $\mathrm{m__1}$ and $\mathrm{m__2}$, respectively. Furthermore, we measure the displacement of each mass via the two angles $\mathrm{ϑ__1}$ and $\mathrm{ϑ__2}$ as indicated in the plot. The dynamics of the double pendulum can be studied via the Euler-Lagrange equations. We implement and solve these in the next section using Maple procedures. In the subsequent section we discuss some properties of this solution.

Implementation in Maple

Below, we implement the problem of the double pendulum into Maple and solve its dynamics. We start by defining the positions of the masses using the notation in Fig. 1.

 >
 ${{x}}_{{1}}{≔}\mathrm{l__1}{}{\mathrm{sin}}\left(\mathrm{ϑ__1}\right)$
 ${{x}}_{{2}}{≔}\mathrm{l__1}{}{\mathrm{sin}}\left(\mathrm{ϑ__1}\right){+}\mathrm{l__2}{}{\mathrm{sin}}\left(\mathrm{ϑ__2}\right)$
 ${{y}}_{{1}}{≔}{-}\mathrm{l__1}{}{\mathrm{cos}}\left(\mathrm{ϑ__1}\right)$
 ${{y}}_{{2}}{≔}{-}\mathrm{l__1}{}{\mathrm{cos}}\left(\mathrm{ϑ__1}\right){-}\mathrm{l__2}{}{\mathrm{cos}}\left(\mathrm{ϑ__2}\right)$ (1.1)

The $x$- and $y$-coordinates of the two masses depend on the time, $t$ via the time dependence of the angles. Now we can define the kinetic and potential energy as follows:

 >
 >
 $\frac{{{m}}_{{1}}{}\left({\frac{{\partial }}{{\partial }{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left(\mathrm{l__1}{}{\mathrm{sin}}\left(\mathrm{ϑ__1}\right)\right)}^{{2}}{+}{\frac{{\partial }}{{\partial }{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left({-}\mathrm{l__1}{}{\mathrm{cos}}\left(\mathrm{ϑ__1}\right)\right)}^{{2}}\right)}{{2}}$
 $\frac{{{m}}_{{2}}{}\left({\frac{{\partial }}{{\partial }{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left(\mathrm{l__1}{}{\mathrm{sin}}\left(\mathrm{ϑ__1}\right){+}\mathrm{l__2}{}{\mathrm{sin}}\left(\mathrm{ϑ__2}\right)\right)}^{{2}}{+}{\frac{{\partial }}{{\partial }{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\left({-}\mathrm{l__1}{}{\mathrm{cos}}\left(\mathrm{ϑ__1}\right){-}\mathrm{l__2}{}{\mathrm{cos}}\left(\mathrm{ϑ__2}\right)\right)}^{{2}}\right)}{{2}}$ (1.2)
 > $V≔i\to {m}_{i}\cdot g\cdot {y}_{i}:$
 >
 ${-}{{m}}_{{1}}{}{g}{}\mathrm{l__1}{}{\mathrm{cos}}\left(\mathrm{ϑ__1}\right)$
 ${{m}}_{{2}}{}{g}{}\left({-}\mathrm{l__1}{}{\mathrm{cos}}\left(\mathrm{ϑ__1}\right){-}\mathrm{l__2}{}{\mathrm{cos}}\left(\mathrm{ϑ__2}\right)\right)$ (1.3)

Thus the Lagrange function is given via (1.2) and (1.3) as:

 > $\mathrm{Lagrange}≔T\left(1\right)+T\left(2\right)-V\left(1\right)-V\left(2\right):$
 >
 $\mathrm{S__1}{≔}\left[\mathrm{ϑ__1t}{=}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__1}\left({t}\right){,}\mathrm{ϑ__1}{=}\mathrm{ϑ__1}\left({t}\right){,}\mathrm{ϑ__2t}{=}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__2}\left({t}\right){,}\mathrm{ϑ__2}{=}\mathrm{ϑ__2}\left({t}\right)\right]$
 $\mathrm{S__2}{≔}\left[\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__1}\left({t}\right){=}\mathrm{ϑ__1t}{,}\mathrm{ϑ__1}\left({t}\right){=}\mathrm{ϑ__1}{,}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__2}\left({t}\right){=}\mathrm{ϑ__2t}{,}\mathrm{ϑ__2}\left({t}\right){=}\mathrm{ϑ__2}\right]$ (1.4)
 >
 ${L}{≔}{\mathrm{cos}}\left(\mathrm{ϑ__1}{-}\mathrm{ϑ__2}\right){}\mathrm{ϑ__1t}{}\mathrm{ϑ__2t}{}\mathrm{l__1}{}\mathrm{l__2}{}{{m}}_{{2}}{+}\frac{{\mathrm{l__1}}^{{2}}{}\left({{m}}_{{1}}{+}{{m}}_{{2}}\right){}{\mathrm{ϑ__1t}}^{{2}}}{{2}}{+}\frac{{\mathrm{ϑ__2t}}^{{2}}{}{\mathrm{l__2}}^{{2}}{}{{m}}_{{2}}}{{2}}{+}\left(\mathrm{l__1}{}\left({{m}}_{{1}}{+}{{m}}_{{2}}\right){}{\mathrm{cos}}\left(\mathrm{ϑ__1}\right){+}\mathrm{l__2}{}{\mathrm{cos}}\left(\mathrm{ϑ__2}\right){}{{m}}_{{2}}\right){}{g}$ (1.5)

where in the second step we inserted relations (1.1), used trigonometric relations and simplified via combine and simplify. The equations of motion of the two masses can then be obtained via the Euler-Lagrange equations:

for $i=1,2$ as:

 >
 ${-}\left(\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__1}\left({t}\right){-}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__2}\left({t}\right)\right){}{\mathrm{sin}}\left(\mathrm{ϑ__1}\left({t}\right){-}\mathrm{ϑ__2}\left({t}\right)\right){}\left(\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__2}\left({t}\right)\right){}\mathrm{l__1}{}\mathrm{l__2}{}{{m}}_{{2}}{+}{\mathrm{cos}}\left(\mathrm{ϑ__1}\left({t}\right){-}\mathrm{ϑ__2}\left({t}\right)\right){}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{t}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__2}\left({t}\right)\right){}\mathrm{l__1}{}\mathrm{l__2}{}{{m}}_{{2}}{+}{\mathrm{l__1}}^{{2}}{}\left({{m}}_{{1}}{+}{{m}}_{{2}}\right){}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{t}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__1}\left({t}\right)\right){+}{\mathrm{sin}}\left(\mathrm{ϑ__1}\left({t}\right){-}\mathrm{ϑ__2}\left({t}\right)\right){}\left(\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__1}\left({t}\right)\right){}\left(\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__2}\left({t}\right)\right){}\mathrm{l__1}{}\mathrm{l__2}{}{{m}}_{{2}}{+}\mathrm{l__1}{}\left({{m}}_{{1}}{+}{{m}}_{{2}}\right){}{\mathrm{sin}}\left(\mathrm{ϑ__1}\left({t}\right)\right){}{g}$ (1.6)
 > $\mathrm{EL__1}≔\mathrm{simplify}\left(\right)=0$
 $\mathrm{EL__1}{≔}\left(\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{t}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__2}\left({t}\right)\right){}\mathrm{l__2}{}{{m}}_{{2}}{}{\mathrm{cos}}\left(\mathrm{ϑ__1}\left({t}\right){-}\mathrm{ϑ__2}\left({t}\right)\right){+}{\left(\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__2}\left({t}\right)\right)}^{{2}}{}\mathrm{l__2}{}{{m}}_{{2}}{}{\mathrm{sin}}\left(\mathrm{ϑ__1}\left({t}\right){-}\mathrm{ϑ__2}\left({t}\right)\right){+}\left({{m}}_{{1}}{+}{{m}}_{{2}}\right){}\left({g}{}{\mathrm{sin}}\left(\mathrm{ϑ__1}\left({t}\right)\right){+}\mathrm{l__1}{}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{t}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__1}\left({t}\right)\right)\right)\right){}\mathrm{l__1}{=}{0}$ (1.7)
 >
 $\mathrm{l__2}{}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{t}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__1}\left({t}\right)\right){}{\mathrm{cos}}\left(\mathrm{ϑ__1}\left({t}\right){-}\mathrm{ϑ__2}\left({t}\right)\right){}{{m}}_{{2}}{}\mathrm{l__1}{-}\mathrm{l__2}{}\left(\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__1}\left({t}\right)\right){}\left(\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__1}\left({t}\right){-}\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__2}\left({t}\right)\right){}{\mathrm{sin}}\left(\mathrm{ϑ__1}\left({t}\right){-}\mathrm{ϑ__2}\left({t}\right)\right){}{{m}}_{{2}}{}\mathrm{l__1}{+}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{t}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__2}\left({t}\right)\right){}{\mathrm{l__2}}^{{2}}{}{{m}}_{{2}}{-}{\mathrm{sin}}\left(\mathrm{ϑ__1}\left({t}\right){-}\mathrm{ϑ__2}\left({t}\right)\right){}\left(\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__1}\left({t}\right)\right){}\left(\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__2}\left({t}\right)\right){}\mathrm{l__1}{}\mathrm{l__2}{}{{m}}_{{2}}{+}\mathrm{l__2}{}{\mathrm{sin}}\left(\mathrm{ϑ__2}\left({t}\right)\right){}{{m}}_{{2}}{}{g}$ (1.8)
 > $\mathrm{EL__2}≔\mathrm{simplify}\left(\right)=0$
 $\mathrm{EL__2}{≔}\mathrm{l__2}{}{{m}}_{{2}}{}\left({-}{\left(\frac{{ⅆ}}{{ⅆ}{t}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__1}\left({t}\right)\right)}^{{2}}{}\mathrm{l__1}{}{\mathrm{sin}}\left(\mathrm{ϑ__1}\left({t}\right){-}\mathrm{ϑ__2}\left({t}\right)\right){+}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{t}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__1}\left({t}\right)\right){}\mathrm{l__1}{}{\mathrm{cos}}\left(\mathrm{ϑ__1}\left({t}\right){-}\mathrm{ϑ__2}\left({t}\right)\right){+}\left(\frac{{{ⅆ}}^{{2}}}{{ⅆ}{{t}}^{{2}}}\phantom{\rule[-0.0ex]{0.4em}{0.0ex}}\mathrm{ϑ__2}\left({t}\right)\right){}\mathrm{l__2}{+}{\mathrm{sin}}\left(\mathrm{ϑ__2}\left({t}\right)\right){}{g}\right){=}{0}$ (1.9)

The resulting equations $\mathrm{EL__1}$ and $\mathrm{EL__2}$ govern the dynamics of the two masses. They cannot be solved exactly, but we may try solving them numerically using dsolve. To do so, we set the constants to the following values in SI-units ($g$ is given in  , the lengths $\mathrm{l__i}$ in $m$ and the masses: $\mathrm{m__i}$ in $\mathrm{kg}$)

 >

Furthermore, we set the following initial conditions for the angles and their time derivatives:

 >

with the derivatives given in ${s}^{-1}$. Now we can solve the equations of motion (1.7) and (1.9) via

 >

The procedures for the two angles $\mathrm{ϑ__1}$ and $\mathrm{ϑ__2}$ obtained from this solution:

 >
 $\mathrm{ϑ__1}{≔}{\mathbf{proc}}\left({t}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$
 $\mathrm{ϑ__2}{≔}{\mathbf{proc}}\left({t}\right)\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{...}\phantom{\rule[-0.0ex]{0.5em}{0.0ex}}{\mathbf{end proc}}$ (1.10)

determine the dynamics of the system. In the following section we explore this solution a bit.

 > 

Chaotic Motion

The following plot visualizes the procedures obtained above in the time interval .

 Fig. 2 Visualization of the solution for $\mathrm{ϑ__1}$ and $\mathrm{ϑ__2}$ Note that the solution for the angles in this interval evolves chaotically, i.e. it does not exhibit any periodicity. Furthermore, note that the values of $\mathrm{ϑ__2}$ are not constrained to the interval $-\mathrm{π}\le \mathrm{ϑ__2}\le \mathrm{\pi }$. Whenever the line crosses a gridline, the pendulum flips over.

The dynamics of the double pendulum is chaotic, i.e. it is highly sensitive to the initial conditions $\mathrm{initial}$. The following plot contains the trajectory and the angles of the mass $\mathrm{m__2}$ for slightly different initial conditions.

 Fig. 3 Chaotic motion   The three plots show the motion of the double pendulum as parameterized in the previous section. They only differ in the initial condition for the first mass's initial position:   Plot 1: $\mathrm{ϑ__1}\left(0\right)=0.9\cdot \frac{\mathrm{\pi }}{7}$ Plot 2: $\mathrm{ϑ__1}\left(0\right)=1.0\cdot \frac{\mathrm{\pi }}{7}$ Plot 3: $\mathrm{ϑ__1}\left(0\right)=1.1\cdot \frac{\mathrm{\pi }}{7}$   While under the first condition, $\mathrm{m__2}$ flips over five times, in the second plot it only does so twice and in the third plot four times within the first 25 seconds. Thus, a small change in the initial state can result in large differences in the later behavior of the system.

In the following you can explore the motion of the double pendulum. Using the radio buttons, you can choose the strength of the gravitational field. Furthermore, you can adjust the lengths and masses of the two individual pendula using the sliders. The higher the mass, the bigger the circle representing the mass. The initial position of the pendula can be changed by dragging and dropping the masses directly in the plot. Their initial velocities can be adjusted using the sliders; by selecting Show arrows the animation shows the velocities of the masses relative to their pivot points. Furthermore, you may choose the animation duration. You can also plot the animation alongside the trajectory of $\mathrm{m__2}$ by selecting Show trajectory. After you have adjusted the settings, click Animate and wait for the Play button to appear.

Try to answer the following questions:
1) How does the gravitational field influence the motion of the pendulum? What happens as you turn off gravity ($g=0$)? Is the motion still chaotic?

2) How do the lengths of the individual pendula influence the motion of the double pendulum? What do you observe for $\mathrm{l__2}\ll \mathrm{l__1}$ and $\mathrm{l__1}\ll \mathrm{l__2}$?
3) How do the masses influence the motion of the pendulum? What do you observe in the case $\mathrm{m__1}\gg \mathrm{m__2}$? What happens when you change the masses of the pendula in the case $\mathrm{l__2}\ll \mathrm{l__1}$ and $\mathrm{l__1}\ll \mathrm{l__2}$?
4) Investigate the motion of the pendulum for different initial states. Confirm that slight changes in the initial state can lead to very different behaviors at later times.



gravitational field:

 $g={0}^{}$

lengths:

masses:

initial velocities:

Drag and drop the two masses into position directly in the plot.

Note: The calculation of the animation delays the appearance

of the Play button. Depending on the chosen animation

duration and whether "Show arrows" or "Show trajectory" is
checked, you may have to wait a few seconds.

animation duration