The Physical Pendulum

From the small-angle harmonic approximation to the exact solution via Jacobi elliptic functions — with a live pendulum, phase portrait, and period divergence at the separatrix.

Functions: sn, cn, dn, K(m) Topics: Jacobi elliptic functions · nonlinear dynamics · phase portraits

Equation of motion

A pendulum of length $L$ and mass $m$ in gravity $g$ satisfies

$$\ddot\theta + \frac{g}{L}\sin\theta = 0.$$

For small angles $\theta \ll 1$ we replace $\sin\theta \approx \theta$, giving simple harmonic motion with period $T_0 = 2\pi\sqrt{L/g}$ — independent of amplitude. For large amplitudes this approximation breaks down badly, and the true period depends on the initial angle through a complete elliptic integral.

The exact solution is obtained from energy conservation. With $\dot\theta = 0$ at the maximum angle $\theta_0$, the energy equation gives

$$\frac{d\theta}{dt} = \pm\sqrt{\frac{2g}{L}(\cos\theta - \cos\theta_0)}.$$

Substituting $\sin(\theta/2) = k\sin\varphi$ where $k = \sin(\theta_0/2)$ transforms this into a standard elliptic integral of the first kind.

Exact period

The quarter-period — time from $\theta = 0$ to $\theta = \theta_0$ — equals

$$\frac{T}{4} = \sqrt{\frac{L}{g}}\int_0^{\pi/2}\frac{d\varphi}{\sqrt{1 - k^2\sin^2\varphi}} = \sqrt{\frac{L}{g}}\,K(k^2),$$

so the exact period is

$$\boxed{T = 4\sqrt{\frac{L}{g}}\,K(k^2), \quad k = \sin\!\left(\frac{\theta_0}{2}\right).}$$

Here $K(m) = \int_0^{\pi/2}(1 - m\sin^2\varphi)^{-1/2}\,d\varphi$ is the complete elliptic integral of the first kind. As $\theta_0 \to \pi$ (pendulum approaches vertical), $k \to 1$ and $K(k^2) \to \infty$ logarithmically — the period diverges.

The familiar small-angle result $T_0 = 2\pi\sqrt{L/g}$ is the limiting case $K(0) = \pi/2$, giving $T = 4\sqrt{L/g}\cdot\pi/2 = 2\pi\sqrt{L/g}$.

Fig. 1 — Period vs. amplitude. The exact period $T(\theta_0) = 4\sqrt{L/g}\,K(\sin^2(\theta_0/2))$ (blue) versus the small-angle approximation $T_0 = 2\pi\sqrt{L/g}$ (dashed grey). At $\theta_0 = 90°$ the error is already ~18%; at $\theta_0 = 170°$ the true period is $4\times$ larger. Hover to read off values.

Series expansion

Expanding $K(k^2)$ in powers of $k = \sin(\theta_0/2)$ gives the asymptotic series

$$T = T_0\left(1 + \frac{1}{16}\theta_0^2 + \frac{11}{3072}\theta_0^4 + \cdots\right), \quad \theta_0 \ll 1.$$

At $\theta_0 = 30°$ the first correction term is already sufficient; by $60°$ three terms are needed for 0.1% accuracy. Beyond $120°$ no finite truncation is adequate — you must evaluate $K(k^2)$ exactly.

θ₀K(k²)T / T₀ (exact)T / T₀ (small-angle)Error

Exact trajectory via Jacobi sn

The full time-domain solution uses the Jacobi elliptic function $\operatorname{sn}(u \mid m)$. Released from rest at $\theta_0$ (so $\dot\theta(0) = 0$), the exact angle is

$$\theta(t) = 2\arcsin\!\left(k\,\operatorname{sn}\!\left(K(k^2) - \sqrt{\frac{g}{L}}\,t\;\Big|\;k^2\right)\right), \quad k = \sin\!\left(\frac{\theta_0}{2}\right),$$

where $K(k^2)$ is the complete elliptic integral of the first kind. The angular velocity is

$$\dot\theta(t) = -2k\sqrt{\frac{g}{L}}\,\operatorname{cn}\!\left(K(k^2) - \sqrt{\frac{g}{L}}\,t\;\Big|\;k^2\right).$$

