Sensitive dependence, and what a solver can promise — Beyond Any Doubt

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

(1)x=rx(1xK),r>0, K>0,

has every solution converging to x=K, whatever it starts from. Nearby starts stay nearby, forever: the flow is contracting, and a solver’s early rounding error gets forgotten rather than amplified.

Scroll to zoom · drag to pan · double-click to reset

Figure 1. Four solutions of the logistic equation over its direction field. Every trajectory is drawn toward the carrying capacity, so the four curves that begin far apart end indistinguishable. Zoom in near t = 0 to see how quickly the fastest one turns.

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.

Scroll to zoom · drag to pan · double-click to reset

Figure 2. Phase portrait of a damped oscillator, four initial states. The origin is a stable spiral, so the long-run answer does not depend on where you started — only on how long you are prepared to wait.

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:

(2)x=σ(yx),y=x(ρz)y,z=xyβz,

with the usual σ=10, ρ=28, β=8/3.

Drag to rotate · scroll to zoom

Figure 3. A single trajectory of the Lorenz system (2), coloured by height. Drag it: the two wings lie in planes that meet at an angle, which no fixed viewpoint shows honestly.

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.

Drag to rotate · scroll to zoom

Figure 4. Four hundred thousand states along one orbit, coloured by speed. The pale outer rims are where the system moves fastest; the dark cores are where it lingers. Because the points blend rather than occlude, density reads as opacity.

Compare that with the surface swept out by the logistic solutions of (1) as the initial condition varies. Every slice at fixed x0 is one solution curve, and the whole sheet is smooth, monotone and dull — which is exactly the point.

Drag to rotate · scroll to zoom

Figure 5. The logistic solution surface x(t; x₀), height also mapped to colour. Rotate to look along the t axis: every slice funnels to the same value, which is contraction seen end-on.

The cost of a billionth

Take two Lorenz trajectories whose starting points differ by 109 in the x coordinate alone, and watch the distance between them.

Scroll to zoom · drag to pan · double-click to reset

Figure 6. Separation of two trajectories that begin 10⁻⁹ apart, on a logarithmic axis. Growth is exponential — a straight line here — until the separation reaches the size of the attractor, after which the two states are simply unrelated. Both start on the attractor rather than at the usual (1, 1, 1); see the remark below. Hover the curve to read the separation at any time.

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 λ0.906. So

(3)|Δ(t)||Δ(0)|eλtthorizon1λlogtolerance|Δ(0)|.

The logarithm in (3) is the bad news. Buying ten more decimal places of initial accuracy buys about 10log10/λ25 more time units of prediction — and then you are back where you started.

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:

(4)δ˙=J(x(t))δ,J=(σσ0ρz1xyxβ).

Discretise (4) on the same grid the solver uses, write Mk for the one-step amplification I+hJ(xk)+O(h2), and stack the perturbations at every step into one vector. The whole history then satisfies a single linear system:

(5)(IM1IM2IMn1I)(δ1δ2δ3δn)=(M0δ0000).

The blanks are genuine zeros, and there are a great many of them: of the n2 blocks in (5) only 2n1 are non-zero, two per row at worst. A matrix this sparse is never assembled, let alone inverted. It is lower triangular, so forward substitution solves it in one sweep — which is precisely what running the solver forward in time is:

(6)δn=Mn1Mn2M1M0δ0.

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 Mn1M0 is the definition of the leading Lyapunov exponent. The straight line in the separation plot is (6) seen on a log axis, and λ0.906 is its slope.

This also settles what a better integrator can and cannot do. A higher-order method computes each Mk more accurately; it does not make the product smaller. The exponent belongs to J, and J belongs to the equation.

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 p Evaluations per step Error at h=1/64
Euler 1 1 2.89×103
Heun 2 2 1.51×105
RK4 4 4 1.85×1010

A method of order p has global error O(hp), so on log–log axes each method should trace a straight line of slope p. That is a claim worth checking rather than repeating:

Scroll to zoom · drag to pan · double-click to reset

Figure 7. Global error at t = 1 for x′ = −x, against step size, on log–log axes. The three slopes come out at 1.00, 2.00 and 4.01 — the orders the methods are advertised to have. Note the vertical span: at the smallest step, RK4 is nine orders of magnitude more accurate than Euler.

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

  1. 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.
  2. The horizon grows logarithmically. By (3), precision is the expensive way to buy time, and it is the only way.
  3. 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.


← All posts