Power series and uniform convergence
powerSeries(c) is for a formula . It finds the radius of convergence, examines each end of the interval, and evaluates the series with a proven tail. taylorRemainder puts Lagrange's bound beside the true error, and functionSequence measures the distance between a sequence of functions and its limit.
const p = powerSeries("1/n", { from: 1 }); // x + x^2/2 + x^3/3 + … = -log(1 - x)
p.radius(); // { radius: 1, limit: 1, by: "ratio" }
p.interval().text; // "[-1, 1)"
p.interval().left; // { point: -1, convergence: "conditionally convergent", by: "alternating", … }
p.interval().right; // { point: 1, convergence: "divergent", by: "comparison", … }
powerSeries("1/n!").interval().text; // "(-inf, inf)"
powerSeries("n!").interval().text; // "{0}"
powerSeries("2^n/n^2", { from: 1 }).interval().text; // "[-1/2, 1/2]"
powerSeries("1/n!").value(1, { digits: 15 }).enclosure; // e, to 15 digits
Radius and end points
A power series converges absolutely for and diverges for , where
when that limit exists. At the two points the theorem is silent, and anything can happen: converges at and diverges at , converges at both, at neither. So when is an exact rational number, interval() forms the two numerical series and runs the convergence tests on each. The bracket in text is square where the series is proven to converge, round where it is proven to diverge, and ? where no test decided.
Operations
Inside its interval a power series can be differentiated and integrated term by term, and the radius does not change (the ends may).
const d = p.derivative(); // Σ x^n, the geometric series
d.interval().text; // "(-1, 1)": both ends are lost
p.integral(); // Σ x^n/(n(n - 1)) from n = 2
p.partial(4); // x + 1/2*x^2 + 1/3*x^3 + 1/4*x^4 as a function, to plot or evaluate
p.at("1/2").sum(); // the numerical series at x = 1/2: encloses log 2
Taylor's remainder against the true error
Taylor's theorem bounds the error of the polynomial of order about :
taylorRemainder computes both sides on an interval. is the certified range of the next derivative, so the bound is a proven one. The true maximum of is enclosed as well, so you can see how much the bound overestimates.
const r = taylorRemainder("exp(x)", { about: 0, order: 4, on: [-1, 1] });
r.M; // [0.3678…, 2.7182…]: the range of |f⁽⁵⁾| = exp on [-1, 1]
r.bound; // 0.02265… = e/120
r.actual; // [0.009948…, 0.009948…]: the true largest error, at x = 1
r.holds; // true
Pointwise and uniform convergence
A sequence of functions converges to pointwise on a set if for each , and uniformly if the largest error goes to zero:
The difference matters: a uniform limit of continuous functions is continuous and can be integrated term by term, and a pointwise limit need not be. The standard example is on , whose pointwise limit jumps at 1.
const f = functionSequence("x^n");
f.pointwise("1/2"); // 0
f.supDistance(5, [0, "9/10"]); // [0.59049, 0.59049]: sup |x^5 - 0| on the interval
f.uniform(["1/10", "9/10"]).verdict; // "uniform": a bound for every x at once that tends to 0
f.uniform([0, 1]).verdict; // "not uniform": the sup is at x = 1, where the distance tends to 1
functionSequence("n*x/(1 + n^2*x^2)").uniform([0, 1]).witness; // { x: "1/n", limit: 1/2 }
supDistance returns an interval for the supremum: the upper end is a proven bound from a certified range, the lower end a value the difference really takes. uniform decides the question with a proof where it can, in either direction, and says which argument it used in method and reason:
- Monotone in x. If keeps one sign on the interval for every from some on, the supremum is at an end of the interval: . The sign is shown by a range calculation that carries "" and "" as intervals, the second unbounded. The two end values are ordinary sequences in , and their limits decide the question: uniform if both tend to 0, not uniform if one does not. This is how is settled on and on .
- A bound for every x at once. The asymptotic bound of the sequences page, carried out with standing for the whole interval, proves "uniform" when it tends to 0, as for .
- A witness. If along some in the interval, such as or an end shifted by , the distance tends to a limit that is not 0, the supremum cannot tend to 0: "not uniform", with the witness returned. For the witness is , where the value is for every .
Where none of the three applies the verdict is "not uniform so far" (the suprema computed stay away from 0, which is evidence about the tried and is labelled as that) or "undecided", with the table of suprema as what you have.
| call | returns |
|---|---|
| powerSeries(coefficient, { index = "n", from = 0, centre = 0 }) | PowerSeries |
| p.radius() | { radius, limit, by }; radius is a RationalInterval, 0 or Infinity |
| p.interval() | { radius, left, right, text } |
| p.coefficient(n), p.partial(N), p.at(x), p.value(x, { digits }) | Rational; AnalyticFunction; Series; the result of sum() |
| p.derivative(), p.integral() | PowerSeries |
| taylorRemainder(f, { about, order, on: [a, b] }) | { coefficients, M, radius, bound, actual, holds } |
| functionSequence(term, { variable = "x", index = "n" }) | FunctionSequence |
| f.member(n), f.pointwise(x), f.supDistance(n, [a, b], limit = "0") | AnalyticFunction; RationalInterval or ±Infinity; RationalInterval |
| f.uniform([a, b], limit = "0", { ns }) | { verdict, method, reason, witness, table } |
@ratmath/analytic and Core's R, Rational, RationalInterval in scope. The last line's value is shown; PRINT(…) adds lines, TEX(…) typesets math.