Topic

Power series and uniform convergence

powerSeries(c) is ∑cn(x−a)n\sum c_n (x - a)^n for a formula cnc_n. 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 ∣x−a∣<R|x - a| < R and diverges for ∣x−a∣>R|x - a| > R, where

1R=lim⁡n→∞∣cn+1cn∣ \frac1R = \lim_{n\to\infty}\left|\frac{c_{n+1}}{c_n}\right|

when that limit exists. At the two points ∣x−a∣=R|x - a| = R the theorem is silent, and anything can happen: ∑xn/n\sum x^n/n converges at −1-1 and diverges at 11, ∑xn/n2\sum x^n/n^2 converges at both, ∑xn\sum x^n at neither. So when RR is an exact rational number, interval() forms the two numerical series ∑cn(±R)n\sum c_n(\pm R)^n 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 TnT_n of order nn about aa:

∣f(x)−Tn(x)∣≤M ∣x−a∣n+1(n+1)!,M≥max⁡∣f(n+1)∣ between a and x. |f(x) - T_n(x)| \le \frac{M\,|x-a|^{n+1}}{(n+1)!}, \qquad M \ge \max |f^{(n+1)}| \text{ between } a \text{ and } x .

taylorRemainder computes both sides on an interval. MM is the certified range of the next derivative, so the bound is a proven one. The true maximum of ∣f−Tn∣|f - T_n| 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 fnf_n converges to ff pointwise on a set if fn(x)→f(x)f_n(x) \to f(x) for each xx, and uniformly if the largest error goes to zero:

sup⁡x∣fn(x)−f(x)∣→0. \sup_x |f_n(x) - f(x)| \to 0 .

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 xnx^n on [0,1][0, 1], 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 ∂(fn−f)/∂x\partial (f_n - f)/\partial x keeps one sign on the interval for every nn from some n0n_0 on, the supremum is at an end of the interval: sup⁡∣fn−f∣=max⁡(∣fn(a)−f(a)∣,∣fn(b)−f(b)∣)\sup|f_n - f| = \max(|f_n(a) - f(a)|, |f_n(b) - f(b)|). The sign is shown by a range calculation that carries "x∈[a,b]x \in [a, b]" and "n≥n0n \ge n_0" as intervals, the second unbounded. The two end values are ordinary sequences in nn, and their limits decide the question: uniform if both tend to 0, not uniform if one does not. This is how xnx^n is settled on [0,9/10][0, 9/10] and on [0,1][0, 1].
  • A bound for every x at once. The asymptotic bound of the sequences page, carried out with xx standing for the whole interval, proves "uniform" when it tends to 0, as for sin⁡(nx)/n\sin(nx)/n.
  • A witness. If along some xnx_n in the interval, such as xn=c/nx_n = c/n or an end shifted by c/nc/n, the distance ∣fn(xn)−f(xn)∣|f_n(x_n) - f(x_n)| tends to a limit that is not 0, the supremum cannot tend to 0: "not uniform", with the witness returned. For nx/(1+n2x2)nx/(1 + n^2x^2) the witness is xn=1/nx_n = 1/n, where the value is 1/21/2 for every nn.

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 nn tried and is labelled as that) or "undecided", with the table of suprema as what you have.

callreturns
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 }
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