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
with the classic parameters , , . There are three critical points: the origin (a saddle) and , 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.
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 has a positive real part: an unstable spiral.
Sensitive dependence on initial conditions
Start two solutions apart. Their distance grows roughly like with (the largest Lyapunov exponent) until it is as large as the attractor itself:
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
- deterministic: the same initial state always gives the same future;
- bounded: it does not fly off to infinity;
- sensitive: nearby states separate exponentially fast;
- 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 , the shape of the attractor. Climate (statistics of weather) is more predictable than weather.
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 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 the origin is the only critical point of the Lorenz system.
Answer
need , which fails for .
Solution
From : . Then gives , and gives . Either , or , which has no real solution for .
Exercise 2: Prediction horizon
If errors grow like , how much longer can you predict if you measure the initial state 1000 times more accurately?
Answer
About time units.
Solution
The time to reach a fixed error tolerance grows by : a thousandfold improvement in measurements buys a fixed, modest extension.
Exercise 3: Below the chaotic regime (code)
For (other parameters classic), where does the trajectory from end up?
Answer
At one of the critical points , which are stable for this .
Solution
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…
- one dimension
- two dimensions
- three dimensions
- ten dimensions
Sensitive dependence on initial conditions means…
- the system is random
- nearby initial states separate exponentially fast
- solutions blow up
- the system has no equilibria
Which is still predictable for the Lorenz system?
- The exact state at
- Long-run statistics such as the average of
- Nothing
- The order of lobe visits