Flow Lab

Syllabus / Module 14: Applications: Physics & Engineering

Lesson 14.3

Pendulums: Linear, Nonlinear, Driven & Double

Small-angle vs full nonlinear pendulum, period dependence on amplitude, the driven damped pendulum, and the chaotic double pendulum (Lagrangian mechanics intro).

Written byClaude Sonnet

🌊
Why this matters for simulation: Lagrangian mechanics generalizes to any constrained system — robot arms, control surfaces.

By the end of this lesson you can…

  • Derive $\ddot\theta + (g/L)\sin\theta = 0$, linearise it to the period $2\pi\sqrt{L/g}$, and say how large the small-angle error is at a given amplitude.
  • Use energy conservation to sketch the phase portrait, locate the separatrix, and tell libration from rotation.
  • Derive the exact period $T = 4\sqrt{L/g}\,K(\sin(\theta_0/2))$ and compute $K$ with the arithmetic-geometric mean.
  • Read a strobe (Poincaré) plot of the driven damped pendulum: one dot is period one, two dots is period doubling, a scatter is chaos.
  • Apply the Euler-Lagrange equations to a pendulum and derive the double-pendulum equations from $\mathcal L = T - V$.
  • Measure sensitive dependence on a double pendulum, and explain why RK4's energy error drifts while velocity Verlet's stays bounded.
On this page
·
  1. From torque to the small-angle approximation
  2. Energy, the phase portrait and the separatrix
  3. The exact period: an elliptic integral
  4. Damping and driving
  5. Lagrangian mechanics: equations for any mechanism
  6. The double pendulum and sensitive dependence
  7. What integrators do to energy over a long run
  8. The lab
  9. The exercise: period against amplitude
  10. Concept checks
  11. Problems
  12. What comes next
  13. Key Takeaways

14.2 Electrical Circuits closed with a warning: everything so far was linear, which is what made impedance possible. The pendulum is the first honest nonlinear system in this module. It brings together the phase portrait and separatrix of 7.3 Phase Portraits & the Trace–Determinant Plane and 7.8 Conservative Systems & Lyapunov Functions, the chaos of 7.10 Chaos & the Lorenz System (here in a system that loses no energy), and the integrator energy behaviour of 4.7 Energy & Symplectic Integrators. We go from the small-angle oscillator to a chaotic double pendulum, picking up the Lagrangian machinery that writes equations for any such mechanism.

