---
title: Nonlinear oscillations and phase space
heading: Large swings, stiffening springs, and pictures of motion in position and velocity
eyebrow: B1 · Lesson 41 · Nonlinear oscillations
xp: 40
---

::: hook
Simple harmonic motion (lesson 40) has a period that doesn't depend on amplitude. That's only true for small swings: a pendulum released from 90° takes 18% longer per swing than one released from 10°, and one released near the top takes far longer still. Real springs stiffen or soften as they stretch, crystals and MEMS resonators drift in frequency with drive level, and every oscillator that isn't perfectly linear creates harmonics. **Phase space**, a plot of velocity against position, shows all of this at a glance.
:::

::: play
- Each closed curve is a pendulum's motion in phase space (angle against angular velocity) at one energy. Small swings trace near-ellipses, the shape of simple harmonic motion.
- Raise the release angle: the curve stretches toward ±180°, and its shape gets pointed at the ends. The readout gives the period relative to a small swing.
- At 180° the curve meets the **separatrix**, which divides swinging back and forth from going over the top. Near it, the period grows without limit.
:::

```sim plot
view: flow
x: q = -3.2..3.2
y: w = -2.2..2.2
slider: t = 10..175 step 1 = 90
dx: w
dy: -sin(q)
start: t*pi/180, 0
start: 3.1, 0.05
grid: 16
readout: period over the small-swing period = 1/((((1 + cos(t*pi/360))/2 + sqrt(cos(t*pi/360)))/2 + sqrt((1 + cos(t*pi/360))/2*sqrt(cos(t*pi/360))))/2) | digits: 3
```

::: predict
## A 1 m pendulum is released from 60° instead of 5°. How much longer is its period?

- [ ] The same: pendulum periods don't depend on amplitude
- [x] About 7% longer
- [ ] About 50% longer
- [ ] Twice as long

::: reveal
About 7% longer: 2.154 s against 2.007 s. The restoring torque goes as $\sin\theta$, which grows more slowly than θ, so at large angles the pull back is weaker than simple harmonic motion assumes and the swing takes longer. The independence of period from amplitude, which made pendulum clocks possible, is a small-angle approximation.
:::
:::

::: nameit
## Phase space

Plot velocity against position. Each state is a point, and the motion traces a curve. For an undamped system with energy $E = \frac12mv^2 + U(x)$, the curves are the level sets of E: ellipses for a linear spring, closed loops around each minimum of U, and open curves where there's enough energy to escape. Damping makes the curves spiral inward.

## The large-amplitude pendulum

The exact period, released from rest at $\theta_0$, is

$$T = 4\sqrt{\frac Lg}\,K\!\left(\sin\frac{\theta_0}{2}\right), \qquad T \approx T_0\left(1 + \frac{\theta_0^2}{16} + \frac{11\theta_0^4}{3072}\right),$$

with K the complete elliptic integral of the first kind (computable with the arithmetic–geometric mean: $K(k) = \frac{\pi}{2\,\text{AGM}(1, \sqrt{1 - k^2})}$). The factor is 1.017 at 30°, 1.073 at 60°, 1.180 at 90° and 2.44 at 170°. The **separatrix**, released from just below the top, reaches the bottom at $2\sqrt{gL}$.

## Stiffening and softening

A spring with force $-kx - m\beta x^3$ (Duffing) has a frequency that depends on amplitude A: $\omega \approx \omega_0\left(1 + \frac{3\beta A^2}{8\omega_0^2}\right)$. β > 0 stiffens (frequency rises with amplitude), β < 0 softens. Driven near resonance, such oscillators can jump between two amplitudes, which limits how hard MEMS resonators can be driven.

## Harmonics

