Lorenz Attractor Simulator

Drag to rotate a live RK4 solution of the Lorenz equations. Two runs that start a billionth apart look like one line until about t = 20 and are a full unit apart at t = 23.8 — this page measures how fast that happens, and what extra precision buys you.

1.0
1e-9
30

Drag to rotate · scroll or pinch to zoom. Changing σ, ρ or β acts on the running trajectories immediately; Restart begins again from the start point. With many trajectories each trail is shortened automatically so the page stays smooth.

Model time t0.00
Largest Lyapunov exponent λ—
Twin runs reach distance 1.0 at—
ln(1/δ) / λ predicts—
Slope of one run (the article’s fit)—
Start point—
Fixed points C±—
Stability of the fixed points—

Distance between the run from the start point and its twin started δ further along x, on a log scale, for the first 50 time units. A straight stretch is exponential growth; the grey dashed line has slope λ. The red mark is where the distance first exceeds 1.0, the threshold the article used.

x(t), y(t) and z(t) for the same two runs (blue: from the start point, orange: the twin). Dashed lines mark the fixed points C±: the sign of x tells you which wing the orbit is circling. The thin grey line follows the animation.

What the Lorenz attractor is

In 1963 Edward Lorenz cut a model of convection down to three variables and three equations:

dx/dt = σ(y − x), dy/dt = x(ρ − z) − y, dz/dt = xy − βz

Roughly, x is the strength of the rolling motion, y the temperature difference between rising and falling fluid, and z how far the vertical temperature profile is from a straight line. σ is the Prandtl number, ρ measures how hard the layer is heated, and β is a geometric factor. With his values — σ = 10, ρ = 28, β = 8/3 — the solution never settles and never repeats: it loops around one of two centres, switches to the other at irregular moments, and stays inside a bounded region forever. That set is the attractor, and its two lobes are the butterfly people print on posters.

There is no randomness anywhere in the equations. Everything this page draws is a deterministic calculation, which is exactly what makes the butterfly effect surprising.

How to use the simulator

The butterfly effect, measured

The Japanese write-up this tool comes from started two runs whose x differed by 10⁻⁹ and recorded the distance between them. With the classic parameters the article measured 0.00000026 at t = 5, 0.000035 at t = 10, 0.0025 at t = 15 and 0.027 at t = 20, and the distance first passed 1.0 at t = 23.8. On a log scale that is close to a straight line: exponential growth. For most of that time the two runs are drawn on top of each other and look like one line; then, quite suddenly, they are on different wings.

Press Two runs 10⁻⁹ apart to repeat it. The preset uses the article’s published setup — dt = 0.002, a start obtained by running (1, 1, 20) for 40 time units, and the offset added to x — and the integrator does the arithmetic in the same order as the article’s NumPy code, so the result is not just similar: the twin runs pass 1.0 at t = 23.84 (23.8 in the article) and the distances at t = 5, 10, 15, 20 round to the article’s table. Other start points give other times — four start points in this page’s check script gave 23.84, 20.13, 25.97 and 21.58 — so press New start point a few times to see how much it varies.

The Lyapunov exponent: one run is not enough

The growth rate of that distance is the largest Lyapunov exponent λ. The commonly quoted value for σ = 10, ρ = 28, β = 8/3 is about 0.9056; the article cites 0.906. Fitting a straight line to the single run above gave the article only 0.760, about 16% low. The stretching rate depends on where on the attractor the pair happens to be, and one run of 24 time units samples too few places.

The fix is Benettin’s method: follow a second trajectory a tiny distance away, and every so often measure how much the gap grew, shrink it back to its original size along the same direction, and keep a running average of the logarithm of the growth. The λ chart below the stats does exactly that, live, from the current start point. With the default settings it renews the gap every 0.5 time units starting from 10⁻⁸, and its running estimate passes through the article’s figures — 0.889 after 100 intervals, 0.917 after 500, 0.909 after 2000 and 0.9057 after 4000 — before continuing to 10,000 intervals (0.9042 in the check script). In the article the two readings differed by 0.15; the stats box shows both for whatever parameters you set.

Ten times the precision buys a fixed amount of time

If an error of size δ grows like δ·eλt, it reaches a tolerance Δ after T = (1/λ) ln(Δ/δ). The prediction horizon depends on the logarithm of the initial precision, so each factor of ten adds the same ln 10 / λ, about 2.54 time units for λ = 0.9057. The article measured it directly for seven offsets from 10⁻³ to 10⁻¹⁵: 3.6, 8.7, 18.5, 23.8, 28.5, 33.9 and 34.0 time units until the runs were 1.0 apart — about 2.71 per factor of ten on a straight-line fit. Making the start a trillion times more precise did not make the forecast even ten times longer.

The table under the charts reruns that experiment for whatever parameters and start point you have set, puts its fitted slope next to ln 10 / λ and, when the settings match the article’s, lists the article’s own numbers alongside. Expect the slope and ln 10 / λ to disagree by a few tenths: the article got 2.71 against 2.54, and finite-time growth rates along one particular orbit are not the long-run average. Two more caveats from the article: t is dimensionless model time, not hours, and this is the toy convection model, not a weather forecast.

Fixed points, and what ρ does

The equations have a fixed point at the origin for every ρ, and for ρ > 1 two more, C± = (±√(β(ρ − 1)), ±√(β(ρ − 1)), ρ − 1) — the centres of the two wings, at (±8.485, ±8.485, 27) for the classic values. They are marked on the 3D view and as dashed lines in the x, y, z panel. C± lose stability at ρH = σ(σ + β + 3)/(σ − β − 1), which is 24.74 for σ = 10, β = 8/3. The presets walk through what that means; each description is what this page’s own solver shows, checked by its verification script:

Making an image of it

For wallpaper or prints, use one trajectory, a long trail and “Time along the trail” colouring, rotate to the angle you like and save a PNG at 3840 × 2160. Trails are drawn additively, so places the orbit visits often glow. A cloud of 1,000 starts with the Spectrum palette gives a different picture: the colours stay sorted along a thin filament, then fold into each other — the butterfly effect made visible.

Limits

What will you try next?

Share this tool

Part of Shake AI Lab — interactive experiments in mathematics and machine learning. · More tools · 日本語の解説記事