## Double Pendulum HTML5 JavaScript Simulation Model

- Details
- Parent Category: 02 Newtonian Mechanics
- Category: 02 Dynamics
- Created: Monday, 16 January 2017 10:18
- Last Updated: Thursday, 22 November 2018 17:35
- Published: Monday, 16 January 2017 10:18
- Written by Loo Kang Wee
- Hits: 9847

### About

# Double pendulum with external drive

The simulation demonstrates a frictionless, mathematical double pendulum that either:

- starts passively from given initial conditions,
- or is driven periodically by an external source.

The massless, rigid pendulum rods are shown as straight lines. Masses are concentrated in the center of the pendulum bobs.

When the simulation file is opened, the pendulum is in horizontal
position. The length of the secondary pendulum 2 (yellow) is one half
that of the primary one 1 (blue): *L _{2}/L_{1} =
0.5.* The mass of both is equal:

*m*Their initial speed is zero. There is no external drive:

_{2}/m_{1}= 1.*A=0.*

**Start** initiates the calculation of movement under the influence
of gravity. The path of the secondary yellow pendulum bob (2) is shown
in red for a limited time period. **Stop** freezes the movement until
a new start. **Clear **deletes traces,

**Rese**reestablishes the default initial conditions.

*t*The primary blue bob can be drawn with the mouse to create different initial angular positions, with stretched pendulum and zero initial velocity.

In the right window a phase space diagram *y _{1}´(y_{1})
*is shown for the blue bob of the primary pendulum (for a simple
pendulum this would be a closed periodical curve, and would be a circle
for small arcs of oscillation). The length of the traces is limited to
2500 points of calculation.

The speed of the animation can be varied with slider **Speed**.

The **length** *L _{1}*

_{ }of the primary pendulum is kept constant.

**Slider**

**L**changes the length of the secondary pendulum. The window size is adjusted to twice the maximum size of the double pendulum.

_{2}/L_{1}*L*results in a single pendulum, with both bob masses coinciding.

_{2}/L_{1}= 0
**Slider m _{2}/m_{1}** determines the mass relation
of the pendulum bobs.

*m*results in a single primary pendulum. In the simulation the orientation of the fictive massless secondary pendulum stays constant, while it will briskly oscillate for any finite mass.

_{2}/m_{1}= 0
The movement of the double pendulum is chaotic and shows no periodicity.
Yet it is strictly deterministic: after *reset* the same path will
be resumed (start without clearing the trace).

In a real pendulum friction would diminish the amplitude of oscillations. Friction is neglected in this model.

With *A > 0*** **a periodic external torque is acting upon
the primary pendulum, with amplitude and direction as shown by the black
arrow. Slider** ****delta **changes the drive frequency.
With *delta =1* the drive frequency is equal to that of the single
primary pendulum (*m2 = 0*) at small arcs. For all initial
conditions the driven double pendulum shows a rich variety of
deterministic chaotic movements.

The **3D-Phase space button **opens another window with two rotating
3D frames for the three dimensional phase spaces of both pendulums.

**y _{1}´´(y_{1 }, y´_{1}) und
y_{2}´´(y_{2 }, y_{2}´) **

The scalings of the 3D frames are adjusting automatically to the amplitudes.

### Translations

Code | Language | Translator | Run | |
---|---|---|---|---|

### Software Requirements

Android | iOS | Windows | MacOS | |

with best with | Chrome | Chrome | Chrome | Chrome |

support full-screen? | Yes. Chrome/Opera No. Firefox/ Samsung Internet | Not yet | Yes | Yes |

cannot work on | some mobile browser that don't understand JavaScript such as..... | cannot work on Internet Explorer 9 and below |

### Credits

Dieter Roess - WEH- Foundation; lookang

### end faq

### App

https://play.google.com/store/apps/details?id=com.ionicframework.dpendulumapp262907&rdid=com.ionicframework.dpendulumapp262907

### Sample Learning Goals

[text]

### Description

# Double pendulum with external drive

The simulation demonstrates a frictionless, mathematical double pendulum that either:

- starts passively from given initial conditions,
- or is driven periodically by an external source.

The massless, rigid pendulum rods are shown as straight lines. Masses are concentrated in the center of the pendulum bobs.

When the simulation file is opened, the pendulum is in horizontal position. The length of the secondary pendulum 2 (yellow) is one half that of the primary one 1 (blue): \( \frac{L_{2}}{L_{1}} = 0.5 \) The mass of both is equal: * *\( \frac{m_{2}}{m_{1}} = 1 \)*. *Their initial speed is zero. There is no external drive: *A=0. *

**Start** initiates the calculation of movement under the influence of gravity. The path of the secondary yellow pendulum bob (2) is shown in red for a limited time period. **Stop** freezes the movement until a new start. **Clear **deletes traces,

**Rese**reestablishes the default initial conditions.

*t*The primary blue bob can be drawn with the mouse to create different initial angular positions, with stretched pendulum and zero initial velocity.