▶ Video From the small-angle oscillator to the exact period, the separatrix, the driven damped pendulum, the Lagrangian, and a double pendulum whose twin trajectories fly apartcaptions only
Transcript
  1. A bob hangs from a rigid rod of length L. Gravity's pull along the arc is minus m g sine theta, the mass cancels, and theta double dot plus g over L times sine theta equals zero. Replace sine theta by theta and you get the harmonic oscillator, with period T naught equals 2 pi root L over g, independent of the amplitude. For L equal to 1 metre, T naught is 2.0061 seconds. The phase plane shows where this fails. At theta equal to zero the eigenvalues are plus and minus i, a centre. At the top, theta equal to pi, they are plus and minus 1, a saddle. Linearisation is right near each equilibrium, and wrong between them.
  2. There is no damping, so energy is conserved. Multiply by theta dot and integrate, and E equals one half theta dot squared minus cosine theta is constant. Orbits are level curves of E. Below E equal to 1 the bob librates, swinging between turning points. Above 1 it rotates, going over the top again and again. At exactly 1 is the separatrix, theta dot equals plus or minus 2 cosine of theta over 2, through the saddles at plus and minus pi. A trajectory on it takes infinite time to reach the saddle, so the period must diverge as the amplitude approaches pi.
  3. Release from rest at theta naught. Energy gives the quarter period as an integral, and the substitution sine of theta over 2 equals k sine phi turns it into T equals 4 root L over g times K of k, the complete elliptic integral of the first kind. Gauss showed that K is the arithmetic-geometric mean in disguise, so T over T naught equals 1 over the AGM of 1 and cosine of theta naught over 2. The ratio is 1.017409 at 30 degrees, 1.180341 at 90, 1.762204 at 150, and 3.901065 at 179 degrees, a small-angle error of 290 percent. A clock swinging 10 degrees instead of 5 runs slow by an extra 123.6 seconds per day. The period grows only logarithmically, the signature of lingering near a saddle.
  4. Add damping c and a periodic torque A cosine omega t. The system is no longer autonomous, so we sample once per drive period, a strobe plot, and a period n motion shows as n dots. With c equal to 0.5, omega equal to 2 thirds, and 300 transient periods thrown away, A of 0.9 gives 1 point. 1.07 gives 2, 1.35 gives 1 again, 1.44 gives 2, 1.465 gives 4, and 1.5 gives no repetition, more than 63 distinct points. One, two, four, then chaos: a period-doubling cascade. No repetition among 300 dots is evidence, not proof.
  5. To get equations for any mechanism, choose generalised coordinates, write the kinetic energy T and the potential energy V, and form the Lagrangian, L equals T minus V. The Euler-Lagrange equations say d by dt of the derivative of L with respect to q dot, minus the derivative with respect to q, equals zero. For the pendulum this returns the same equation. Hang a second bob from the first, and the same steps give two coupled equations with a 2 by 2 mass matrix multiplying the accelerations, and a conserved energy. For small angles it is the coupled oscillator problem of 14.1, with normal modes 0.7654 and 1.8478. The linearised double pendulum is regular. The chaos lives in the terms the approximation throws away.
  6. Release from rest at 120 degrees and minus 10 degrees, and start a twin offset by epsilon in theta 1. With epsilon equal to 10 to the minus 3 the gap first reaches 1 at 20.04. With 10 to the minus 6 it takes 40.74, and with 10 to the minus 9, 66.4 with RK4 and 67.0 with DOP853. Each factor of 1000 in accuracy buys only 20.7 to 26 more time units: the prediction horizon grows logarithmically. The two integrators disagree about the last one, because RK4's truncation error is itself amplified by chaos. The growth rate is the largest Lyapunov exponent. My estimate is about 0.3, with an honest range of about 0.25 to 0.33. Energy is conserved throughout: conservative chaos, with no attractor.
  7. Finally, what do integrators do to energy over a long run? From rest at 120 degrees with step 0.2, RK4 loses a little energy every orbit: by T equal to ten thousand its error is minus 3.33 times 10 to the minus 2, and it grows linearly. Velocity Verlet never exceeds 1.13 times 10 to the minus 2, because its error stays bounded. So RK4 wins until T is about 3400, and loses after. Bounded energy is not accurate phase, though, and the double pendulum's Hamiltonian is non-separable, so kick-drift-kick does not apply as written. The next lesson is heat transfer: conduction, convection and radiation, Newton cooling, lumped capacitance and the Biot number, and the cooling fin as a boundary-value problem.

From torque to the small-angle approximation

A bob of mass mm hangs from a rigid massless rod of length LL, at angle θ\theta from straight down. Gravity’s component along the arc is −mgsin⁡θ-mg\sin\theta, so mLθ¨=−mgsin⁡θmL\ddot\theta = -mg\sin\theta and the mass cancels:

θ¨+gLsin⁡θ=0.\ddot\theta + \frac{g}{L}\sin\theta = 0 .

Rescaling time by L/g\sqrt{L/g} gives θ¨+sin⁡θ=0\ddot\theta + \sin\theta = 0, the dimensionless form used from here on: one time unit is 0.31930.3193 s for L=1L = 1 m and g=9.81g = 9.81 m/s². The small-angle approximation sin⁡θ≈θ\sin\theta \approx \theta gives the harmonic oscillator of 5.3 Mechanical Vibrations: Spring–Mass–Damper with period T0=2πL/gT_0 = 2\pi\sqrt{L/g}, independent of amplitude. For L=1L = 1 m, T0=2.0061T_0 = 2.0061 s; a length of 0.993960.99396 m gives the “seconds pendulum”, T0=2T_0 = 2 s.

The phase plane (θ,ω=θ˙)(\theta, \omega = \dot\theta) shows where the approximation fails. The Jacobian at θ=0\theta = 0 has eigenvalues ±i\pm i, a centre. At θ=π\theta = \pi write θ=π+φ\theta = \pi + \varphi: sin⁡θ≈−φ\sin\theta \approx -\varphi and φ¨=+φ\ddot\varphi = +\varphi, a saddle with eigenvalues ±1\pm 1 (that is ±g/L=±3.13 s−1\pm\sqrt{g/L} = \pm 3.13\ \mathrm s^{-1} for L=1L = 1 m). Linearisation (7.7 Nonlinear Systems & Linearization) is right near each equilibrium and wrong between them.

Energy, the phase portrait and the separatrix

There is no damping, so energy is conserved. Multiply the equation by θ˙\dot\theta and integrate:

E=12θ˙ 2−cos⁡θ=const.E = \tfrac12\dot\theta^{\,2} - \cos\theta = \text{const}.

