Learning Objectives
By the end of this section you will be able to:
- Write down the three Lorenz equations and explain what each term models physically (Prandtl convection in a two-dimensional atmospheric slab).
- Find the three fixed points and classify their stability as is varied.
- Demonstrate sensitive dependence on initial conditions and read the predictability horizon directly off a log-separation plot.
- Integrate the system with explicit fourth-order Runge–Kutta in Python, and reproduce the same trajectory with PyTorch while differentiating through the integrator.
- Estimate the largest Lyapunov exponent from a single simulation and connect it to a predictability time scale .
The Question Lorenz Was Asking
"Predictability: Does the flap of a butterfly's wings in Brazil set off a tornado in Texas?" — Edward Lorenz, AAAS 1972.
Edward Lorenz was a meteorologist at MIT in 1961 running a simple numerical weather model on an LGP-30. To save time he restarted a simulation from the middle, typing the printed state instead of the full internal precision . The new run agreed with the old one for a short while, then diverged completely. The difference of three parts per thousand had erased the future.
This was not a numerical bug. Lorenz had stumbled into a feature of deterministic non-linear systems that nobody had named yet: sensitive dependence on initial conditions. Two years later he distilled the issue into the three coupled ODEs we are about to study — a system simple enough to fit on a napkin yet rich enough to break every classical notion of long-range predictability.
What problem are we actually solving?
The Three Equations
Lorenz simplified a Boussinesq fluid-convection model down to three Fourier modes. Calling them (no longer physical coordinates — they are mode amplitudes) gives the Lorenz system:
The three parameters are dimensionless ratios pinned down by the physics:
| Parameter | Meaning | Lorenz's value |
|---|---|---|
| σ (sigma) | Prandtl number — viscosity / thermal diffusivity | 10 |
| ρ (rho) | Rayleigh number / critical Rayleigh — drives convection | 28 |
| β (beta) | Geometry of the convection cell (aspect ratio) | 8/3 ≈ 2.667 |
Three things to notice in the equations themselves:
- The system is autonomous. Time appears only through the derivatives — the right-hand side depends only on the current state .
- It is non-linear. The terms in and in are products of state variables — there is no way to decouple them with a linear change of basis.
- It is dissipative. The divergence of the velocity field is . Volumes in phase space shrink at a constant rate — yet the trajectory is bounded, so the limit set has zero volume but non-zero fractal dimension (≈ 2.06).
Fixed Points and Their Stability
The fixed points are the simultaneous zeros of the three right-hand sides. From we get . Substituting into gives , and then yields . Two branches emerge:
- Origin , valid for every .
- Convection pair , valid only when .
For Lorenz's canonical values , the Jacobian
evaluated at each fixed point has the following eigenvalue structure:
| Fixed point | Eigenvalues at ρ = 28 | Verdict |
|---|---|---|
| P₀ = (0,0,0) | −22.83, +11.83, −2.67 | Saddle (one unstable direction) |
| C₊, C₋ | −13.85, +0.094 ± 10.19 i | Saddle-focus (spiral OUT slowly along a 2-D unstable manifold) |
Every fixed point is unstable. The trajectory cannot settle anywhere. Instead it spirals out from , gets flung past the saddle near the origin, captured by , spirals out there, gets flung back — forever. The two lobes of the butterfly are the slow-manifold signatures of the two complex-conjugate eigenvalue pairs.
Sensitive Dependence: The Butterfly Effect
Take two initial conditions that differ by a tiny vector . For a generic chaotic system the separation grows like
where is the largest Lyapunov exponent. For the standard Lorenz parameters numerical experiments give . So even a microscopic perturbation of size grows to order 1 in
Past the two trajectories are effectively independent samples from the same attractor: a forecast is useless. This is the precise mathematical content of the butterfly metaphor.
Interactive 3D Attractor
Two trails are integrated live in your browser with the SAME RK4 algorithm the rest of this section uses. They start apart in the coordinate. Drag the sliders to leave the chaotic regime and come back; drag the canvas to rotate.
A few experiments worth running before you read on:
- Set . The origin is now globally attracting — both trails collapse to a single point and stay there. The system is stable. Boring. Predictable.
- Set . The trails wind into one of the two convection points and stop. Two basins of attraction; deterministic but no chaos.
- Crank back to 28. The trails now weave the butterfly pattern, visibly diverge after a few seconds, and end up on different lobes.
- Push . The chaotic regime breaks down into long periodic windows interlaced with bursts of chaos — a phenomenon called intermittency.
Worked Example — One RK4 Step by Hand
The simulator above runs thousands of RK4 steps per second. To make absolutely sure you can see how the system advances even by a single step, work the following micro-example by hand.
Click to expand — one RK4 step at t = 0 with state (1, 1, 1), step size h = 0.005, σ = 10, ρ = 28, β = 8/3
Step 0 — evaluate the RHS at the current state. With :
k1.y = x(ρ − z) − y = 1·(28 − 1) − 1 = 26
k1.z = x·y − β·z = 1·1 − (8/3)·1 ≈ −1.667
Step 1 — half-step using k1, then re-evaluate. New point: :
k2.y = 1·(28 − 0.9958) − 1.065 = 25.94
k2.z = 1·1.065 − (8/3)·0.9958 ≈ −1.591
Step 2 — half-step using k2. New point: :
k3.y ≈ 25.91
k3.z ≈ −1.591
Step 3 — full step using k3. New point :
k4.y ≈ 25.83
k4.z ≈ −1.513
Step 4 — Simpson average. :
Δy = 0.005/6 · (26 + 51.88 + 51.82 + 25.83) = 0.1296
Δz = 0.005/6 · (−1.667 − 3.182 − 3.182 − 1.513) = −0.00795
Result: new state at is . Compare this against the traj[1] row in the Python trace below — the numbers match to all five digits.
Why this matters. A single RK4 step has accuracy per step, but you need 8000 steps to reach — and the chaotic dynamics amplifies any error at rate . After about the numerical and exact trajectories disagree at order 1, which is why double-precision Lorenz simulations are accurate statistically, not pointwise.
Lyapunov Exponent and Predictability Horizon
The Lyapunov exponent is the average exponential growth rate of an infinitesimal perturbation:
In practice we estimate it by integrating two nearby trajectories and fitting a straight line to over the window where the separation is small enough that the linearised dynamics still apply.
Given and an initial measurement precision , the time until the perturbation grows to a tolerable bound is
Improving the initial measurement by a factor of only buys you extra seconds of predictability. Improving it by a factor of only buys you seconds. This is the iron law of chaotic forecasting.
Sensitivity Visualizer
Drag the slider to shrink the initial offset all the way down to . Watch the log-separation plot on the right: the curve always grows linearly with the same slope — only its starting height shifts. That slope IS the Lyapunov exponent.
The left panel shows the actual signals of the two trajectories. They are visually indistinguishable for a while, then disagree on which lobe of the butterfly they are on, then independently wander. The red dashed line marks the predictability horizon where the separation first exceeds 1 — the point past which an averaged forecast is the best you can do.
Python: Integrating the Lorenz System with RK4
Below is the entire engine that drove the 3D viewer above — pure NumPy, around 30 lines. Click any line to see what is in memory at that point.
The single line that produced the headline number is slope, _ = np.polyfit(t[mask], np.log(sep[mask]), 1). Everything else is bookkeeping. The lesson is that Lyapunov exponents are not exotic theoretical objects; they are simple linear regressions performed on a log-transformed diagnostic from a single forward simulation.
PyTorch: Autodiff Through Chaos
The same RK4 routine rewritten in PyTorch buys us something NumPy cannot: gradients of the trajectory with respect to the system parameters, computed by automatic differentiation through every single step.
Why would you want this? Because the inverse problem — given an observed time series, what are the underlying parameters? — is exactly a gradient-descent problem on a loss like . Backpropagating through the integrator is how modern data assimilation systems learn parameters of climate, neural, and epidemiological models.
torchdiffeq, which uses the adjoint method to compute gradients in constant memory at the cost of one extra backward solve.Where Chaos Shows Up in the Real World
Once you can recognise the Lorenz signature — bounded, non-periodic, sensitive to initial conditions — you start to see it everywhere:
| Domain | Chaotic system | Practical consequence |
|---|---|---|
| Weather & climate | Atmospheric circulation, ENSO | Forecast skill caps out at ~10 days; ensemble forecasting is mandatory |
| Heart & brain | Cardiac arrhythmias, EEG bursts | Defibrillation timing, seizure prediction |
| Fluid dynamics | Turbulent mixing, Rayleigh-Bénard convection | Direct numerical simulation must resolve every Kolmogorov scale |
| Plasma physics | Tokamak edge turbulence | Confinement-time prediction relies on Lyapunov-spectrum methods |
| Population biology | Logistic map, predator-prey with seasonality | Some species crashes are deterministic chaos, not random shocks |
| Engineering | Buckling beams, Duffing oscillators | Robust control design must remain stable on chaotic attractors |
| ML training | Loss landscape near sharp minima | Sensitivity to seed → reproducibility crisis; SGD as Lyapunov-bounded random walk |
The deepest take-away is statistical predictability replacing pointwise prediction. We cannot say where the trajectory will be at , but we can compute the density of where many trajectories land — the SRB measure of the attractor. Most modern climate science lives in this statistical regime.
Common Pitfalls
- Trusting pointwise values past the horizon. Anything you print at from a single Lorenz simulation is essentially a random sample from the attractor, not a deterministic answer.
- Using forward Euler. Euler is and energy-non-conserving on oscillatory pieces. It will produce a trajectory that drifts off the attractor within a few seconds even at . Always use RK4 or higher.
- Mistaking transients for the attractor. The first 5 seconds of any simulation depend strongly on the initial state. Discard the first time units before computing statistics.
- Fitting over the saturation window. Once reaches the attractor diameter, exponential growth STOPS — the slope of goes to zero. Only fit the linear-growth window.
- Comparing trajectories in single precision. float32 round-off introduces perturbations near at every step. For chaos studies always use float64.
Summary
Lorenz's three equations look harmless. Their behaviour is anything but.
- Deterministic chaos exists. A continuous, autonomous, three-dimensional ODE can produce trajectories that never repeat and are exponentially sensitive to initial conditions.
- The Lyapunov exponent sets a hard limit on predictability. Time horizons grow only logarithmically in initial-condition precision.
- The attractor is a fractal of dimension ≈ 2.06. Zero volume, non-zero structure, infinitely intricate.
- RK4 is the right tool. It gives you trajectories that are statistically faithful — exactly the resolution chaos permits.
- Modern computation re-opens the inverse problem. Autodiff through the integrator turns parameter inference into a gradient-descent exercise on a chaotic flow.
Final picture. The Lorenz attractor is the bridge between two cultures: the classical, equation-driven world of Newton and the modern, simulation-driven world of climate models and differentiable physics. Calculus gave us the equations. Computation gave us the courage to take them seriously.