Course Test · University: first two years

Calculus II: 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.Integration by partsAgrees
    ∫xex dx\displaystyle\int x e^x\,dx
    Independent answer
    xex−ex+Cxe^x - e^x + C.
    RatMath code
    symbolic.integrate("x*exp(x)", "x").result
    Output
    x*exp(x) - exp(x)
  2. 2.Parts with a logarithmAgrees
    ∫x2ln⁡x dx\displaystyle\int x^2\ln x\,dx
    Independent answer
    x33ln⁡x−x39+C\tfrac{x^3}{3}\ln x - \tfrac{x^3}{9} + C.
    RatMath code
    symbolic.integrate("x^2*log(x)", "x").result
    Output
    -x^3/9 + x^3*log(x)/3
  3. 3.Trigonometric integralAgrees
    ∫sin⁡3x dx\displaystyle\int \sin^3 x\,dx
    Independent answer
    ∫(1−cos⁡2x)sin⁡x dx=−cos⁡x+cos⁡3x3+C\int (1 - \cos^2 x)\sin x\,dx = -\cos x + \tfrac{\cos^3 x}{3} + C.
    RatMath code
    const F = symbolic.integrate("sin(x)^3", "x");
    PRINT(F);
    symbolic.equal(String(F.result), "-cos(x) + cos(x)^3/3")
    Output
    equal (normal form, after the rules the assumptions allow)
  4. 4.Arctangent formAgrees
    ∫dxx2+4\displaystyle\int \frac{dx}{x^2 + 4}
    Independent answer
    12arctan⁡x2+C\tfrac12\arctan\tfrac x2 + C.
    RatMath code
    symbolic.integrate("1/(x^2 + 4)", "x").result
    Output
    atan(x/2)/2
  5. 5.Trigonometric substitutionAgrees
    ∫dx9−x2\displaystyle\int \frac{dx}{\sqrt{9 - x^2}}
    Independent answer
    arcsin⁡x3+C\arcsin\tfrac x3 + C.
    RatMath code
    symbolic.integrate("1/sqrt(9 - x^2)", "x").result
    Output
    asin(x/3)
  6. 6.Partial fractionsAgrees
    ∫3x+5(x+1)(x+2) dx\displaystyle\int \frac{3x + 5}{(x + 1)(x + 2)}\,dx
    Independent answer
    2x+1+1x+2\tfrac{2}{x + 1} + \tfrac{1}{x + 2}: 2ln⁡∣x+1∣+ln⁡∣x+2∣+C2\ln|x + 1| + \ln|x + 2| + C.
    RatMath code
    [symbolic.apart("(3x + 5)/((x + 1)(x + 2))", "x"), symbolic.integrate("(3x + 5)/((x + 1)(x + 2))", "x").result]
    Output
    [2/(x + 1) + 1/(x + 2), 2*log(abs(1 + x)) + log(abs(2 + x))]
  7. 7.Improper integral, infinite intervalAgrees
    ∫1∞dxx2\displaystyle\int_1^\infty \frac{dx}{x^2}
    Independent answer
    lim⁡b→∞(1−1/b)=1\lim_{b\to\infty}(1 - 1/b) = 1.
    RatMath code
    symbolic.integrate("1/x^2", "x", { from: 1, to: "inf" }).value
    Output
    1
    Bug: to: "inf" was read as a letter named inf, so the value came back as (inf - 1)/inf.
    Fix: ratmath/symbolic#8, improper integrals: "inf" ends and integrands unbounded at an end
  8. 8.Improper integral, unbounded integrandAgrees
    ∫01dxx\displaystyle\int_0^1 \frac{dx}{\sqrt x}
    Independent answer
    [2x]01=2[2\sqrt x]_0^1 = 2.
    RatMath code
    symbolic.integrate("1/sqrt(x)", "x", { from: 0, to: 1 }).value
    Output
    2
    symbolic finds 2x2\sqrt x but declines the definite integral (value null: the integrand cannot be bounded on the interval). That is honest, but the improper integral converges and the antiderivative has a limit at 0.
    Fix: ratmath/symbolic#8, improper integrals: "inf" ends and integrands unbounded at an end
  9. 9.Volume of revolutionAgrees
    The region under y=xy = \sqrt x, 0≤x≤40 \le x \le 4, is turned about the xx-axis. Find the volume.
    Independent answer
    π∫04x dx=8π\pi\int_0^4 x\,dx = 8\pi.
    RatMath code
    symbolic.integrate("pi*sqrt(x)^2", "x", { from: 0, to: 4 }).value
    Output
    8*pi
  10. 10.Arc lengthAgrees
    Find the length of y=23x3/2y = \tfrac23 x^{3/2} from x=0x = 0 to x=3x = 3.
    Independent answer
    ∫031+x dx=23(8−1)=143\int_0^3 \sqrt{1 + x}\,dx = \tfrac23(8 - 1) = \tfrac{14}{3}.
    RatMath code
    const dy = symbolic.sym("2/3*x^(3/2)").diff("x");
    symbolic.integrate(`sqrt(1 + (${dy})^2)`, "x", { from: 0, to: 3 }).value
    Output
    14/3
  11. 11.Simpson's ruleAgrees
    Use Simpson's rule with n=4n = 4 to estimate ∫01dx1+x2\int_0^1 \frac{dx}{1 + x^2}. Compare with the exact value.
    Independent answer
    112[1+4⋅1617+2⋅45+4⋅1625+12]=801110200≈0.785392\tfrac{1}{12}\bigl[1 + 4\cdot\tfrac{16}{17} + 2\cdot\tfrac45 + 4\cdot\tfrac{16}{25} + \tfrac12\bigr] = \tfrac{8011}{10200} \approx 0.785392; exact π/4≈0.785398\pi/4 \approx 0.785398.
    RatMath code
    const f = (x) => R`1/(1 + ${x}^2)`, h = R`1/4`;
    const S = h.divide(R`3`).multiply(f(0).add(R`4`.multiply(f(h))).add(R`2`.multiply(f(R`1/2`))).add(R`4`.multiply(f(R`3/4`))).add(f(1)));
    [S, symbolic.integrate("1/(1 + x^2)", "x", { from: 0, to: 1 }).value]
    Output
    [8011/10200, pi/4]
  12. 12.Limit of a sequenceAgrees
    lim⁡n→∞(1+2n)n\displaystyle\lim_{n\to\infty}\left(1 + \frac2n\right)^n
    Independent answer
    e2e^2.
    RatMath code
    symbolic.limit("(1 + 2/n)^n", "n", "inf").value
    Output
    e^2
  13. 13.p-seriesAgrees
    Does ∑n≥11/n2\sum_{n\ge1} 1/n^2 converge? What is its sum?
    Independent answer
    Yes (a pp-series with p=2>1p = 2 > 1); the sum is π2/6\pi^2/6.
    RatMath code
    [analytic.sum("1/k^2", { variable: "k" }).convergence().convergence, symbolic.sum("1/k^2", "k", 1, "inf").value]
    Output
    ["absolutely convergent", pi^2/6]
  14. 14.Ratio testAgrees
    Show ∑n≥1n2/2n\sum_{n\ge1} n^2/2^n converges and find its sum.
    Independent answer
    Ratio →12<1\to \tfrac12 < 1. Using ∑n2xn=x(1+x)(1−x)3\sum n^2x^n = \tfrac{x(1 + x)}{(1 - x)^3} at x=12x = \tfrac12: sum 6.
    RatMath code
    [analytic.sum("k^2/2^k", { variable: "k" }).ratioTest().conclusion ?? analytic.sum("k^2/2^k", { variable: "k" }).convergence().convergence, symbolic.sum("k^2/2^k", "k", 1, "inf").value]
    Output
    ["absolutely convergent", 6]
  15. 15.Alternating seriesAgrees
    Does ∑n≥1(−1)n+1/n\sum_{n\ge1} (-1)^{n+1}/n converge absolutely, conditionally, or not at all? What is the sum?
    Independent answer
    Conditionally (the harmonic series diverges; the alternating series test applies). Sum ln⁡2\ln 2.
    RatMath code
    [analytic.sum("(-1)^(k+1)/k", { variable: "k" }).convergence().convergence, symbolic.sum("(-1)^(k+1)/k", "k", 1, "inf").value]
    Output
    ["conditionally convergent", log(2)]
  16. 16.Interval of convergenceAgrees
    Find the interval of convergence of ∑n≥1(x−3)nn 2n\displaystyle\sum_{n\ge1}\frac{(x - 3)^n}{n\,2^n}.
    Independent answer
    R=2R = 2. At x=5x = 5: harmonic, diverges; at x=1x = 1: alternating harmonic, converges. [1,5)[1, 5).
    RatMath code
    analytic.powerSeries("1/(n*2^n)", { index: "n", from: 1, centre: 3 }).interval().text
    Output
    [1, 5)
  17. 17.Taylor polynomialAgrees
    Find the degree-4 Taylor polynomial of cos⁡x\cos x at 0.
    Independent answer
    1−x22+x4241 - \tfrac{x^2}{2} + \tfrac{x^4}{24}.
    RatMath code
    symbolic.taylor("cos(x)", "x", 0, 4)
    Output
    1 - 1/2*x^2 + 1/24*x^4 + …
  18. 18.Taylor series about a pointAgrees
    Expand exe^x about x=1x = 1 up to (x−1)3(x - 1)^3.
    Independent answer
    e[1+(x−1)+(x−1)22+(x−1)36]e\left[1 + (x - 1) + \tfrac{(x-1)^2}{2} + \tfrac{(x-1)^3}{6}\right].
    RatMath code
    symbolic.taylor("exp(x)", "x", 1, 3)
    Output
    e + e*(x - 1) + e/2*(x - 1)^2 + e/6*(x - 1)^3 + …
  19. 19.Remainder boundAgrees
    Approximate e0.1e^{0.1} by its degree-2 Maclaurin polynomial and bound the error.
    Independent answer
    1+0.1+0.005=1.1051 + 0.1 + 0.005 = 1.105. ∣R2∣≤e0.1(0.1)36<1.2⋅0.0016=0.0002|R_2| \le e^{0.1}\tfrac{(0.1)^3}{6} < 1.2 \cdot \tfrac{0.001}{6} = 0.0002. (True error 0.0001710.000171.)
    RatMath code
    const T = symbolic.taylor("exp(x)", "x", 0, 2);
    const r = analytic.taylorRemainder("exp(x)", { about: 0, order: 2, on: [0, "0.1"] });
    [String(T.polynomial), T.polynomial.evaluate({ x: "0.1" }).low.toDecimal(), r.bound.lessThan(R`0.0002`), r.actual.high.toDecimal(6)]
    Output
    ["1 + x + 1/2*x^2", "1.105", true, "0.000170"]
    taylorRemainder gives Lagrange's bound (below 0.0002) and an enclosure of the true maximum error.
  20. 20.Polar areaAgrees
    Find the area inside r=2cos⁡θr = 2\cos\theta.
    Independent answer
    12∫−π/2π/24cos⁡2θ dθ=π\tfrac12\int_{-\pi/2}^{\pi/2} 4\cos^2\theta\,d\theta = \pi (a circle of radius 1).
    RatMath code
    symbolic.integrate("1/2*(2cos(t))^2", "t", { from: "-pi/2", to: "pi/2" }).value
    Output
    pi