Initial conditions verified: $\operatorname{sn}(K \mid k^2) = 1$, so $\theta(0) = 2\arcsin k = \theta_0$ ✓; $\operatorname{cn}(K \mid k^2) = 0$, so $\dot\theta(0) = 0$ ✓. Small-angle limit: $k \to 0$, $K(0) = \pi/2$, $\operatorname{sn}(\pi/2 - \omega_0 t \mid 0) = \cos(\omega_0 t)$ → $\theta(t) \approx \theta_0\cos(\omega_0 t)$ ✓.

60°
1.0 m
Blue = exact elliptic  |  Grey dashed = small-angle SHO
Phase portrait $(\theta,\,\dot\theta)$ — dot moves in real time
Fig. 2 — Live pendulum. The blue pendulum uses the exact $\operatorname{sn}$ solution; the grey ghost uses the small-angle approximation. Drag the sliders to change amplitude or length. Watch the phase portrait close into a nearly circular orbit at small angles and bulge into an elongated elliptic curve at large angles.

Phase portrait and energy curves

Each orbit in the $(\theta, \dot\theta)$ plane is a level set of the conserved energy

$$E = \frac{1}{2}\dot\theta^2 - \frac{g}{L}\cos\theta = -\frac{g}{L}\cos\theta_0.$$

This gives the phase-portrait equation

$$\dot\theta = \pm\sqrt{\frac{2g}{L}(\cos\theta - \cos\theta_0)}.$$

The family of curves is parameterized by $k^2 = \sin^2(\theta_0/2) \in [0,1)$ for libration (bounded oscillation) and $k^2 > 1$ for rotation (full revolution). The boundary $k = 1$ is the separatrix, the heteroclinic orbit connecting the unstable equilibria at $\theta = \pm\pi$.

Fig. 3 — Complete phase portrait. Libration orbits (blue, $k < 1$) are closed; the separatrix (red, $k = 1$) divides libration from rotation orbits (green, $k > 1$). The equilibria at $(\theta, \dot\theta) = (0, 0)$ (stable) and $(\pm\pi, 0)$ (unstable saddle) are marked.

Jacobi elliptic functions

The three functions $\operatorname{sn}$, $\operatorname{cn}$, $\operatorname{dn}$ are defined via the amplitude $\varphi = \operatorname{am}(u \mid m)$ — the inverse of $F(\varphi \mid m)$:

$$\operatorname{sn}(u \mid m) = \sin\varphi, \quad \operatorname{cn}(u \mid m) = \cos\varphi, \quad \operatorname{dn}(u \mid m) = \sqrt{1 - m\sin^2\varphi}.$$

They satisfy the differential equations

$$\frac{d\,\operatorname{sn}}{du} = \operatorname{cn}\,\operatorname{dn}, \quad \frac{d\,\operatorname{cn}}{du} = -\operatorname{sn}\,\operatorname{dn}, \quad \frac{d\,\operatorname{dn}}{du} = -m\,\operatorname{sn}\,\operatorname{cn},$$

and the identities $\operatorname{sn}^2 + \operatorname{cn}^2 = 1$, $m\,\operatorname{sn}^2 + \operatorname{dn}^2 = 1$.

For the pendulum: $\operatorname{sn}$ gives $\theta(t)$, $\operatorname{cn}$ gives $\dot\theta(t)$, and $\operatorname{dn}$ gives the kinetic energy factor. The modulus $m = k^2$ controls the shape — from sinusoidal ($m = 0$) to hyperbolic ($m = 1$).

0.500
Fig. 4 — Jacobi elliptic functions vs. $u$. At $m = 0$: sn = sin, cn = cos (simple harmonic). At $m \to 1$: sn = tanh, cn = sech, dn = sech (separatrix, infinite period). The quarter-period $K(m)$ is the first zero of cn and first maximum of sn.

The separatrix and period divergence

As $\theta_0 \to \pi^-$ (pendulum released just below vertical), $k \to 1$ and the period diverges logarithmically:

$$K(k^2) \;\underset{k\to 1}{\sim}\; \ln\!\frac{4}{\sqrt{1-k^2}} \;=\; \ln\!\frac{4}{\cos(\theta_0/2)}.$$

Physically: near the inverted equilibrium the restoring force vanishes and the pendulum lingers indefinitely. This is the separatrix in the phase portrait — the boundary between oscillation and rotation. The exact form at $k = 1$ is the heteroclinic orbit