(In real units multiply by mgLmgL: the top is 2mgL2mgL above the bottom.) Orbits are level curves of EE, with E=−1E = -1 at the bottom and E=+1E = +1 at the top. The level E=1E = 1 divides the motion:

  • E<1E \lt 1: libration, a swing between turning points ±θ0\pm\theta_0 with cos⁡θ0=−E\cos\theta_0 = -E (the closed orbits around the centre).
  • E>1E \gt 1: rotation, going over the top again and again.
  • E=1E = 1: the separatrix, with θ˙2=2(1+cos⁡θ)=4cos⁡2(θ/2)\dot\theta^2 = 2(1 + \cos\theta) = 4\cos^2(\theta/2), so
θ˙=±2cos⁡(θ/2).\dot\theta = \pm 2\cos(\theta/2).

It passes through the saddles at θ=±π\theta = \pm\pi and encloses the librations. A bob released from rest just inside it (θ0=179∘\theta_0 = 179^\circ) swings almost to the top; one launched from the bottom at θ˙=2\dot\theta = 2, just enough to reach the top (v=2gLv = 2\sqrt{gL}), rides along it. A trajectory on the separatrix takes infinite time to reach the saddle, so the period must diverge as θ0→π\theta_0 \to \pi. The lab draws the portrait live.

The exact period: an elliptic integral

Release from rest at θ0\theta_0. Energy gives θ˙2=2(cos⁡θ−cos⁡θ0)=4(sin⁡2(θ0/2)−sin⁡2(θ/2))\dot\theta^2 = 2(\cos\theta - \cos\theta_0) = 4\bigl(\sin^2(\theta_0/2) - \sin^2(\theta/2)\bigr). The swing from 00 to θ0\theta_0 is a quarter period, so with k=sin⁡(θ0/2)k = \sin(\theta_0/2),

T=4∫0θ0dθ2k2−sin⁡2(θ/2).T = 4\int_0^{\theta_0}\frac{d\theta}{2\sqrt{k^2 - \sin^2(\theta/2)}} .

The substitution sin⁡(θ/2)=ksin⁡ϕ\sin(\theta/2) = k\sin\phi gives 12cos⁡(θ/2) dθ=kcos⁡ϕ dϕ\tfrac12\cos(\theta/2)\,d\theta = k\cos\phi\,d\phi and k2−sin⁡2(θ/2)=kcos⁡ϕ\sqrt{k^2 - \sin^2(\theta/2)} = k\cos\phi, and everything cancels to

T=4Lg  K(k),K(k)=∫0π/2dϕ1−k2sin⁡2ϕ.T = 4\sqrt{\frac{L}{g}}\;K(k), \qquad K(k) = \int_0^{\pi/2}\frac{d\phi}{\sqrt{1 - k^2\sin^2\phi}} .

KK is the complete elliptic integral of the first kind, with no elementary closed form. Gauss showed (from memory, a classical identity) that it is the arithmetic-geometric mean in disguise: K(k)=π/(2 AGM(1,1−k2))K(k) = \pi/\bigl(2\,\mathrm{AGM}(1, \sqrt{1 - k^2})\bigr), where AGM(a,b)\mathrm{AGM}(a, b) is the limit of repeating a,b←(a+b)/2,aba, b \leftarrow (a+b)/2, \sqrt{ab}, which converges in a handful of steps. Since 1−k2=cos⁡(θ0/2)\sqrt{1 - k^2} = \cos(\theta_0/2),

TT0=2K(k)π=1AGM(1,cos⁡(θ0/2)).\frac{T}{T_0} = \frac{2K(k)}{\pi} = \frac{1}{\mathrm{AGM}\bigl(1, \cos(\theta_0/2)\bigr)} .

The lab computes this, and I recomputed it with scipy.special.ellipk (which takes m=k2m = k^2); the lab’s RK4 quarter-period measurement agrees to six digits:

θ0\theta_0T/T0T/T_0small-angle error
30∘30^\circ1.0174091.0174091.74%1.74\%
60∘60^\circ1.0731821.0731827.3%7.3\%
90∘90^\circ1.1803411.18034118.0%18.0\%
120∘120^\circ1.3728811.37288137.3%37.3\%
150∘150^\circ1.7622041.76220476.2%76.2\%
179∘179^\circ3.9010653.901065290%290\%

