TExcelTAD
Home › Differential Equations › Chaos and the Lorenz System

Chaos and the Lorenz System

In three or more dimensions, a deterministic system with no randomness at all can behave so irregularly that long-term prediction is impossible. This is chaos. The first and most famous example came from a crude weather model studied by Edward Lorenz in 1963.

The Lorenz equations

x′=σ(y−x),y′=x(ρ−z)−y,z′=xy−βz,x' = \sigma(y - x), \qquad y' = x(\rho - z) - y, \qquad z' = xy - \beta z,

with the classic parameters σ=10\sigma = 10, ρ=28\rho = 28, β=83\beta = \frac{8}{3}. There are three critical points: the origin (a saddle) and C±=(±β(ρ−1),±β(ρ−1),ρ−1)C_\pm = \left(\pm\sqrt{\beta(\rho - 1)}, \pm\sqrt{\beta(\rho - 1)}, \rho - 1\right), which are unstable spirals for these parameters. Trajectories have nowhere stable to go, yet they stay bounded: they wander forever on the Lorenz attractor, looping around one spiral point, then the other, in an unpredictable sequence.

python · try it yourself
import numpy as np

s, r, b = 10.0, 28.0, 8 / 3
c = np.sqrt(b * (r - 1))
J = np.array([[-s, s, 0], [r - (r - 1), -1, -c], [c, c, -b]])     # Jacobian at C+ = (c, c, r - 1)
print("C+ =", np.round([c, c, r - 1], 4))
print("eigenvalues at C+:", np.round(np.linalg.eigvals(J), 4))
J0 = np.array([[-s, s, 0], [r, -1, 0], [0, 0, -b]])
print("eigenvalues at origin:", np.round(np.linalg.eigvals(J0), 4))
C+ = [ 8.4853  8.4853 27.    ]
eigenvalues at C+: [-13.8546 +0.j       0.094 +10.1945j   0.094 -10.1945j]
eigenvalues at origin: [-22.8277  11.8277  -2.6667]

The complex pair at C+C_+ has a positive real part: an unstable spiral.

Sensitive dependence on initial conditions

Start two solutions 10−910^{-9} apart. Their distance grows roughly like eλte^{\lambda t} with λ≈0.9\lambda \approx 0.9 (the largest Lyapunov exponent) until it is as large as the attractor itself:

python · try it yourself
import numpy as np
from scipy.integrate import solve_ivp

def lorenz(t, u, s=10.0, r=28.0, b=8 / 3):
    x, y, z = u
    return [s * (y - x), x * (r - z) - y, x * y - b * z]

t_eval = np.arange(0, 41, 5)
A = solve_ivp(lorenz, (0, 40), [1.0, 1.0, 1.0], t_eval=t_eval, rtol=1e-12, atol=1e-12).y
B = solve_ivp(lorenz, (0, 40), [1.0 + 1e-9, 1.0, 1.0], t_eval=t_eval, rtol=1e-12, atol=1e-12).y
for t, d in zip(t_eval, np.linalg.norm(A - B, axis=0)):
    print(f"t = {t:2d}: separation {d:.2e}")
t =  0: separation 1.00e-09
t =  5: separation 1.25e-09
t = 10: separation 1.76e-09
t = 15: separation 2.38e-08
t = 20: separation 9.26e-07
t = 25: separation 1.97e-04
t = 30: separation 2.12e-02
t = 35: separation 1.35e+00
t = 40: separation 3.65e+00

The separation grows by about a factor of 10 every 2.5 time units, then saturates. Each digit of precision in the initial condition buys only a few more time units of prediction. This is the "butterfly effect" and the fundamental reason weather forecasts degrade after a week or two.

What chaos is (and is not)

A chaotic system is

  1. deterministic: the same initial state always gives the same future;
  2. bounded: it does not fly off to infinity;
  3. sensitive: nearby states separate exponentially fast;
  4. aperiodic: it never settles into an equilibrium or a cycle.

Statistical properties are still predictable: the long-run fraction of time spent near each lobe, the average of zz, the shape of the attractor. Climate (statistics of weather) is more predictable than weather.

python · try it yourself
import numpy as np
from scipy.integrate import solve_ivp

