Course Test · University: upper level
Real analysis: RatMath answers
The same twenty exercises, answered with RatMath Core and the Shelf libraries only. The code below was run when this page was built; its output is shown as printed, and compared with the independent answer.
Agrees 20
Libraries used here: core, analytic, symbolic. In this code each library is in scope under its own name (linalg.det, stats.tTest), and Core's names (R, Rational, …) are in scope directly.
- 1.Limit of a sequenceAgreesFind .Independent answerDivide by : .RatMath code
analytic.sequence("(3n^2 + 1)/(2n^2 - n)").limit()Output3/2
- 2.An N for a given εAgreesFind the least such that for every .Independent answer: .RatMath code
const r = analytic.sequence("1/sqrt(n)").nFor("1/100"); [r.N, r.least, analytic.verifyCertificate(r.certificate).valid]Output[10001, true, true]
nForproves the tail (the terms fall to the limit, so the distance never grows) and finds the least : 10000 fails because equals .verifyCertificaterechecks the result by another route.Fix: ratmath/analytic#20,nFor,deltaForandverifyCertificate;supremum,limsup,liminf; limits of ; uniform convergence decided both ways;pde.transport; exact finite-mode Laplace solutions - 3.Monotone sequences and the supremumAgreesLet . Is it monotone? Find and .Independent answerIncreasing, since decreases. (attained); (not attained).RatMath code
const a = analytic.sequence("1 - 1/n"); const [s, i] = [a.supremum(), a.infimum()]; [a.monotone().direction, s.value, s.attained, i.value, i.attained]Output["increasing", 1, false, 0, true]
supremum()andinfimum()give the value and whether a term takes it, from the proven direction: an increasing sequence approaches its limit without reaching it, and its first term is its least.Fix: ratmath/analytic#20,nFor,deltaForandverifyCertificate;supremum,limsup,liminf; limits of ; uniform convergence decided both ways;pde.transport; exact finite-mode Laplace solutions - 4.Telescoping seriesAgreesSum .Independent answer; partial sums .RatMath code
symbolic.sum("1/(n*(n+1))", "n", 1, "inf").valueOutput1
- 5.Ratio testAgreesDoes converge? Find the limit of the ratio of consecutive terms.Independent answer: converges.RatMath code
[analytic.sum("n!/n^n").ratioTest().verdict, analytic.sequence("(n/(n+1))^n").limit()]Output["convergent", 0.36787944117144232159:0.3678794411714423216]
The ratio is a power with a moving exponent; its limit is now proven (as an enclosure), soratioTest()concludes.Fix: ratmath/analytic#20,nFor,deltaForandverifyCertificate;supremum,limsup,liminf; limits of ; uniform convergence decided both ways;pde.transport; exact finite-mode Laplace solutions - 6.Alternating series errorAgreesHow many terms of guarantee an error below 0.001?Independent answerThe error after terms is below ; needs , so .RatMath code
const r = analytic.sum("(-1)^(n+1)/n^2").termsForError("1/1000"); [r.terms, r.bound]Output[31, 1/1024]
termsForErrorproves the term sizes decrease, then finds the first with ; the bound is .Fix: ratmath/analytic#19,termsForError,newton(..., { exact: true }),darboux,pde.classify,gradientDescent - 7.Radius of convergenceAgreesFind the radius of convergence of .Independent answer, so .RatMath code
analytic.powerSeries("n^2/3^n").radius().radiusOutput3
- 8.Limits of functionsAgreesFind .Independent answer, so the limit is .RatMath code
symbolic.limit("(1 - cos(x))/x^2", "x", 0).valueOutput1/2
- 9.A δ for a given εAgreesFor at and , show works.Independent answerIf then , so . Concretely the worst case is .RatMath code
const r = analytic.deltaFor("x^2", 2, "1/100", { delta: "0.002" }); [r.holds, r.worst, analytic.verifyCertificate(r.certificate).valid, analytic.deltaFor("x^2", 2, "1/100").largest]Output[true, 2001/250000, true, 0.0024984394500785727[6:7]]
deltaForproves that works (the worst case is at the end , since is monotone on each side of 2), the certificate is rechecked by plain interval evaluation, and without a it also gives the largest one, .Fix: ratmath/analytic#20,nFor,deltaForandverifyCertificate;supremum,limsup,liminf; limits of ; uniform convergence decided both ways;pde.transport; exact finite-mode Laplace solutions - 10.Mean value theoremAgreesFind the in promised by the mean value theorem for .Independent answer, so .RatMath code
symbolic.solve("3x^2 = 4", "x", { assume: { x: "in (0, 2)" } })Outputx = 2*sqrt(3)/3
With the interval as an assumption only the root in comes back; without itsolvereturns both . - 11.Intermediate value theoremAgreesShow has a root in and find it to six decimals.Independent answer. Bisection or Newton gives (the plastic number).RatMath code
analytic.bisection("x^3 - x - 1", ["1", "2"]).rootOutput1.3247179572447460259[6:7]
- 12.Taylor's remainderAgreesBound the error of the degree-4 Taylor polynomial of about 0 on , and compare with the true error.Independent answerLagrange: . The true maximum error, at , is .RatMath code
const T = analytic.taylorRemainder("exp(x)", { order: 4, on: ["0", "1"] }); [T.bound, T.actual]Output[0.022652348570492043628002…, 0.0099484951257119020[2:3]]
- 13.Darboux sumsAgreesCompute the lower and upper sums of on with four equal pieces.Independent answeris increasing: , .RatMath code
const d = analytic.darboux("x^2", { interval: [0, 1], n: 4 }); [d.lower, d.upper, d.exact]Output[7/32, 15/32, true]
darbouxproves increasing on each piece, so the inf and sup are end values and the sums are exact.Fix: ratmath/analytic#19,termsForError,newton(..., { exact: true }),darboux,pde.classify,gradientDescent - 14.An improper integralAgreesEvaluate .Independent answer.RatMath code
symbolic.integrate("ln(x)", "x", { from: 0, to: 1 }).valueOutput-1
Used to returnnull: an endpoint where the antiderivative needs a limit was not handled. Now the value is the one-sided limits of the antiderivative, checked against analytic's certified improper integral.Fix: ratmath/symbolic#8, improper integrals:"inf"ends and integrands unbounded at an end - 15.Pointwise limitAgreesFind the pointwise limit of on .Independent answerfor and at : a discontinuous limit of continuous functions.RatMath code
const F = analytic.functionSequence("x^n"); [F.pointwise("1/2"), F.pointwise("1")]Output[0, 1]
The two calls give 0 and 1. For every 0 ≤ x < 1, the powers tend to zero by geometric decay, and at x = 1 every term is one.Fix: ratmath/analytic#18, exact starting values,pointwiselimits,sec/csc/cot, integrating factors with ,ODESolutionexported - 16.Uniform convergenceAgreesDoes uniformly on ? On ?Independent answerOn : , so yes. On : for every , so no.RatMath code
const F = analytic.functionSequence("x^n"); [F.uniform(["0", "1/2"]).verdict, F.uniform(["0", "1"]).verdict]Output["uniform", "not uniform"]
The code takes two closed intervals. For the half-open interval in the question, fix n ≥ 1. As x approaches 1 from below, xⁿ approaches 1, so its supremum is 1 even though it is never attained. This proves failure of uniform convergence to zero.Fix: ratmath/analytic#20,nFor,deltaForandverifyCertificate;supremum,limsup,liminf; limits of ; uniform convergence decided both ways;pde.transport; exact finite-mode Laplace solutions - 17.Limits superior and inferiorAgreesFind and of .Independent answerEven terms ; odd terms . , ; no limit.RatMath code
const a = analytic.sequence("(-1)^n*(1 + 1/n)"); [a.limsup(), a.liminf(), a.accumulation().converges]Output[1, -1, false]
The sequence is split into and ; the two limits are the only accumulation points.limit()now refuses with “the terms oscillate, with lim sup 1 and lim inf -1”.Fix: ratmath/analytic#20,nFor,deltaForandverifyCertificate;supremum,limsup,liminf; limits of ; uniform convergence decided both ways;pde.transport; exact finite-mode Laplace solutions - 18.Series valueAgreesFind .Independent answer.RatMath code
symbolic.sum("(-1)^(n+1)/n^2", "n", 1, "inf").valueOutputpi^2/12
- 19.Contraction mappingAgreesShow is a contraction on and find its fixed point.Independent answermaps into and . The fixed point (the Dottie number) is .RatMath code
// the two hypotheses, each from a certified range over [0, 1], then the fixed point const slope = analytic.fn("sin(x)").range(["0", "1"]).exact(); // g′ = −sin x const image = analytic.fn("cos(x)").range(["0", "1"]).exact(); const one = new Rational(1n); // |g′| < 1 on [0, 1]; g ≥ 0 there, and cos ≤ 1 everywhere, so g maps [0, 1] into itself [slope.high.lessThan(one) && slope.low.greaterThan(one.negate()), image.low.greaterThan(new Rational(0n)), analytic.fixedPoint("cos(x)", "1").root]Output[true, true, 0.7390851332151606416[5:6]]
Both hypotheses of the contraction mapping theorem are checked from certified ranges ( and ), then the certified fixed point. - 20.Euler's numberAgreesFind and show the sequence is increasing.Independent answerThe limit is . By AM–GM on copies of and one 1, .RatMath code
const a = analytic.sequence("(1 + 1/n)^n"); const m = a.monotone(); [a.limit(), m.direction, m.proven]Output[2.7182818284590452353[6:7], "increasing", "for every n ≥ 1"]
The limit is enclosed, andmonotone()now proves the direction through the derivative of the logarithm, , which tends to 0 while decreasing and so is positive.Fix: ratmath/analytic#20,nFor,deltaForandverifyCertificate;supremum,limsup,liminf; limits of ; uniform convergence decided both ways;pde.transport; exact finite-mode Laplace solutions