Expanding KK gives T/T0≈1+θ02/16T/T_0 \approx 1 + \theta_0^2/16, and (from memory, checked numerically) a next term 11θ04/307211\theta_0^4/3072. At 30∘30^\circ these give 1.0171351.017135 and 1.0174041.017404 against the exact 1.0174091.017409; at 90∘90^\circ, 1.1542131.154213 and 1.1760121.176012 against 1.1803411.180341. Near the separatrix K(k)≈ln⁡(4/cos⁡(θ0/2))K(k) \approx \ln(4/\cos(\theta_0/2)) (from memory), so T/T0≈2πln⁡(4/cos⁡(θ0/2))T/T_0 \approx \tfrac2\pi\ln\bigl(4/\cos(\theta_0/2)\bigr), which gives 3.9013.901 at 179∘179^\circ. The period grows only logarithmically, the signature of lingering near a saddle with eigenvalue 11.

Worked example: a clock. A pendulum clock swinging 10∘10^\circ instead of 5∘5^\circ has ratios 1.0019071.001907 and 1.0004761.000476, so it runs slow by an extra (1.001907−1.000476)×86 400=123.6(1.001907 - 1.000476)\times 86\,400 = 123.6 s per day.

Damping and driving

Add viscous damping cθ˙c\dot\theta and a periodic torque Acos⁡(Ωt)A\cos(\Omega t):

θ¨+c θ˙+sin⁡θ=Acos⁡(Ωt).\ddot\theta + c\,\dot\theta + \sin\theta = A\cos(\Omega t).

The system is no longer autonomous, so the phase plane gives way to a strobe plot (a Poincaré section): sample (θ,θ˙)(\theta, \dot\theta) once per drive period 2π/Ω2\pi/\Omega, with θ\theta wrapped into (−π,π](-\pi, \pi]. A period-nn motion shows as nn dots. Take c=0.5c = 0.5, Ω=2/3\Omega = 2/3, start from rest at 11∘11^\circ, and count distinct strobe points after 300300 transient periods. The lab (RK4, 400400 steps per period) and an independent scipy DOP853 run at tight tolerance agree:

drive AAstrobe pointswhat it is
0.90.911period one
1.071.0722period doubled
1.351.3511period one, over the top once per period
1.441.4422the rotating motion, doubled
1.4651.46544doubled again
1.51.5no repetitionchaotic

The last four rows look like a period-doubling cascade: 1,2,41, 2, 4, then no repetition, the route of the logistic map in 7.10 Chaos & the Lorenz System. The rotating rows make −1.000-1.000 turns per period (script check). Two honest limits. Which attractor you reach depends on the start, since oscillating and rotating attractors coexist; these values are for this start only. And “no repetition among 300300 dots” is evidence, not proof. As an outside check (script, not the lab), twin runs at A=1.5A = 1.5 started 10−910^{-9} apart reach a gap of 11 within 22.3522.35 drive periods, a Benettin growth rate of about 0.110.11 per unit time (positive), while at A=1.465A = 1.465 it is −0.095-0.095 (a stable orbit). I did not map the whole AA axis, so I claim nothing about where chaos begins.

Lagrangian mechanics: equations for any mechanism

In a mechanism the interesting forces (rod tension, pivot reactions) are not what we want. Lagrangian mechanics avoids them. Choose generalised coordinates qiq_i, write the kinetic energy TT and potential energy VV in them, and form L=T−V\mathcal L = T - V. The Euler-Lagrange equations (from memory, from the principle of stationary action) are

ddt∂L∂q˙i−∂L∂qi=0,i=1,…,n.\frac{d}{dt}\frac{\partial\mathcal L}{\partial\dot q_i} - \frac{\partial\mathcal L}{\partial q_i} = 0, \qquad i = 1,\dots,n.

For the pendulum, L=12mL2θ˙2+mgLcos⁡θ\mathcal L = \tfrac12mL^2\dot\theta^2 + mgL\cos\theta, so ∂L/∂θ˙=mL2θ˙\partial\mathcal L/\partial\dot\theta = mL^2\dot\theta and ∂L/∂θ=−mgLsin⁡θ\partial\mathcal L/\partial\theta = -mgL\sin\theta, giving mL2θ¨+mgLsin⁡θ=0mL^2\ddot\theta + mgL\sin\theta = 0: the pendulum, with no tension in sight. With p=∂L/∂θ˙p = \partial\mathcal L/\partial\dot\theta and H=pθ˙−L=T+VH = p\dot\theta - \mathcal L = T + V this is the Hamiltonian form of 4.7 Energy & Symplectic Integrators.