$$\theta(t) = 4\arctan\!\left(e^{\sqrt{g/L}\,t}\right) - \pi, \quad \dot\theta = 2\sqrt{\frac{g}{L}}\operatorname{sech}\!\left(\sqrt{\frac{g}{L}}\,t\right).$$
Fig. 5 — Period divergence near the separatrix. Log-linear plot of $T/T_0$ vs. $180° - \theta_0$. The dashed line shows the logarithmic approximation $T \approx \frac{4}{\pi}\sqrt{L/g}\ln(8/\varepsilon)$ where $\varepsilon = \pi - \theta_0$. At 1° from vertical, $T/T_0 \approx 5.2$.

The physical (compound) pendulum

A real pendulum is not a point mass on a massless rod. For an extended rigid body pivoting about a fixed axis, the equation of motion is

$$I\ddot\theta + mgd\sin\theta = 0,$$

where $I$ is the moment of inertia about the pivot and $d$ is the distance from the pivot to the centre of mass. Defining the equivalent length $L_\text{eq} = I/(md)$, this is identical to the mathematical pendulum with $L \to L_\text{eq}$. The exact period is therefore

$$T = 4\sqrt{\frac{I}{mgd}}\,K(k^2), \quad k = \sin\!\left(\frac{\theta_0}{2}\right).$$

The equivalent length is always $\geq$ the distance $d$ (by the parallel-axis theorem), so the physical pendulum is always slower than a simple pendulum of length $d$.

Common shapes

ShapePivot$I$$d$$L_\text{eq} = I/(md)$
Point mass on rod (length $L$)End$mL^2$$L$$L$
Uniform rod (length $L$)End$\tfrac{1}{3}mL^2$$L/2$$\tfrac{2}{3}L$
Uniform rod (length $L$)$L/4$ from end$\tfrac{7}{48}mL^2$$L/4$$\tfrac{7}{12}L$
Solid disk (radius $R$)Edge$\tfrac{3}{2}mR^2$$R$$\tfrac{3}{2}R$
Hollow ring (radius $R$)Edge$2mR^2$$R$$2R$
60°
Fig. 6 — Physical pendulum comparison. Exact $\theta(t)$ for the mathematical pendulum (blue), the selected physical pendulum shape (orange), and the small-angle approximation (dashed). The physical pendulum has a longer period due to $L_\text{eq} > L$.

Summary

The pendulum is the canonical example of a nonlinear oscillator whose exact solution requires elliptic functions. The small-angle approximation $\sin\theta \approx \theta$ discards all elliptic structure; the exact solution restores it through $K(k^2)$ for the period and $\operatorname{sn}(u|k^2)$ for the trajectory.
QuantitySmall-angleExact (elliptic)
Period $T$$2\pi\sqrt{L/g}$$4\sqrt{L/g}\,K(k^2)$
Trajectory $\theta(t)$$\theta_0\cos(\omega_0 t)$$2\arcsin\!\left(k\operatorname{sn}(K(k^2){-}\omega_0 t\mid k^2)\right)$
Angular velocity $\dot\theta(t)$$-\theta_0\omega_0\sin(\omega_0 t)$$-2k\omega_0\operatorname{cn}(K(k^2){-}\omega_0 t\mid k^2)$
At separatrix ($\theta_0\to\pi$)Breaks down$\theta(t) = 4\arctan(e^{\omega_0 t}) - \pi$
Valid for$\theta_0 \lesssim 15°$ (<1% error)All $\theta_0 \in (0°, 180°)$

Code

Using the elliptic-functions Python package:

import numpy as np, elliptic

g, L, theta0 = 9.81, 1.0, 2.5          # near separatrix: 143°
k  = np.sin(theta0 / 2)
K  = float(elliptic.cel1(np.sqrt(1 - k**2)))   # K(k²)
T  = 4 * K * np.sqrt(L / g)            # exact period

t  = np.linspace(0, T, 500)
sn, cn, dn, _ = elliptic.ellipj(K - t * np.sqrt(g / L), k**2)
theta     = 2 * np.arcsin(k * np.asarray(sn))
theta_dot = -2 * k * np.sqrt(g / L) * np.asarray(cn)

In MATLAB/Octave:

g = 9.81; L = 1.0; theta0 = 2.5;
k  = sin(theta0/2);
K  = cel1(sqrt(1 - k^2));              % K(k²)
T  = 4 * K * sqrt(L/g);

t  = linspace(0, T, 500);
[sn, cn] = ellipj(K - t * sqrt(g/L), k^2);
theta     = 2 * asin(k * sn);
theta_dot = -2 * k * sqrt(g/L) * cn;