A nonlinear restoring force distorts the motion from a pure sine, adding harmonics at 3ω (for symmetric nonlinearities like the pendulum's) and 2ω (for asymmetric ones). That's the same mechanism that produces distortion in amplifiers.
:::

::: example
## Find the period of a 1 m pendulum released from 60°, exactly and from the series.

::: solution
1. **Modulus.**
   $$\begin{aligned} k &= \sin 30° \\ &= 0.5 \end{aligned}$$
2. **Complete elliptic integral.** With $\text{AGM}(1, \sqrt{0.75}) = 0.9318$,
   $$\begin{aligned} K &= \frac{\pi}{2 \times 0.9318} \\ &= 1.6858 \end{aligned}$$
   and the factor is $\frac{2K}{\pi} = 1.0732$.
3. **Exact period.** With $T_0 = 2\pi\sqrt{1/9.8} = 2.007$ s,
   $$\begin{aligned} T &= 2.007 \times 1.0732 \\ &= 2.154\ \text{s} \end{aligned}$$
4. **From the series.**
   $$\begin{aligned} &1 + \frac{(\pi/3)^2}{16} + \frac{11(\pi/3)^4}{3072} \\ &= 1.0728 \end{aligned}$$
   within 0.03%.
5. **Where the series fails.** At 90° the series' error grows to 0.4%, and near 180° it fails badly, since the true period diverges there.

**Answer:** the period is 2.154 s; the series gives a factor of 1.0728, within 0.03% of the exact 1.0732.
:::
:::

::: example
## How fast must a 1 m pendulum be moving at the bottom to just reach the top?

::: solution
1. **Energy to reach the top.** It must climb $2L = 2$ m, so
   $$\frac12v^2 = g \cdot 2L$$
2. **Speed.**
   $$\begin{aligned} v &= 2\sqrt{gL} \\ &= 6.26\ \text{m/s} \end{aligned}$$
   That's the separatrix in phase space.
3. **Either side of it.** Slightly slower and it swings back with a very long period, lingering near the top; slightly faster and it goes over and keeps rotating. The two motions are separated by a single curve, and small disturbances near it decide which happens.

**Answer:** it must be moving at 6.26 m/s at the bottom.
:::
:::

::: example
## A 1 kg mass on a 100 N/m spring has a stiffening term with β = 10⁴ m⁻²s⁻². How much does its frequency rise at an amplitude of 5 cm?

::: solution
1. **Natural frequency.** $\omega_0 = 10$ rad/s.
2. **Relative shift.**
   $$\begin{aligned} \frac{3\beta A^2}{8\omega_0^2} &= \frac{3 \times 10^4 \times 0.0025}{8 \times 100} \\ &= 0.094 \end{aligned}$$
   so about 9.4% higher, at 10.9 rad/s.
3. **Smaller amplitudes.** At 1 cm the shift would be 0.4%, at 1 mm only 0.004%.
4. **Why drive level matters.** For precision resonators that's why drive level matters: a quartz crystal's frequency drifts with how hard it's driven, and oscillator circuits limit the amplitude to keep it stable.

**Answer:** the frequency rises about 9.4%, to 10.9 rad/s.
:::
:::

::: check
given: t = 20 | 40 | 60
answer: 1 + (t*pi/180)^2/16 + 11*(t*pi/180)^4/3072
tolerance: 0.2%

## By what factor is a pendulum's period longer than the small-swing period when released from {t}°? (Use the two-term series.)

::: right
Right. $1 + \frac{\theta_0^2}{16} + \frac{11\theta_0^4}{3072}$, with $\theta_0$ in radians.
:::

::: misses
- [1 + t^2/16] Convert the angle to radians first.
- [any] Use radians in the series.
:::
:::

::: check
kind: parts
given: L = 0.5 | 2; t = 30 | 60

## A pendulum {L} m long is released from {t}°.

::: part
answer: 2*pi*sqrt(L/9.8)
unit: s
tolerance: 0.5%

### What is its small-swing period?

::: misses
- [any] $2\pi\sqrt{L/g}$.
:::
:::

::: part
answer: 2*pi*sqrt(L/9.8)*(1 + (t*pi/180)^2/16 + 11*(t*pi/180)^4/3072)
unit: s
tolerance: 0.2%

### What is its actual period?

::: misses
- [any] Multiply by the amplitude factor.
:::
:::
:::

::: check
given: L = 0.5 | 1 | 3
answer: 2*sqrt(9.8*L)
unit: m/s
tolerance: 0.5%

## How fast must a pendulum {L} m long move at the bottom to just reach the top?

::: right
Right. $2\sqrt{gL}$: the separatrix.
:::

::: misses
- [sqrt(2*9.8*L)] It must climb 2L, the full diameter.
- [any] $\frac12v^2 = 2gL$.
:::
:::

::: check
given: w = 10 | 100; b = 10000 | 1000000; A = 0.01 | 0.05
answer: 3*b*A^2/(8*w^2)*100
unit: %
tolerance: 0.5%

## A Duffing oscillator has $\omega_0$ = {w} rad/s and β = {b} m⁻²s⁻². By what percentage does its frequency rise at amplitude {A} m?

::: right
Right. $\frac{3\beta A^2}{8\omega_0^2}$, growing as the square of the amplitude.
:::

::: misses
- [b*A^2/(w^2)*100] Include the factor $\frac38$.
- [any] $\frac{3\beta A^2}{8\omega_0^2}$.
:::
:::

::: check
kind: parts
given: k = 50 | 200; m = 0.5 | 2; A = 0.05 | 0.1

## A {m} kg mass on a {k} N/m spring oscillates with amplitude {A} m.

::: part
answer: A*sqrt(k/m)
unit: m/s
tolerance: 0.5%

### What is the largest velocity on its phase-space ellipse?

::: misses
- [any] $A\omega$.
:::
:::

::: part
answer: sqrt(k/m)*sqrt(A^2 - (A/2)^2)
unit: m/s
tolerance: 0.5%

### What is the speed when it's halfway out, at x = A/2?

::: misses
- [A*sqrt(k/m)/2] Speed and position aren't linear on an ellipse: $v = \omega\sqrt{A^2 - x^2}$.
- [any] $\omega\sqrt{A^2 - x^2}$.
:::
:::
:::

::: check
kind: choice

## Which harmonics does a pendulum's large-amplitude motion contain?

- [ ] Only the fundamental
- [x] Odd harmonics, 3ω, 5ω, …, because its restoring force is symmetric
- [ ] Even harmonics only
- [ ] All harmonics equally

::: right
Right. $\sin\theta$ is odd in θ, so the distortion it creates is symmetric, which allows only odd harmonics.
:::

::: misses
- [1] At large amplitude the motion isn't a pure sine.
- [3] Even harmonics need an asymmetric force, like a spring stiffer in compression than in tension.
- [4] Symmetry forbids the even ones.
:::
:::

::: check
kind: derivation
vars: w = 1..10, A = 0.1..2, x = -0.1..0.1

## Simple harmonic motion in phase space, with angular frequency ω (write w) and amplitude A.

::: step
answer: w*sqrt(A^2 - x^2)

### What speed does it have at position x?
:::

::: step
answer: w*A

### What is the semi-axis of its ellipse along the velocity direction?
:::

::: right
Right. The ellipse has semi-axes A and ωA; scaling velocity by $\frac1\omega$ makes it a circle.
:::
:::

::: check
kind: python

## Write `period_factor(theta0)` that returns a pendulum's exact period divided by its small-swing period, for a release angle in radians, using $\frac{T}{T_0} = \frac{1}{\text{AGM}\left(1, \cos\frac{\theta_0}{2}\right)}$. Iterate the arithmetic–geometric mean until its two terms agree to $10^{-15}$.

```python starter
import math

def period_factor(theta0):
    return 1 + theta0**2 / 16

print(period_factor(math.pi / 3))
```

```python solution
import math

def period_factor(theta0):
    a, b = 1.0, math.cos(theta0 / 2)
    while abs(a - b) > 1e-15:
        a, b = (a + b) / 2, math.sqrt(a * b)
    return 1 / a

print(period_factor(math.pi / 3))
```

```python tests
import math
for deg, want in ((60, 1.0731820), (90, 1.1803406), (170, 2.4393627)):
    got = period_factor(math.radians(deg))
    assert abs(got - want) < 1e-6, f"At {deg}° the factor is {want}; got {got:.7f}."
th = math.radians(5)
assert abs(period_factor(th) - (1 + th**2 / 16 + 11 * th**4 / 3072)) < 1e-9, "At small angles the AGM matches the series."
```

::: right
Right. The AGM converges quadratically, doubling its correct digits each step, so even at 170° a handful of iterations reaches full precision.
:::
:::

::: explain
## Why does a pendulum take longer to swing at large amplitude?

::: model
A pendulum's restoring torque is proportional to $\sin\theta$, not θ. For small angles the two are nearly equal and the motion is simple harmonic, with a period independent of amplitude. At larger angles $\sin\theta$ falls below θ, so the pull back toward the bottom is weaker than the linear model predicts, the pendulum lingers near the ends of its swing, and each cycle takes longer. Near 180° the restoring torque almost vanishes at the top, so a pendulum released there hangs nearly balanced for a very long time, and the period grows without limit as the release angle approaches the top.
:::
:::

::: practice

::: check
given: t = 5 | 10 | 15 | 20 | 30 | 45 | 50
answer: 1 + (t*pi/180)^2/16 + 11*(t*pi/180)^4/3072
tolerance: 0.2%

## Period factor at {t}°?

::: misses
- [any] $1 + \frac{\theta_0^2}{16} + \frac{11\theta_0^4}{3072}$.
:::
:::

::: check
given: L = 0.2 | 0.5 | 1 | 2 | 3 | 5
answer: 2*sqrt(9.8*L)
unit: m/s
tolerance: 0.5%

## Separatrix speed for a {L} m pendulum?

::: misses
- [any] $2\sqrt{gL}$.
:::
:::
:::