lorenz = lambda t, u: [10 * (u[1] - u[0]), u[0] * (28 - u[2]) - u[1], u[0] * u[1] - 8 / 3 * u[2]]
for start in ([1, 1, 1], [-5, 3, 20]):
    sol = solve_ivp(lorenz, (0, 200), start, t_eval=np.linspace(20, 200, 90001), rtol=1e-9, atol=1e-9)
    print(f"start {start}: mean z = {sol.y[2].mean():.2f}, fraction of time with x > 0: {np.mean(sol.y[0] > 0):.2f}")
start [1, 1, 1]: mean z = 23.49, fraction of time with x > 0: 0.52
start [-5, 3, 20]: mean z = 23.70, fraction of time with x > 0: 0.44

The mean of zz agrees to within 1 % although the individual trajectories are completely different. The time split between the lobes is near one half in both runs, but such fractions converge slowly: the trajectory can linger on one lobe for many loops.

Numerical solutions of chaotic systems

Any numerical method makes small errors, and chaos amplifies them, so after a while the computed trajectory has nothing to do with the true one from the same start. Remarkably, it still stays close to some true trajectory (the shadowing property of many chaotic systems), so the statistics computed from simulations are meaningful.

In software

  • Weather and climate centres run ensembles: dozens of forecasts from slightly perturbed initial states, and report probabilities instead of a single answer.
  • Physics engines are chaotic for many-body interactions (stacks of boxes, billiards); deterministic lockstep multiplayer games therefore need bit-identical floating-point arithmetic on every machine, or the simulations diverge.
  • Chaotic maps have been used for pseudo-random number generation, but cryptographic generators rely on number theory instead.

Exercises

Exercise 1: Critical points

Show that for ρ<1\rho < 1 the origin is the only critical point of the Lorenz system.

Answer

C±C_\pm need β(ρ−1)≥0\beta(\rho - 1) \ge 0, which fails for ρ<1\rho < 1.

Solution

From x′=0x' = 0: y=xy = x. Then z′=0z' = 0 gives z=x2βz = \frac{x^2}{\beta}, and y′=0y' = 0 gives x(ρ−1−z)=0x(\rho - 1 - z) = 0. Either x=0x = 0, or x2=β(ρ−1)x^2 = \beta(\rho - 1), which has no real solution for ρ<1\rho < 1.

Exercise 2: Prediction horizon

If errors grow like e0.9te^{0.9t}, how much longer can you predict if you measure the initial state 1000 times more accurately?

Answer

About ln⁡10000.9≈7.7\frac{\ln 1000}{0.9} \approx 7.7 time units.

Solution

The time to reach a fixed error tolerance grows by ln⁡1000λ\frac{\ln 1000}{\lambda}: a thousandfold improvement in measurements buys a fixed, modest extension.

Exercise 3: Below the chaotic regime (code)

For ρ=14\rho = 14 (other parameters classic), where does the trajectory from (1,1,1)(1, 1, 1) end up?

Answer

At one of the critical points C±=(±104/3,±104/3,13)≈(±5.888,±5.888,13)C_\pm = (\pm\sqrt{104/3}, \pm\sqrt{104/3}, 13) \approx (\pm 5.888, \pm 5.888, 13), which are stable for this ρ\rho.

Solution
python · try it yourself
import numpy as np
from scipy.integrate import solve_ivp
f = lambda t, u: [10 * (u[1] - u[0]), u[0] * (14 - u[2]) - u[1], u[0] * u[1] - 8 / 3 * u[2]]
print(np.round(solve_ivp(f, (0, 100), [1, 1, 1], rtol=1e-10, atol=1e-12).y[:, -1], 4), round(np.sqrt(8 / 3 * 13), 4))
[ 5.8878  5.8878 13.    ] 5.8878

Test yourself

Chaos requires an autonomous system of at least…

  1. one dimension
  2. two dimensions
  3. three dimensions
  4. ten dimensions

Sensitive dependence on initial conditions means…

  1. the system is random
  2. nearby initial states separate exponentially fast
  3. solutions blow up
  4. the system has no equilibria

Which is still predictable for the Lorenz system?

  1. The exact state at t=1000t = 1000
  2. Long-run statistics such as the average of zz
  3. Nothing
  4. The order of lobe visits