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. 1.A trigonometric limitAgrees
    lim⁡x→0sin⁡5xx\displaystyle\lim_{x\to 0}\frac{\sin 5x}{x}
    Independent answer
    5⋅lim⁡sin⁡5x5x=55 \cdot \lim \frac{\sin 5x}{5x} = 5.
    RatMath code
    symbolic.limit("sin(5x)/x", "x", 0).value
    Output
    5
  2. 2.Limit at infinityAgrees
    lim⁡x→∞3x2−x5x2+2\displaystyle\lim_{x\to\infty}\frac{3x^2 - x}{5x^2 + 2}
    Independent answer
    Divide by x2x^2: 35\tfrac35.
    RatMath code
    symbolic.limit("(3x^2 - x)/(5x^2 + 2)", "x", "inf").value
    Output
    3/5
  3. 3.Product ruleAgrees
    Differentiate x3sin⁡xx^3\sin x.
    Independent answer
    3x2sin⁡x+x3cos⁡x3x^2\sin x + x^3\cos x.
    RatMath code
    symbolic.sym("x^3*sin(x)").diff("x")
    Output
    3*x^2*sin(x) + x^3*cos(x)
  4. 4.Quotient ruleAgrees
    Differentiate x2+1x−2\dfrac{x^2 + 1}{x - 2}.
    Independent answer
    2x(x−2)−(x2+1)(x−2)2=x2−4x−1(x−2)2\dfrac{2x(x - 2) - (x^2 + 1)}{(x - 2)^2} = \dfrac{x^2 - 4x - 1}{(x - 2)^2}.
    RatMath code
    symbolic.simplify(symbolic.sym("(x^2 + 1)/(x - 2)").diff("x"))
    Output
    (x^2 - 4*x - 1)/(x - 2)^2
  5. 5.Chain ruleAgrees
    Differentiate 3x2+1\sqrt{3x^2 + 1}.
    Independent answer
    6x23x2+1=3x3x2+1\dfrac{6x}{2\sqrt{3x^2 + 1}} = \dfrac{3x}{\sqrt{3x^2 + 1}}.
    RatMath code
    symbolic.simplify(symbolic.sym("sqrt(3x^2 + 1)").diff("x"))
    Output
    3*x/sqrt(3*x^2 + 1)
  6. 6.Exponentials and logarithmsAgrees
    Differentiate e2xln⁡xe^{2x}\ln x.
    Independent answer
    2e2xln⁡x+e2xx2e^{2x}\ln x + \dfrac{e^{2x}}{x}.
    RatMath code
    symbolic.sym("exp(2x)*log(x)").diff("x")
    Output
    2*exp(2*x)*log(x) + exp(2*x)*(1/x)
  7. 7.Implicit differentiationAgrees
    Find dy/dxdy/dx for x2+y2=25x^2 + y^2 = 25 at the point (3,4)(3, 4).
    Independent answer
    2x+2yy′=02x + 2yy' = 0, y′=−x/y=−34y' = -x/y = -\tfrac34.
    RatMath code
    const d = symbolic.implicitDiff("x^2 + y^2 = 25", "x", "y");
    PRINT("dy/dx =", d.first);
    d.at({ x: 3, y: 4 }).first
    Output
    -3/4
    implicitDiff differentiates with y=y(x)y = y(x) and solves for y′y'; at checks the point is on the curve.
    Fix: ratmath/symbolic#9, completeSquare, compose, sinusoid, inverse trig values, within, RealSet operations and chained inequalities, implicitDiff, leibniz, constant factors in sum
  8. 8.Tangent lineAgrees
    Find the tangent line to y=x3−2xy = x^3 - 2x at x=1x = 1.
    Independent answer
    y(1)=−1y(1) = -1, y′(1)=1y'(1) = 1: y=x−2y = x - 2.
    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}`)
    Output
    x - 2
  9. 9.Critical pointsAgrees
    Find and classify the critical points of f(x)=x3−3x2−9x+5f(x) = x^3 - 3x^2 - 9x + 5.
    Independent answer
    f′=3(x−3)(x+1)f' = 3(x - 3)(x + 1). Local maximum f(−1)=10f(-1) = 10; local minimum f(3)=−22f(3) = -22.
    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. 10.Absolute extremaAgrees
    Find the absolute maximum and minimum of f(x)=x3−3xf(x) = x^3 - 3x on [0,2][0, 2].
    Independent answer
    f′(x)=0f'(x) = 0 at x=1x = 1; f(0)=0f(0) = 0, f(1)=−2f(1) = -2, f(2)=2f(2) = 2. Max 2 at x=2x = 2, min −2-2 at x=1x = 1.
    RatMath code
    analytic.extrema("x^3 - 3x", [0, 2]).exact().map((e) => [e.kind, e.at, e.value])
    Output
    [["min", 1, -2]]
  11. 11.Inflection pointsAgrees
    Find the inflection points of f(x)=x4−6x2f(x) = x^4 - 6x^2.
    Independent answer
    f′′=12x2−12=0f'' = 12x^2 - 12 = 0 at x=±1x = \pm 1, where f′′f'' changes sign: (−1,−5)(-1, -5) and (1,−5)(1, -5).
    RatMath code
    analytic.inflections("x^4 - 6x^2", [-3, 3]).exact().map((p) => [p.at, p.value])
    Output
    [[-1, -5], [1, -5]]
  12. 12.Related ratesAgrees
    A balloon's radius grows at 2 cm/s. How fast is its volume growing when the radius is 5 cm?
    Independent answer
    V˙=4πr2r˙=4π⋅25⋅2=200π cm3/s\dot V = 4\pi r^2 \dot r = 4\pi \cdot 25 \cdot 2 = 200\pi\ \text{cm}^3/\text{s}.
    RatMath code
    symbolic.simplify(String(symbolic.sym("4/3*pi*r^3").diff("r").subs({ r: 5 })) + "*2")
    Output
    200*pi
  13. 13.OptimisationAgrees
    A rectangle has perimeter 40. What dimensions give the greatest area?
    Independent answer
    A=x(20−x)A = x(20 - x), A′=20−2x=0A' = 20 - 2x = 0: 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. 14.Linear approximationAgrees
    Use a linear approximation to estimate 4.1\sqrt{4.1}.
    Independent answer
    2+14(0.1)=2.0252 + \tfrac{1}{4}(0.1) = 2.025.
    RatMath code
    symbolic.taylor("sqrt(x)", "x", 4, 1)
    Output
    2 + 1/4*(x - 4) + …
  15. 15.Newton's methodAgrees
    Apply Newton's method to x2−2=0x^2 - 2 = 0 from x0=1x_0 = 1. Give x1,x2,x3x_1, x_2, x_3 as fractions.
    Independent answer
    xn+1=xn2+1xnx_{n+1} = \tfrac{x_n}{2} + \tfrac{1}{x_n}: 32,1712,577408\tfrac32, \tfrac{17}{12}, \tfrac{577}{408}.
    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]
    newton with exact: true keeps 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. 16.Riemann sumAgrees
    Compute the left Riemann sum for ∫02x2 dx\int_0^2 x^2\,dx with 4 equal subintervals.
    Independent answer
    12(0+14+1+94)=74\tfrac12(0 + \tfrac14 + 1 + \tfrac94) = \tfrac74.
    RatMath code
    sum(0, 3, (i) => R`(${i}/2)^2 * 1/2`)
    Output
    7/4
  17. 17.Definite integralAgrees
    ∫13(2x+1) dx\displaystyle\int_1^3 (2x + 1)\,dx
    Independent answer
    [x2+x]13=12−2=10[x^2 + x]_1^3 = 12 - 2 = 10.
    RatMath code
    symbolic.integrate("2x + 1", "x", { from: 1, to: 3 }).value
    Output
    10
  18. 18.Fundamental theoremAgrees
    ddx∫0x2cos⁡t dt\dfrac{d}{dx}\displaystyle\int_0^{x^2}\cos t\,dt
    Independent answer
    2xcos⁡(x2)2x\cos(x^2).
    RatMath code
    symbolic.leibniz("cos(t)", "t", "0", "x^2").value
    Output
    2*x*cos(x^2)
    leibniz applies the fundamental theorem with the chain rule: f(b(x)) b′(x)−f(a(x)) a′(x)f(b(x))\,b'(x) - f(a(x))\,a'(x).
    Fix: ratmath/symbolic#9, completeSquare, compose, sinusoid, inverse trig values, within, RealSet operations and chained inequalities, implicitDiff, leibniz, constant factors in sum
  19. 19.SubstitutionAgrees
    ∫x(x2+1)5 dx\displaystyle\int x(x^2 + 1)^5\,dx
    Independent answer
    u=x2+1u = x^2 + 1: (x2+1)612+C\tfrac{(x^2 + 1)^6}{12} + C.
    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")
    Output
    equal (normal form)
  20. 20.Area between curvesAgrees
    Find the area between y=x2y = x^2 and y=x+2y = x + 2.
    Independent answer
    They meet at x=−1,2x = -1, 2: ∫−12(x+2−x2) dx=92\int_{-1}^2 (x + 2 - x^2)\,dx = \tfrac92.
    RatMath code
    symbolic.integrate("x + 2 - x^2", "x", { from: -1, to: 2 }).value
    Output
    9/2