Flows, enclosed
A flow is the motion defined by a system of differential equations . On a chaotic flow a numerical solver drifts off the true solution like a float orbit does, only more quietly. Here the solution is enclosed: boxes that are proven to contain it, for a point or for a whole box of starting points.
const L = lorenz(); // x′ = 10(y − x), y′ = x(28 − z) − y, z′ = xy − (8/3)z
const s = L.solve([1, 1, 1], 20);
s.final; // three intervals, each about 10⁻⁶ wide, that hold x(20), y(20), z(20)
s.at("7/2"); // the same at any earlier time
L.floatOrbit([1, 1, 1], 20, { steps: 2000 }); // Runge–Kutta: ends at 13.47…, but the true x(20) is 13.7931…
flow(["y", "-x - y^3"], { variables: ["x", "y"] }); // any formulas
The systems
lorenz(s, r, b): , by default 10, 28, 8/3: Lorenz's model of convection and the first strange attractor.rossler(a, b, c): : one nonlinear term, and a band that folds once.vanDerPol(mu): : an oscillator that settles on one limit cycle whatever the start.pendulum(c): .flow(formulas, { variables, params })for anything else built from + − × ÷, whole powers, sin and cos. Parameters are exact numbers, andwith({ r: 24 })gives the same family at other values.
How the solution is enclosed
The solver takes steps. In one step of length from a set of points:
- A rough box. A box with contains the solution on the whole step, by the Picard–Lindelöf theorem.
- A Taylor polynomial with a bounded remainder. The Taylor coefficients of the solution are computed from the formulas by automatic differentiation, in interval arithmetic. The polynomial of degree 12 from the centre of the set is the main part; the next coefficient, taken over all of , bounds what was left out.
- The derivative of the flow. The same is done for the variational equation , which gives an interval matrix containing the derivative of the time- map at every point of the set. By the mean value theorem the image of the set lies in (image of the centre) + ·(set − centre).
- Sets that turn. A set is kept as a centre, a frame and a box of coordinates in that frame, and the new frame is the orthogonal factor of times the old one (Lohner's method). A box with fixed axes would be re-wrapped at every step and grow even on a rigid rotation; a frame that turns with the flow does not.
All arithmetic is in doubles rounded outward, so the bounds are bounds, and since a double is an exact rational the results are handed back as RationalIntervals. The sine and cosine come from their own series with the remainder bounded, not from the platform's.
What it shows on a chaotic flow
From the Lorenz solution is enclosed to within at , at and at : the enclosure widens at the rate the flow separates orbits (the Lyapunov exponent is about 0.9, so a factor of per ten time units), because rounding errors are perturbations too and the enclosure has to hold them all. That widening is the honest part. A Runge–Kutta solver with 2000 steps returns with nothing to say that only the first two digits are right; the enclosure shows .
The same widening limits how far a set can be followed. A box of starting points of width picks up an error of order per step from the curvature of the flow, so thin sets go far and wide ones do not. When no enclosure can be found the solver stops and says where: complete is false, reached is the time it got to, and reason says why. A solution that blows up in finite time, such as from 1, ends that way just before .
For a single orbit to many digits there is also analytic's ode.solve, which works in exact rational arithmetic with Taylor models. It is some hundred times slower, and it is what to use when 15 digits are not enough.
| call | returns |
|---|---|
| flow(formulas, { variables, params }) | Flow |
| lorenz(s, r, b), rossler(a, b, c), vanDerPol(mu), pendulum(c) | Flow |
| F.solve(p0, until, { order = 12, maxStep, maxSteps }) | { final, at(t), complete, reason, reached, steps, width } |
| F.floatOrbit(p0, until, { steps }) | { t, points } by Runge–Kutta in doubles |
| F.with(params), F.jacobian(), F.velocity(p) | the family at other parameters; formulas; the field in doubles |
@ratmath/chaos and Core's Rational in scope. The last line's value is shown; PRINT(…) adds lines, TEX(…) typesets math.