Series solutions
Many equations of physics have no solution in elementary functions: Airy's, Bessel's, Legendre's. Their solutions are defined by power series. seriesSolution builds those series for about a point, with exact rational coefficients, and says what kind of point it is.
seriesSolution({ q: "-x", order: 7 }); // Airy: y'' = x y
// kind "ordinary", solutions "1 + 1/6*x^3 + 1/180*x^6 + …" and "x + 1/12*x^4 + 1/504*x^7 + …"
seriesSolution({ p: "1/x", q: "(x^2 - 1/4)/x^2" }); // Bessel of order 1/2
// kind "regular singular", indicial "r^2 - 1/4 = 0", exponents [1/2, -1/2], two series
Ordinary points
If and are analytic at , every solution is a power series there, and it converges at least as far as the nearest singularity of or in the complex plane. Substituting the series and matching powers gives a recurrence that determines every from and :
The two solutions returned are the ones with and . radius estimates the distance to the nearest singularity.
Regular singular points and Frobenius
If has at most a simple pole and at most a double pole at , the point is a regular singular point. Write and (taking ). Frobenius' method looks for ; the lowest power gives the indicial equation
and for each root the recurrence
The larger root always gives a series. The smaller root gives a second one unless the roots are equal or differ by a whole number, in which case the bracket on the left can vanish for some ; then the second solution contains , and notes says so. (When the right side happens to vanish too, the series exists after all, as for Bessel's equation of order one half.)
A point where the poles are worse is an irregular singular point, and the method does not apply.
A proven remainder
A truncated series is only useful with a bound on what was cut off. Each solution , , carries one: remainder(ρ) returns a rational with
for any below provenRadius. enclose(x) evaluates the partial sum at a rational point and puts that bound on either side.
const cos = seriesSolution({ q: "1", order: 12 }).solutions[0]; // y'' + y = 0, y(0) = 1, y'(0) = 0
cos.remainder(1).bound; // 447/1000000000000: the terms beyond x^12 are below 4.47e-10 on the unit disc
const e = cos.enclose("1/2"); // { partial, bound, low, high }
e.low.toDecimal(15), e.high.toDecimal(15); // both 0.877582561890372…: cos(1/2) to 13 places, proven
The proof is the classical convergence argument made quantitative. Take . First, a radius: the reciprocals of the roots of the denominators of and are bounded by root squaring (Graeffe) and Fujiwara's bound, in exact arithmetic, giving with no singular point in ; that is provenRadius, within about one percent of the true distance. Second, for a radius , numbers with and for all : the first hundred or so coefficients are used exactly and the rest are bounded by a majorant of the form . Third, the recurrence. With and it gives
where , because the bracket in the recurrence equals . is known exactly from the coefficients already computed, and decreases to 0. So for the tail is at most a few explicit terms plus a geometric series, once . Several values of are tried and the smallest bound kept. Every step is rational arithmetic rounded upward.
The bound covers the series ; the factor is explicit. Near the edge of the disc a bound still exists but is weak, as it must be: the series itself converges slowly there.
Checking a series
The coefficients are exact, and a partial sum is a polynomial whose value at a rational point is an exact rational. Comparing it with the validated solution of the same initial value problem shows the true truncation error next to the proven bound, as in the box below.
| call | returns |
|---|---|
| seriesSolution({ p, q, about = 0, order = 8, x = "x" }) | { about, kind, indicial, exponents, solutions, notes, radius, provenRadius } |
| solutions[i] | { exponent, coefficients, text, remainder, enclose }, coefficients exact |
| solutions[i].remainder(ρ) | { radius, terms, bound, approx, text }: a proven bound for the terms left out, on the disc of radius ρ |
| solutions[i].enclose(x) | { partial, bound, low, high, exponent }: the series factor at a rational x |
@ratmath/analytic and Core's R, Rational, RationalInterval in scope. The last line's value is shown; PRINT(…) adds lines, TEX(…) typesets math.