The double pendulum. Hang a bob of mass m2m_2 on a rod of length l2l_2 from the first bob (m1m_1, rod l1l_1), with angles θ1,θ2\theta_1, \theta_2 from the vertical. The positions are x1=l1(sin⁡θ1,−cos⁡θ1)\mathbf x_1 = l_1(\sin\theta_1, -\cos\theta_1) and x2=x1+l2(sin⁡θ2,−cos⁡θ2)\mathbf x_2 = \mathbf x_1 + l_2(\sin\theta_2, -\cos\theta_2), so ∣x˙2∣2=l12θ˙12+l22θ˙22+2l1l2θ˙1θ˙2cos⁡δ\lvert\dot{\mathbf x}_2\rvert^2 = l_1^2\dot\theta_1^2 + l_2^2\dot\theta_2^2 + 2l_1l_2\dot\theta_1\dot\theta_2\cos\delta with δ=θ1−θ2\delta = \theta_1 - \theta_2, and

T=12(m1+m2)l12θ˙12+12m2l22θ˙22+m2l1l2θ˙1θ˙2cos⁡δ,V=−(m1+m2)gl1cos⁡θ1−m2gl2cos⁡θ2.T = \tfrac12(m_1 + m_2)l_1^2\dot\theta_1^2 + \tfrac12m_2l_2^2\dot\theta_2^2 + m_2l_1l_2\dot\theta_1\dot\theta_2\cos\delta, \qquad V = -(m_1 + m_2)gl_1\cos\theta_1 - m_2gl_2\cos\theta_2 .

For θ1\theta_1, the θ˙1θ˙2sin⁡δ\dot\theta_1\dot\theta_2\sin\delta terms from d/dt (∂L/∂θ˙1)d/dt\,(\partial\mathcal L/\partial\dot\theta_1) and from ∂L/∂θ1\partial\mathcal L/\partial\theta_1 cancel, leaving (after dividing by l1l_1)

(m1+m2)l1θ¨1+m2l2θ¨2cos⁡δ+m2l2θ˙2 2sin⁡δ+(m1+m2)gsin⁡θ1=0,(m_1 + m_2)l_1\ddot\theta_1 + m_2l_2\ddot\theta_2\cos\delta + m_2l_2\dot\theta_2^{\,2}\sin\delta + (m_1 + m_2)g\sin\theta_1 = 0 ,

and the same steps for θ2\theta_2 give m2l2θ¨2+m2l1θ¨1cos⁡δ−m2l1θ˙1 2sin⁡δ+m2gsin⁡θ2=0m_2l_2\ddot\theta_2 + m_2l_1\ddot\theta_1\cos\delta - m_2l_1\dot\theta_1^{\,2}\sin\delta + m_2g\sin\theta_2 = 0. A 2×22\times2 mass matrix multiplies (θ¨1,θ¨2)(\ddot\theta_1, \ddot\theta_2), and you solve for the accelerations each step. For m1=m2=l1=l2=g=1m_1 = m_2 = l_1 = l_2 = g = 1, as in the lab, it is (2cos⁡δcos⁡δ1)\begin{pmatrix}2 & \cos\delta\\ \cos\delta & 1\end{pmatrix} with determinant 2−cos⁡2δ≥12 - \cos^2\delta \ge 1, and the conserved energy is E=θ˙12+12θ˙22+θ˙1θ˙2cos⁡δ−2cos⁡θ1−cos⁡θ2E = \dot\theta_1^2 + \tfrac12\dot\theta_2^2 + \dot\theta_1\dot\theta_2\cos\delta - 2\cos\theta_1 - \cos\theta_2.

For small angles, cos⁡δ≈1\cos\delta \approx 1, and M=(2111)M = \begin{pmatrix}2 & 1\\ 1 & 1\end{pmatrix} with K=diag(2,1)K = \mathrm{diag}(2, 1) is the coupled-oscillator problem of 14.1 Coupled Oscillators & Normal Modes: modes ω2=2∓2\omega^2 = 2 \mp \sqrt2, that is ω=0.7654\omega = 0.7654 and 1.84781.8478. The linearised double pendulum is regular. The chaos lives in the terms the approximation throws away.

The double pendulum and sensitive dependence

Release from rest at θ1=120∘\theta_1 = 120^\circ, θ2=−10∘\theta_2 = -10^\circ (E=0.0152E = 0.0152), with a twin offset by ε\varepsilon in θ1\theta_1, and measure the distance in phase space, Δθ12+Δθ22+Δω12+Δω22\sqrt{\Delta\theta_1^2 + \Delta\theta_2^2 + \Delta\omega_1^2 + \Delta\omega_2^2}. With RK4, h=0.005h = 0.005 (time in units of l/g\sqrt{l/g}), the gap first reaches each level at these times, recomputed with DOP853 at rtol=10−13\mathrm{rtol} = 10^{-13}:

ε\varepsilongap 10−310^{-3}10−210^{-2}10−110^{-1}11
10−310^{-3}at start8.038.0314.9114.9120.0420.04
10−610^{-6}20.1020.1027.6627.6634.6334.6340.7440.74
10−910^{-9}39.2339.2350.8550.8559.159.166.466.4 (RK4), 67.067.0 (DOP853)

The gap grows exponentially (a straight line on the lab’s log plot), and each factor of 10001000 in ε\varepsilon adds only 20.720.7 to 2626 time units to the prediction horizon: accuracy buys time logarithmically, as in the Lorenz lesson. A 10−310^{-3} rad error limits you to about 2020 time units, 6.46.4 s for a one-metre pendulum. The last cell is the honest part: the two integrators disagree about when the same gap reaches 11 (66.466.4 against 67.067.0), because RK4’s truncation error is itself a perturbation amplified by chaos. Both are right about the exponent, neither is the true trajectory beyond about t=50t = 50. And energy is conserved throughout: this is conservative chaos, with no attractor.

The growth rate is the largest Lyapunov exponent λ\lambda. A window fit of ln⁡(gap)\ln(\text{gap}) from 10−410^{-4} to 0.10.1 at ε=10−6\varepsilon = 10^{-6} gives 0.3280.328 in both the lab and the script. The Benettin estimate (rescale the gap to 10−810^{-8} every 0.50.5 units, average ln⁡(gap/10−8)\ln(\text{gap}/10^{-8})) gives 0.2900.290 over 100100 units with RK4 (lab) and 0.3260.326 with DOP853: the two runs follow different trajectories after t≈50t \approx 50. Over 200200 units the RK4 value was 0.2810.281 in node but 0.2420.242 in a browser, a different last bit in a math function, amplified by the chaos itself, and 0.3000.300 with DOP853. My estimate is λ≈0.3\lambda \approx 0.3, with an honest range of about 0.250.25 to 0.330.33; other starts gave 0.280.28 to 0.420.42, and 10∘10^\circ for both angles gave 0.0040.004 (regular). The rule Tpred≈λ−1ln⁡(1/ε)T_{\mathrm{pred}} \approx \lambda^{-1}\ln(1/\varepsilon) gives 4646 for ε=10−6\varepsilon = 10^{-6} against the measured 40.740.7: a rule of thumb.

What integrators do to energy over a long run

By 4.7 Energy & Symplectic Integrators, a symplectic method (velocity Verlet) keeps the pendulum’s energy error bounded while RK4’s drifts. From rest at 120∘120^\circ with h=0.2h = 0.2 (about 3131 steps per period), by the lab’s drift button and an independent numpy loop:

runRK4 final E−E0E - E_0RK4 maxVerlet finalVerlet max
T=1000T = 1000−3.35×10−3-3.35\times10^{-3}3.37×10−33.37\times10^{-3}1.9×10−51.9\times10^{-5}1.13×10−21.13\times10^{-2}
T=10 000T = 10\,000−3.33×10−2-3.33\times10^{-2}3.33×10−23.33\times10^{-2}6.0×10−46.0\times10^{-4}1.13×10−21.13\times10^{-2}

RK4’s error grows linearly, at about 3.3×10−63.3\times10^{-6} per unit time, while Verlet’s never exceeds 1.13×10−21.13\times10^{-2}. So RK4 wins until T≈3400T \approx 3400 (extrapolating the line) and loses after. With h=0.1h = 0.1 the T=10 000T = 10\,000 numbers are −1.06×10−3-1.06\times10^{-3} and 2.8×10−32.8\times10^{-3}. Two caveats. Bounded energy is not accurate phase: Verlet’s period is off by O(h2)O(h^2). And the double pendulum’s Hamiltonian is non-separable (TT depends on the angles through the mass matrix), so kick-drift-kick does not apply as written; symplectic methods for it are implicit or more elaborate (from memory). I used RK4 there: over T=100T = 100 from 120∘120^\circ, −10∘-10^\circ its energy error is at most 2.5×10−52.5\times10^{-5} at h=0.02h = 0.02 and 1.6×10−81.6\times10^{-8} at h=0.005h = 0.005, small beside the chaotic error above. Long N-body runs change this, the subject of 14.7 N-Body Simulation.

The lab

◆ Interactive Single pendulum with phase portrait, period readout and strobe plot; double pendulum with twin runs

Loading simulation…