In the right window, a phase space diagram* *\(y_{1}^{'} versus y_{1} \) is shown for the blue bob of the primary pendulum (for a simple pendulum this would be a closed periodical curve, and would be a circle for small arcs of oscillation). The length of the traces is limited to 2500 points of calculation.

The speed of the animation can be varied with slider **Speed**.

The **length** *L _{1}* of the primary pendulum is kept constant.

**Slider**\( \frac{L_{2}}{L_{1}} \) changes the length of the secondary pendulum. The window size is adjusted to twice the maximum size of the double pendulum. \( \frac{L_{2}}{L_{1}} =0 \) results in a single pendulum, with both bob masses coinciding.

**Slider ** \( \frac{m_{2}}{m_{1}} \) determines the mass relation of the pendulum bobs.* *\( \frac{m_{2}}{m_{1}} = 0 \) results in a single primary pendulum. In the simulation, the orientation of the fictive massless secondary pendulum stays constant, while it will briskly oscillate for any finite mass.

The movement of the double pendulum is chaotic and shows no periodicity. Yet it is strictly deterministic: after *resetting* the same path will be resumed (start without clearing the trace).

In a real pendulum, friction would diminish the amplitude of oscillations. Friction is neglected in this model.

With *A > 0* a periodic external torque is acting upon the primary pendulum, with amplitude and direction as shown by the black arrow. Slider* ***delta **changes the drive frequency. With *delta =1* the drive frequency is equal to that of the single primary pendulum (*m2 = 0*) at small arcs. For all initial conditions, the driven double pendulum shows a rich variety of deterministic chaotic movements.

The **3D-Phase space button **opens another window with two rotating 3D frames for the three-dimensional phase spaces of both pendulums.

**y _{1}´´(y_{1 }, y´_{1}) and y_{2}´´(y_{2 }, y_{2}´) **

The scalings of the 3D frames are adjusting automatically to the amplitudes.

Model

# Formulas

Without external drive a pendulum has constant energy, as determined by the initial conditions. At rest *(ω _{A }= 0)* and at height

*y*above the lowest point

_{A}*y*the initial energy is 100% potential energy:

_{0}= 0

*E _{pot_max} = mg ( y_{A} - y_{0 })*

In movement potential and kinetic energy are exchanged continuously with constant sum. For a single pendulum, all energy is kinetic at the lowest point *y = 0*.

*Ekin_max = m v ^{2}/2 = m (rω)^{2}/2 = mg (y_{A} - y_{0})* =

*E*

_{pot_max}For the double pendulum, the initial potential energy is distributed between the kinetic and potential energy of both bobs, while the secondary one oscillates around the primary one.

The simple pendulum is described by **one** **nonlinear** ordinary second order differential equation with two initial conditions (angle and angular momentum):

It is nonlinear because of the nonlinear trigonometric function that connects oscillation angle with angular velocity.

The second order differential equation is equivalent to the description by two first-order differential equations, the first of which (1) is linear, the second one (2) nonlinear.

The nonlinearity lies in the simple relation between angle and angular velocity, described by *f*.

With *α* angle of oscillation, *ω* angular velocity, *g* gravity acceleration, *L* pendulum length:

\(\frac{d\alpha^{2}}{dt^{2}} = -\frac{g}{L} sin \alpha \)

which implies

(1)* *\( \frac{d\alpha}{dt} = \omega \)

(2)* *\( \frac{d\omega}{dt} = f(\alpha) \)

* *\( f (\alpha) = -\frac{g}{L} sin \alpha \)

The double pendulum is described by **two nonlinear,** coupled, ordinary differential equations of second order with four initial conditions (angle and angular momentum of both pendulums). This is equivalent to four equations of first order, all of which are nonlinear because of trigonometric functions and the quadratic coupling terms shown in red:

(1)* *\( \frac{d\alpha_{1}}{dt} = -\omega_{1} \)

(2)* _{ }*\( \frac{d\omega_{1}}{dt} = f_{1}(\alpha_{1}, \alpha_{2}, \omega_{1}, \omega_{2}) \)

where \( f_{1}(\alpha_{1}, \alpha_{2}, \omega_{1}, \omega_{2}) = -\frac{-\frac{g}{L_{1}}((m_{1}+m_{2}) sin(\alpha_{1})- m_{2} sin(\alpha_{2}) cos(\alpha_{1}- \alpha_{2}))

-m_{2} sin(\alpha_{1}-\alpha_{2})(\frac{L{2}}{L_{1}}\omega_{2}^{2}+\omega_{1}^{2} cos(\alpha_{1}-\alpha_{2})))}{m_{1}+m_{2} sin^{2}(\alpha_{1}-\alpha_{2}) )}\)

* *

(3) * *\( \frac{d\alpha_{2}}{dt} = \omega_{2}\)

(4) \( \frac{d\omega_{2}}{dt} = f_{2}(\alpha_{1}, \alpha_{2}, \omega_{1}, \omega_{2})\)

