Topic

First-order equations: characteristics

transport solves ut+c ux+k u=su_t + c\,u_x + k\,u = s with u(x,0)=f(x)u(x, 0) = f(x) 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 x(t)x(t) with dx/dt=cdx/dt = c. Along it, by the chain rule, ddtu(x(t),t)=ut+c ux\frac{d}{dt}u(x(t), t) = u_t + c\,u_x, so the partial differential equation becomes the ordinary one du/dt=s−k udu/dt = s - k\,u. With constant kk and ss,

u(x,t)=f(ξ) e−kt+sk(1−e−kt)( f(ξ)+s t when k=0 ), u(x, t) = f(\xi)\,e^{-kt} + \frac{s}{k}\bigl(1 - e^{-kt}\bigr) \qquad (\,f(\xi) + s\,t \text{ when } k = 0\,),

where ξ\xi is the foot: the point of the line t=0t = 0 from which the characteristic through (x,t)(x, t) started. Solving the equation is finding the foot.

  • Constant speed. The characteristics are the parallel lines x−ct=ξx - ct = \xi, and u=f(x−ct)u = f(x - ct): the initial profile moves at speed cc unchanged.
  • Speed ax+bax + b. dx/dt=ax+bdx/dt = ax + b gives ξ=(x+b/a) e−at−b/a\xi = (x + b/a)\,e^{-at} - b/a, again a closed formula.
  • Any other c(x,t)c(x, t). The foot is the value at time 0 of the solution of dx/dt=c(x,t)dx/dt = c(x, t) through (x,t)(x, t), followed backwards by the validated ODE solver. The result is an enclosure of the foot, and so of uu.

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 uu is defined for all time. Where there is a closed formula, residual(x, t) differentiates it and encloses ut+c ux+k u−su_t + c\,u_x + k\,u - s at a point, which is a check that does not go through characteristics at all.

When the speed depends on u

For ut+c(u) ux=0u_t + c(u)\,u_x = 0, such as Burgers' equation ut+u ux=0u_t + u\,u_x = 0, uu is still constant along each characteristic, so each one is a straight line whose slope is set by the value it carries:

x=ξ+F(ξ) t,F(ξ)=c(f(ξ)). x = \xi + F(\xi)\,t, \qquad F(\xi) = c(f(\xi)).

Now the lines can meet. Two neighbours starting at ξ\xi and ξ+dξ\xi + d\xi cross when 1+F′(ξ) t=01 + F'(\xi)\,t = 0, so the first crossing is at the breaking time

tb=−1min⁡ξF′(ξ) t_b = \frac{-1}{\min_\xi F'(\xi)}

if F′F' is negative somewhere, and never if F′≥0F' \ge 0 (faster values ahead of slower ones: a rarefaction). Past tbt_b 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 F′F' over starting points in [a,b][a, b] is enclosed by subdivision, which gives an enclosure of tbt_b for those characteristics. Before the breaking time, ξ↦ξ+F(ξ) t\xi \mapsto \xi + F(\xi)\,t is increasing, so the foot is its one root, found by bisection. Without an interval the claim is local: at first proves 1+F′(ξ) t>01 + F'(\xi)\,t > 0 on the bracket it found, and refuses where it cannot.

callreturns
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 }
Try itEdit the code and run it with @ratmath/analytic and Core's R, Rational, RationalInterval in scope. The last line's value is shown; PRINT(…) adds lines, TEX(…) typesets math.
Ctrl/⌘ + Enter runs