In single-pendulum mode the phase plane shows the separatrix dashed and the exact level curve dotted. At 90∘90^\circ the readout gives 2π=6.28322\pi = 6.2832, the exact 7.41637.4163 (ratio 1.18031.1803) and a matching RK4 measurement.

  1. Set the amplitude to 179∘179^\circ: the ratio is 3.90113.9011.
  2. Press the chaotic-drive button (c=0.5c = 0.5, A=1.5A = 1.5, start at 11∘11^\circ): the readout reports more than 6363 distinct strobe points. Move AA to 1.4651.465 for 44 points, to 0.90.9 for 11.
  3. Set 120∘120^\circ and press the energy-drift button: RK4 −3.33×10−2-3.33\times10^{-2}, Verlet maximum 1.13×10−21.13\times10^{-2}.
  4. Switch to the double pendulum (120∘120^\circ, −10∘-10^\circ, ε=10−6\varepsilon = 10^{-6}): the gap times are 20.1020.10, 27.6627.66, 34.6334.63, 40.7440.74, the window-fit rate 0.3280.328, and the Lyapunov button gives 0.2900.290.

The exercise: period against amplitude

The playgrounds reproduce the period table and the double-pendulum divergence. The exercise builds the period two ways: by the AGM, and by integrating the ODE with RK4 and timing the quarter swing.

🐍 PythonPeriod against amplitude
⌘/Ctrl + Enter
🐍 PythonTwin double pendulums
⌘/Ctrl + Enter
🧪 Coding exerciseExercise: the period by AGM and by RK4
⌘/Ctrl + Enter
🐍 PythonRK4 against velocity Verlet over a long run
⌘/Ctrl + Enter

Concept checks

✅ Concept check

A pendulum is released from rest at $90^\circ$. By what factor is its true period longer than the small-angle value $2\pi\sqrt{L/g}$? (Use $T/T_0 = 1/\mathrm{AGM}(1, \cos(\theta_0/2))$.)

✅ Concept check

Which statement about the pendulum separatrix $\dot\theta = \pm 2\sqrt{g/L}\cos(\theta/2)$ is correct?

✅ Concept checkselect all that apply

Select all true statements about the double pendulum of this lesson.

✅ Concept check

A pendulum is integrated for a very long time. Which behaviour of the energy error is expected for classical RK4 and velocity Verlet?

Problems

✏️ Pen & paperA half-metre pendulum●○○

A pendulum has L=0.5L = 0.5 m and g=9.81g = 9.81 m/s². Find its small-angle period and its period when released from rest at 90∘90^\circ and at 60∘60^\circ.

Show worked solution

T0=2π0.5/9.81=1.4185T_0 = 2\pi\sqrt{0.5/9.81} = 1.4185 s. At 90∘90^\circ, T/T0=1.1803T/T_0 = 1.1803, so T=1.6743T = 1.6743 s. At 60∘60^\circ, T/T0=1.0732T/T_0 = 1.0732, so T=1.5223T = 1.5223 s.

✏️ Pen & paperThe inverted pendulum●●○

Linearise about θ=π\theta = \pi for L=1L = 1 m, g=9.81g = 9.81 m/s². Find the eigenvalues, the ee-folding time of a small deviation, and the bottom speed needed to just reach the top.

Show worked solution

With θ=π+φ\theta = \pi + \varphi, φ¨=(g/L)φ\ddot\varphi = (g/L)\varphi, so λ=±g/L=±3.132 s−1\lambda = \pm\sqrt{g/L} = \pm 3.132\ \mathrm s^{-1} (a saddle) and the ee-folding time is 1/3.132=0.3191/3.132 = 0.319 s. Energy 12mv2=mg(2L)\tfrac12mv^2 = mg(2L) gives v=2gL=6.264v = 2\sqrt{gL} = 6.264 m/s, that is θ˙=2g/L\dot\theta = 2\sqrt{g/L}, the separatrix value at θ=0\theta = 0.

✏️ Pen & paperA bead on a rotating hoop●●●

A bead slides without friction on a vertical hoop of radius RR spinning about its vertical diameter at rate Ω\Omega. With θ\theta from the bottom, find L\mathcal L, the equation of motion and the equilibria. For R=0.5R = 0.5 m, Ω=8\Omega = 8 rad/s, g=9.81g = 9.81 m/s², find the non-trivial equilibrium angle.

Show worked solution

T=12mR2(θ˙2+Ω2sin⁡2θ)T = \tfrac12mR^2(\dot\theta^2 + \Omega^2\sin^2\theta) and V=−mgRcos⁡θV = -mgR\cos\theta, so L=T−V\mathcal L = T - V and Euler-Lagrange gives θ¨=sin⁡θ (Ω2cos⁡θ−g/R)\ddot\theta = \sin\theta\,\bigl(\Omega^2\cos\theta - g/R\bigr). Equilibria: sin⁡θ=0\sin\theta = 0, or cos⁡θ=g/(RΩ2)\cos\theta = g/(R\Omega^2), which exists only if Ω2>g/R\Omega^2 \gt g/R. Here g/(RΩ2)=0.3066g/(R\Omega^2) = 0.3066, so θ=72.1∘\theta = 72.1^\circ. As Ω\Omega passes g/R\sqrt{g/R} the bottom loses stability and two equilibria appear: a pitchfork (3.9 Bifurcations).

