First-order equations: characteristics
transport solves with along characteristics: a closed formula where there is one, a certified value at a point otherwise, and a plain statement of where characteristics cross and the solution stops being a function.
const u = transport({ speed: 2, initial: "exp(-x^2)" });
u.formula; // "exp(-(x - 2*t)^2)"
u.characteristics; // "x - 2*t = const"
u.at(1, "1/2").value; // exactly 1: the foot of the characteristic is x = 0
u.residual(3, 1); // [0, 0]: the formula put back into the equation
const b = transport({ speed: "u", initial: "exp(-x^2)", interval: [-4, 4] });
b.crossing.time; // [1.165821…]: the breaking time sqrt(e/2)
b.at(1, 2); // refuses: characteristics have crossed
The idea
Follow a curve with . Along it, by the chain rule, , so the partial differential equation becomes the ordinary one . With constant and ,
where is the foot: the point of the line from which the characteristic through started. Solving the equation is finding the foot.
- Constant speed. The characteristics are the parallel lines , and : the initial profile moves at speed unchanged.
- Speed . gives , again a closed formula.
- Any other . The foot is the value at time 0 of the solution of through , followed backwards by the validated ODE solver. The result is an enclosure of the foot, and so of .
In all three cases the characteristics are solutions of one ordinary differential equation, and two solutions through the same point are the same solution: they never cross, and is defined for all time. Where there is a closed formula, residual(x, t) differentiates it and encloses at a point, which is a check that does not go through characteristics at all.
When the speed depends on u
For , such as Burgers' equation , is still constant along each characteristic, so each one is a straight line whose slope is set by the value it carries:
Now the lines can meet. Two neighbours starting at and cross when , so the first crossing is at the breaking time
if is negative somewhere, and never if (faster values ahead of slower ones: a rarefaction). Past the method would assign several values to one point; the equation then has no classical solution, and at refuses instead of returning one of them.
With interval: [a, b] the least value of over starting points in is enclosed by subdivision, which gives an enclosure of for those characteristics. Before the breaking time, is increasing, so the foot is its one root, found by bisection. Without an interval the claim is local: at first proves on the bracket it found, and refuses where it cannot.
| call | returns |
|---|---|
| transport({ speed, decay = 0, source = 0, initial, interval, order = 8, tol = "1e-8" }) | { kind, characteristics, foot, formula, crossing, at, residual }; also pde.transport |
| u.at(x, t) | { value, foot }: RationalIntervals (single numbers when the arithmetic is exact) |
| u.residual(x, t) | an enclosure of the equation's left side minus right side from the closed formula |
| u.crossing | { never: true | false | null, time, reason } |
@ratmath/analytic and Core's R, Rational, RationalInterval in scope. The last line's value is shown; PRINT(…) adds lines, TEX(…) typesets math.