Sensitive dependence, and what a solver can promise
A differential equation promises less than it appears to. It fixes the future completely — and yet, for some systems, knowing the present to forty decimal places buys you only a few dozen units of time. This post works through where that boundary sits, and it doubles as the page every part of this site is measured against: every figure below is drawn in your browser, and every one of them can be poked at.
What determinism actually gives you
The classical existence theorem costs almost nothing to state, and it is worth being precise about what it does not say.
Uniqueness is a statement about exact real numbers. It says two solutions from the same point agree; it says nothing about two solutions from points a billionth apart. That gap is the whole subject.
Start with a case where the gap stays closed. The logistic equation
has every solution converging to
This figure is drawn in the browser and needs JavaScript.
Scroll to zoom · drag to pan · double-click to reset
The same picture in the phase plane, for a damped oscillator rather than a logistic growth, shows the other classical ending: everything spirals into a single point.
This figure is drawn in the browser and needs JavaScript.
Scroll to zoom · drag to pan · double-click to reset
Where it breaks
Lorenz’s system is the standard counterexample, and it is worth writing out because its nonlinearity is so slight — two quadratic terms, nothing more:
with the usual
This figure is drawn in the browser and needs JavaScript.
Drag to rotate · scroll to zoom
Sampling one long orbit densely enough turns the trajectory into a picture of the attractor itself — the set the system settles onto, of which any particular trajectory is only one thread.
This figure is drawn in the browser and needs JavaScript.
Drag to rotate · scroll to zoom
Compare that with the surface swept out by the logistic solutions of
This figure is drawn in the browser and needs JavaScript.
Drag to rotate · scroll to zoom
The cost of a billionth
Take two Lorenz trajectories whose starting points differ by
This figure is drawn in the browser and needs JavaScript.
Scroll to zoom · drag to pan · double-click to reset
The straight section is the content of the figure: on a log axis,
exponential growth is a line, and its slope is the leading Lyapunov exponent
The logarithm in
Where the exponential comes from
Nothing so far explains why the separation should grow exponentially rather than, say, quadratically. The answer is that a small perturbation obeys its own linear equation — the variational equation — whose coefficient matrix is the Jacobian of the field, evaluated along the trajectory:
Discretise
The blanks are genuine zeros, and there are a great many of them: of the
So the amplification of an initial error is a product of matrices, one per
step. Products grow or shrink geometrically, and the average logarithmic growth
rate of
This also settles what a better integrator can and cannot do. A higher-order
method computes each
What the integrator controls
None of this excuses a sloppy solver. Over the interval where prediction is meaningful, the method’s order is exactly what decides how much work a given accuracy costs.
| Method | Order |
Evaluations per step | Error at |
|---|---|---|---|
| Euler | 1 | 1 | |
| Heun | 2 | 2 | |
| RK4 | 4 | 4 |
A method of order
This figure is drawn in the browser and needs JavaScript.
Scroll to zoom · drag to pan · double-click to reset
The three orders come out of a Taylor expansion that each method truncates at a different place:
// One RK4 step. The weights are chosen so the error terms through h⁴ cancel.
export function rk4Step(fn, t, state, h) {
const k1 = fn(t, state);
const k2 = fn(t + h / 2, add(state, k1, h / 2));
const k3 = fn(t + h / 2, add(state, k2, h / 2));
const k4 = fn(t + h, add(state, k3, h));
return state.map((v, i) => v + (h / 6) * (k1[i] + 2 * k2[i] + 2 * k3[i] + k4[i]));
}
What to take away
- Uniqueness is not predictability. Theorem 1.2 holds for the Lorenz system as much as for the logistic one; it simply does not say what you want.
- The horizon grows logarithmically. By
, precision is the expensive way to buy time, and it is the only way. - Order still matters. Within the horizon, the difference between Euler and RK4 is seven orders of magnitude for four times the work.
A theory is the more impressive the greater the simplicity of its premises, the more different kinds of things it relates, and the more extended its area of applicability.
— Einstein, on why two quadratic terms deserve this much attention
Everything above renders from about three kilobytes of figure recipes; the trajectories are integrated in your browser rather than shipped as data. See the spike notes for the measurements behind that choice.