✏️ Pen & paperNormal modes of the double pendulum●●●

For m1=m2=l1=l2=g=1m_1 = m_2 = l_1 = l_2 = g = 1, linearise about the bottom and find the normal-mode frequencies and shapes.

Show worked solution

M=(2111)M = \begin{pmatrix}2 & 1\\ 1 & 1\end{pmatrix}, K=diag(2,1)K = \mathrm{diag}(2, 1). Then det⁡(K−λM)=2(1−λ)2−λ2=0\det(K - \lambda M) = 2(1 - \lambda)^2 - \lambda^2 = 0 gives 2(1−λ)=±λ\sqrt2(1 - \lambda) = \pm\lambda, so λ=2∓2=0.5858, 3.4142\lambda = 2 \mp \sqrt2 = 0.5858,\ 3.4142 and ω=0.7654, 1.8478\omega = 0.7654,\ 1.8478. The shapes satisfy v2=(2−2λ)v1/λv_2 = (2 - 2\lambda)v_1/\lambda: (1,2)(1, \sqrt2) for the slow mode (bobs swing together) and (1,−2)(1, -\sqrt2) for the fast one (against each other).

What comes next

The one nonlinear term, sin⁡θ\sin\theta, broke superposition and with it impedance. The next lesson, 14.4 Engineering Heat Transfer, is engineering heat transfer; the syllabus lists conduction, convection and radiation, Newton cooling, lumped capacitance and the Biot number, the cooling fin as a boundary-value problem, transient conduction in a slab, 2D steady conduction and a glimpse of heat exchangers. It builds on 9.3 Solving the Heat Equation: Separation of Variables and 10.4 Implicit Methods & Crank–Nicolson. Later, 14.7 N-Body Simulation returns to long integrations and energy.

Key Takeaways

  • θ¨+(g/L)sin⁡θ=0\ddot\theta + (g/L)\sin\theta = 0 is the harmonic oscillator with period 2πL/g2\pi\sqrt{L/g} only for small angles; the saddle at θ=π\theta = \pi has eigenvalues ±g/L\pm\sqrt{g/L}.
  • E=12θ˙2−cos⁡θE = \tfrac12\dot\theta^2 - \cos\theta: libration for E<1E \lt 1, rotation for E>1E \gt 1, the separatrix θ˙=±2cos⁡(θ/2)\dot\theta = \pm 2\cos(\theta/2) in between, reached only in infinite time.
  • T/T0=1/AGM(1,cos⁡(θ0/2))T/T_0 = 1/\mathrm{AGM}(1, \cos(\theta_0/2)): 1.01741.0174 at 30∘30^\circ, 1.18031.1803 at 90∘90^\circ, 1.37291.3729 at 120∘120^\circ, 3.90113.9011 at 179∘179^\circ, diverging logarithmically.
  • Driven damped (c=0.5c = 0.5, Ω=2/3\Omega = 2/3, from 11∘11^\circ): 1,2,41, 2, 4 strobe dots at A=1.35,1.44,1.465A = 1.35, 1.44, 1.465 and none repeating at 1.51.5; the result depends on the start.
  • L=T−V\mathcal L = T - V and the Euler-Lagrange equations give the pendulum and double-pendulum equations with a mass matrix M(θ)M(\theta) and no constraint forces.
  • Double pendulum from 120∘120^\circ, −10∘-10^\circ: twins 10−610^{-6} apart reach a gap of 11 at t=40.7t = 40.7 (RK4, h=0.005h = 0.005), λ≈0.3\lambda \approx 0.3; at ε=10−9\varepsilon = 10^{-9} the time is 66.466.4 (RK4) or 67.067.0 (DOP853).
  • RK4’s energy error grows linearly (−3.33×10−2-3.33\times10^{-2} at T=10 000T = 10\,000, h=0.2h = 0.2, 120∘120^\circ); velocity Verlet’s stays below 1.13×10−21.13\times10^{-2}, though neither fixes the phase.
  • Next: 14.4 Engineering Heat Transfer, mostly linear again.
Finished this lesson?

Mark it complete to track your progress (saved in this browser). Reading every section does this for you.