where \( f_{2}(\alpha_{1}, \alpha_{2}, \omega_{1}, \omega_{2}) = -\frac{g}{L_{2}}sin (\alpha_{2})+\frac{L_{1}}{L_{2}} \omega^{2} sin(\alpha_{1}-\alpha_{2}) - \frac{ \frac{L_{1}}{L_{2}} cos(\alpha_{1}-\alpha_{2} ) (-\frac{g}{L}(m_{1}+m_{2}) sin(\alpha_{1})- m_{2}sin\alpha_{2} cos (\alpha_{1}-\alpha_{2}) -m_{2} sin(\alpha_{1}-\alpha_{2})( \frac{L_{2}}{L_{1}}\omega_{2}^{2}+\omega_{1}^{2} cos(\alpha_{1}-\alpha_{2}) ) }{(m_{1}+m_{2} sin(\alpha_{1}-\alpha_{2}) sin(\alpha_{1}-\alpha_{2})) } \)

* *

The equations for the second derivatives \(f_{1}\) and \(f_{2}\) are far more complicated than for the single pendulum. They depend on the relations of the pendulum lengths and masses, and on the angles and angular velocities of both pendulums. The fact is that there are two coupled nonlinear differential equations is the deeper cause of the deterministic chaotic behavior. When restarting the movement with exactly the same initial conditions (as the computer does with *Reset*), the same trace is reproduced. Yet when trying to create the same initial condition by moving the pendulum with the mouse, the path will develop differently, as it depends critically on the exact value of the initial conditions. This is best observed when superimposing traces of two oscillations (choose **pause*** *but not **clear**, draw bob and **start**).

The chaotic behavior remains when some of the nonlinear terms are removed or changed, as long as the nonlinear character of the equations is preserved (the equations then no longer model the double pendulum). **The decisive origin of chaotic behavior is the existence of more than one nonlinear differential equation.**

With *m _{2} = 0* (0r

*L*= 0) the first equation is reduced to that of the single pendulum, the second equation becomes identical to zero. The simulation then shows the periodic, generally nonlinear, oscillation of a single pendulum.

_{2}With drive the differential equation for the primary pendulum is

*f _{1_drive }= f_{1} + A cos(delta*t)*

where *A* is the amplitude of the drive, *delta* its frequency in relation to that of the free pendulum at small amplitudes.

### Activities

**E1: **When you open the simulation, the double pendulum will start its oscillation. Stop it after some time with **Reset**, which leaves the old trace and resets the original initial condition. Start again, and observe that traces coincide (deterministic chaos).

Reset after a few oscillations, draw the blue bob very slightly and try to put it into the vertical position again. Can you do that exactly enough to reproduce the old trace for more than a few oscillations?

**E2: **Increase **Speed,** which increases the time between calculated points. This will increase the maximum trace length, as the number of calculated points shown is constant. Use** Clear** when traces become too complex.

**E3: **Choose **Reset*** *and change the length of the secondary pendulum with **slider*** L_{2}/L_{1}*

**.**What happens?

**E4: **Set *L _{2}/L_{1 }~ 0 *after

**Reset**

*.*Now you simulate a simple pendulum. Investigate when its oscillation is approximately linear. Is it always periodical? What does the phase space diagram tell you?

**E5: **As E4; try to pull the bob as exactly as possible into its upper position. Can you stabilize it there? Study repeated oscillations from the highest starting position. Can you reproduce them?

**E6: **As E5; position the bob near to its stable point (*y ~0*). Compare the phase space diagram to that of E5.

**E7: **Change the mass relation of the bobs via **Slider** **m _{2}/m_{1}**: Do that for different length relations

*L*

_{2}/L_{2}.

**E8: **Add periodic drive *(A* *> 0).*

**E9: ** Change the drive frequency with slider **delta**

**E10**: You can change parameters while the simulation is running.

**E11: **After **Reset **and **Clear **let the pendulum perform a few oscillations; then choose **Reset** without **Clear****,** which leaves the old trace. Pull the blue bob very slightly from its position and restart. Observe the long-term dependence of the trace from slight variations of the starting condition (*a _{1}*).

**E12: **Consider how you can realize a double pendulum with periodic drive! One suggestion:

clamp the end of the primary pendulum to the axis of a small DC motor that is driven by the amplified signal of a sine wave generator.

### Video

[text]

### Version:

- this JavaScript version is recreated by lookangon 15 January 2017 as a response to the request by Prof padyala radhakrishnamurty. http://weelookang.blogspot.sg/2017/01/double-pendulum-html5-javascript.html
- created by Dieter Roess in April 2009, This simulation is part of “Learning and Teaching Mathematics using Simulations – Plus 2000 Examples from Physics” ISBN 978-3-11-025005-3, Walter de Gruyter GmbH & Co. KG

### Other Resources

https://www.geogebra.org/m/DpmwJPzg Angular Momentum Collision by ukukuku

Facebook Social Comments