Course Test · University: first two years
Calculus I: 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.A trigonometric limitAgreesIndependent answer.RatMath code
symbolic.limit("sin(5x)/x", "x", 0).valueOutput5
- 2.Limit at infinityAgreesIndependent answerDivide by : .RatMath code
symbolic.limit("(3x^2 - x)/(5x^2 + 2)", "x", "inf").valueOutput3/5
- 3.Product ruleAgreesDifferentiate .Independent answer.RatMath code
symbolic.sym("x^3*sin(x)").diff("x")Output3*x^2*sin(x) + x^3*cos(x)
- 4.Quotient ruleAgreesDifferentiate .Independent answer.RatMath code
symbolic.simplify(symbolic.sym("(x^2 + 1)/(x - 2)").diff("x"))Output(x^2 - 4*x - 1)/(x - 2)^2
- 5.Chain ruleAgreesDifferentiate .Independent answer.RatMath code
symbolic.simplify(symbolic.sym("sqrt(3x^2 + 1)").diff("x"))Output3*x/sqrt(3*x^2 + 1)
- 6.Exponentials and logarithmsAgreesDifferentiate .Independent answer.RatMath code
symbolic.sym("exp(2x)*log(x)").diff("x")Output2*exp(2*x)*log(x) + exp(2*x)*(1/x)
- 7.Implicit differentiationAgreesFind for at the point .Independent answer, .RatMath code
const d = symbolic.implicitDiff("x^2 + y^2 = 25", "x", "y"); PRINT("dy/dx =", d.first); d.at({ x: 3, y: 4 }).firstOutput-3/4
implicitDiffdifferentiates with and solves for ;atchecks the point is on the curve.Fix: ratmath/symbolic#9,completeSquare,compose,sinusoid, inverse trig values,within,RealSetoperations and chained inequalities,implicitDiff,leibniz, constant factors insum - 8.Tangent lineAgreesFind the tangent line to at .Independent answer, : .RatMath code
const f = symbolic.sym("x^3 - 2x"), m = f.diff("x").subs({ x: 1 }).simplify(), y1 = f.subs({ x: 1 }).simplify(); symbolic.expand(`${m}*(x - 1) + ${y1}`)Outputx - 2
- 9.Critical pointsAgreesFind and classify the critical points of .Independent answer. Local maximum ; local minimum .RatMath code
analytic.extrema("x^3 - 3x^2 - 9x + 5", [-5, 5]).exact().filter((e) => e.kind !== "endpoint").map((e) => [e.kind, e.at, e.value])Output[["max", -1, 10], ["min", 3, -22]]
- 10.Absolute extremaAgreesFind the absolute maximum and minimum of on .Independent answerat ; , , . Max 2 at , min at .RatMath code
analytic.extrema("x^3 - 3x", [0, 2]).exact().map((e) => [e.kind, e.at, e.value])Output[["min", 1, -2]]
- 11.Inflection pointsAgreesFind the inflection points of .Independent answerat , where changes sign: and .RatMath code
analytic.inflections("x^4 - 6x^2", [-3, 3]).exact().map((p) => [p.at, p.value])Output[[-1, -5], [1, -5]]
- 12.Related ratesAgreesA balloon's radius grows at 2 cm/s. How fast is its volume growing when the radius is 5 cm?Independent answer.RatMath code
symbolic.simplify(String(symbolic.sym("4/3*pi*r^3").diff("r").subs({ r: 5 })) + "*2")Output200*pi
- 13.OptimisationAgreesA rectangle has perimeter 40. What dimensions give the greatest area?Independent answer, : a 10 by 10 square, area 100.RatMath code
const s = symbolic.solve(String(symbolic.sym("x*(20 - x)").diff("x")) + " = 0", "x"); [s, symbolic.sym("x*(20 - x)").subs({ x: 10 }).simplify()]Output[x = 10, 100]
- 14.Linear approximationAgreesUse a linear approximation to estimate .Independent answer.RatMath code
symbolic.taylor("sqrt(x)", "x", 4, 1)Output2 + 1/4*(x - 4) + …
- 15.Newton's methodAgreesApply Newton's method to from . Give as fractions.Independent answer: .RatMath code
analytic.newton("x^2 - 2", "1", { exact: true, steps: 3 }).iterations.slice(1).map((r) => r.x)Output[3/2, 17/12, 577/408]
newtonwithexact: truekeeps the iterates as fractions; it also gives the float iterates beside them.Fix: ratmath/analytic#19,termsForError,newton(..., { exact: true }),darboux,pde.classify,gradientDescent - 16.Riemann sumAgreesCompute the left Riemann sum for with 4 equal subintervals.Independent answer.RatMath code
sum(0, 3, (i) => R`(${i}/2)^2 * 1/2`)Output7/4
- 17.Definite integralAgreesIndependent answer.RatMath code
symbolic.integrate("2x + 1", "x", { from: 1, to: 3 }).valueOutput10
- 18.Fundamental theoremAgreesIndependent answer.RatMath code
symbolic.leibniz("cos(t)", "t", "0", "x^2").valueOutput2*x*cos(x^2)
leibnizapplies the fundamental theorem with the chain rule: .Fix: ratmath/symbolic#9,completeSquare,compose,sinusoid, inverse trig values,within,RealSetoperations and chained inequalities,implicitDiff,leibniz, constant factors insum - 19.SubstitutionAgreesIndependent answer: .RatMath code
const F = symbolic.integrate("x*(x^2 + 1)^5", "x"); PRINT(F); symbolic.equal(`${F.result}`, "(x^2 + 1)^6/12 - 1/12")Outputequal (normal form)
- 20.Area between curvesAgreesFind the area between and .Independent answerThey meet at : .RatMath code
symbolic.integrate("x + 2 - x^2", "x", { from: -1, to: 2 }).valueOutput9/2