ε, N and δ, with certificates
The definitions of a limit and of continuity ask for a number: an for each , or a for each . nFor and deltaFor find one, say why it works for every later term or every nearby point, and hand back a certificate that verifyCertificate rechecks by a different route.
const a = sequence("(2n + 1)/(n + 3)");
const r = a.nFor("1/100");
r.N; // 498, and r.least is true: 497 does not work
r.reason; // "the terms rise to the limit for n ≥ 1, so |a(n) − L| never grows from there; …"
verifyCertificate(r.certificate).valid; // true
const d = deltaFor("x^2", 2, "1/100");
d.delta; // 249/100000, a δ that works
d.largest; // [0.00249843…]: the largest one, √4.01 − 2
deltaFor("x^2", 2, "1/100", { delta: "0.003" }).holds; // false
An N for ε
means: for every there is an with for all . Checking terms one at a time can never finish, so the statement about all needs an argument. Two are used.
A monotone tail. If the terms are proven to rise (or fall) to from some index on, then never grows from there, and the first index where it is below is the answer. It is found by doubling and bisection, and it is the least : the term before it is checked to fail.
A dominating sequence. Otherwise, as for , the asymptotic form of the sequences page gives a bound that decreases to 0. Past the index where the bound is below every term is within ; the finitely many terms before that are examined one by one, walking back to the last one that fails. If the walk reaches it, the is again least.
Sequences with periodic factors, such as , are split into the subsequences first, and the answer is one past the last failing index over all of them.
A δ for ε
is continuous at when for every there is a with whenever . The quantity to control is
Where is proven to keep one sign on each side of , the supremum is at an end of the interval and is computed exactly. Otherwise it is bounded by the certified range of and by the mean value theorem, , whichever is smaller. deltaFor halves until .
The largest is the distance from to the nearest solution of . Those are found with the certified zeros, which are complete on an interval: no solution is missed, so the nearest one really is nearest. For at 2 with it is , slightly less than the a first estimate suggests.
What the certificate is for
A certificate is a plain record of the claim: the formula, the point or limit, , the number found and the argument used. verifyCertificate does not repeat the search. For an it recomputes the limit, checks that the certificate's parts are the subsequences of this very sequence (one for each residue class when there is a factor such as ), proves the monotone direction again or compares the dominating bound with the terms at sampled indices and with , finds the index where each tail argument takes over, and tests the inequality at every index from up to there, one by one. Only then does it test the failure at when is claimed least, and the inequality at a spread of later indices. So moving before a bump in the terms is caught: for and the least is 52, and a certificate edited to say fails at . A monotone tail is proven; a dominating bound comes from the asymptotic form and the verifier only samples it against the terms, so for that method the replay is a strong check rather than a second proof. For a it cuts the interval into cells and checks on each by plain interval evaluation, with no derivative and no root-finding. It returns the list of checks and whether all passed, so a wrong answer from either side shows up as a disagreement.
| call | returns |
|---|---|
| a.nFor(ε, { limit, digits = 20 }) | { N, least, limit, epsilon, method, reason, certificate } |
| deltaFor(f, x0, ε), fn(f).deltaFor(x0, ε) | { delta, largest, attainedAt, worst, reason, certificate } |
| deltaFor(f, x0, ε, { delta }) | { delta, holds, worst, reason, certificate }: whether that δ works |
| verifyCertificate(certificate) | { valid, checks: [{ check, ok }] } |
@ratmath/analytic and Core's R, Rational, RationalInterval in scope. The last line's value is shown; PRINT(…) adds lines, TEX(…) typesets math.