Course Test · University: first two years

Calculus III: several variables and vector calculus: 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, geo. 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.Dot and cross productsAgrees
    For u=(1,2,−2)\mathbf u = (1, 2, -2) and v=(3,0,4)\mathbf v = (3, 0, 4) find u⋅v\mathbf u\cdot\mathbf v and u×v\mathbf u\times\mathbf v.
    Independent answer
    u⋅v=3−8=−5\mathbf u\cdot\mathbf v = 3 - 8 = -5; u×v=(8,−10,−6)\mathbf u\times\mathbf v = (8, -10, -6).
    RatMath code
    const u = geo.vector(1, 2, -2);
    [u.dot([3, 0, 4]), String(u.cross([3, 0, 4]))]
    Output
    [-5, "(8, -10, -6)"]
    geo's 3D vector has dot and cross products.
    Fix: ratmath/geo#11, measurement helpers, 3D vector and plane, conicProperties; topology: surface, simplicialComplex, finite spaces
  2. 2.Plane through three pointsAgrees
    Find the plane through (1,0,2)(1, 0, 2), (2,1,0)(2, 1, 0), (0,3,1)(0, 3, 1).
    Independent answer
    Normal (1,1,−2)×(−1,3,−1)=(5,3,4)(1, 1, -2)\times(-1, 3, -1) = (5, 3, 4): 5x+3y+4z=135x + 3y + 4z = 13.
    RatMath code
    geo.plane([1, 0, 2], [2, 1, 0], [0, 3, 1]).equation
    Output
    5x + 3y + 4z = 13
    plane takes the normal as a cross product and prints the equation with whole coefficients.
    Fix: ratmath/geo#11, measurement helpers, 3D vector and plane, conicProperties; topology: surface, simplicialComplex, finite spaces
  3. 3.Partial derivativesAgrees
    For f(x,y)=x2y3+exyf(x, y) = x^2y^3 + e^{xy} find fxf_x and fyf_y.
    Independent answer
    fx=2xy3+yexyf_x = 2xy^3 + ye^{xy}, fy=3x2y2+xexyf_y = 3x^2y^2 + xe^{xy}.
    RatMath code
    const f = symbolic.sym("x^2*y^3 + exp(x*y)");
    [f.diff("x"), f.diff("y")]
    Output
    [2*x*y^3 + exp(x*y)*y, 3*x^2*y^2 + exp(x*y)*x]
  4. 4.Directional derivativeAgrees
    For f=x2y+yzf = x^2y + yz, find ∇f\nabla f at (1,2,3)(1, 2, 3) and the derivative in the direction (2,1,−2)(2, 1, -2).
    Independent answer
    ∇f=(2xy,x2+z,y)=(4,4,2)\nabla f = (2xy, x^2 + z, y) = (4, 4, 2); unit direction 13(2,1,−2)\tfrac13(2, 1, -2): 8+4−43=83\tfrac{8 + 4 - 4}{3} = \tfrac83.
    RatMath code
    const f = analytic.field("x^2*y + y*z", ["x", "y", "z"]);
    [f.gradient().map((g) => g.value([1, 2, 3]).exact()), f.directional([1, 2, 3], [2, 1, -2]).exact()]
    Output
    [[4, 4, 2], 8/3]
  5. 5.Tangent planeAgrees
    Find the tangent plane to z=x2+y2z = x^2 + y^2 at (1,2)(1, 2).
    Independent answer
    z=5+2(x−1)+4(y−2)=2x+4y−5z = 5 + 2(x - 1) + 4(y - 2) = 2x + 4y - 5.
    RatMath code
    analytic.field("x^2 + y^2", ["x", "y"]).linearization([1, 2]).toString()
    Output
    5 + 2*(x - 1) + 4*(y - 2)
  6. 6.Second derivative testAgrees
    Find and classify the critical points of f=x3+y3−3xyf = x^3 + y^3 - 3xy.
    Independent answer
    fx=3x2−3yf_x = 3x^2 - 3y, fy=3y2−3xf_y = 3y^2 - 3x: (0,0)(0, 0) and (1,1)(1, 1). D=36xy−9D = 36xy - 9: −9<0-9 < 0 saddle at the origin; 27>027 > 0, fxx=6>0f_{xx} = 6 > 0: local minimum −1-1 at (1,1)(1, 1).
    RatMath code
    const mid = (iv) => Number(iv.low.add(iv.high).toNumber() / 2).toFixed(12);
    analytic.field("x^3 + y^3 - 3*x*y", ["x", "y"]).criticalPoints({ x: [-2, 2], y: [-2, 2] }).exact().map((c) => [c.kind, c.point.map(mid), mid(c.value)])
    Output
    [["saddle", ["0.000000000000", "0.000000000000"], "0.000000000000"], ["min", ["1.000000000000", "1.000000000000"], "-1.000000000000"]]
    Certified: each point comes as a tiny box proven to hold exactly one critical point (shown here by its midpoint).
  7. 7.Lagrange multipliersAgrees
    Find the maximum of xyxy on the circle x2+y2=8x^2 + y^2 = 8.
    Independent answer
    y=2λxy = 2\lambda x, x=2λyx = 2\lambda y give x2=y2=4x^2 = y^2 = 4: maximum 4 at ±(2,2)\pm(2, 2).
    RatMath code
    analytic.lagrange("x*y", "x^2 + y^2 - 8", ["x", "y"], { x: [-3, 3], y: [-3, 3] }).max.value
    Output
    3.99999999999999999999:4.00000000000000000001
  8. 8.Double integralAgrees
    ∫01 ⁣ ⁣∫02(x+y2) dy dx\displaystyle\int_0^1\!\!\int_0^2 (x + y^2)\,dy\,dx
    Independent answer
    Inner: 2x+832x + \tfrac83. Outer: 1+83=1131 + \tfrac83 = \tfrac{11}{3}.
    RatMath code
    symbolic.integrate(String(symbolic.integrate("x + y^2", "y", { from: 0, to: 2 }).value), "x", { from: 0, to: 1 }).value
    Output
    11/3
  9. 9.Reversing the orderAgrees
    ∫01 ⁣ ⁣∫x1ey2 dy dx\displaystyle\int_0^1\!\!\int_x^1 e^{y^2}\,dy\,dx
    Independent answer
    Reverse: ∫01∫0yey2 dx dy=∫01yey2 dy=e−12\int_0^1\int_0^y e^{y^2}\,dx\,dy = \int_0^1 ye^{y^2}\,dy = \tfrac{e - 1}{2}.
    RatMath code
    const r = symbolic.reverseOrder("exp(y^2)", { outer: ["x", 0, 1], inner: ["y", "x", 1] });
    [r.text, String(r.value), r.agree]
    Output
    ["∫ from 0 to 1 ∫ from 0 to y exp(y^2) dx dy", "e/2 - 1/2", "checked"]
    reverseOrder describes the triangle with yy outside and integrates in that order. The original order has no closed form, so the two are compared as certified numerical values over the region (agree: "checked").
    Fix: ratmath/symbolic#10, eliminate (resultants over sin and cos) and reverseOrder
  10. 10.Polar coordinatesAgrees
    ∬x2+y2≤4e−(x2+y2) dA\displaystyle\iint_{x^2 + y^2 \le 4} e^{-(x^2 + y^2)}\,dA
    Independent answer
    ∫02π ⁣∫02e−r2r dr dθ=π(1−e−4)≈3.0841\int_0^{2\pi}\!\int_0^2 e^{-r^2} r\,dr\,d\theta = \pi(1 - e^{-4}) \approx 3.0841.
    RatMath code
    analytic.changeOfVariables("exp(-(x^2 + y^2))", ["x", "y"], { x: "r*cos(t)", y: "r*sin(t)" }, ["r", "t"], { r: [0, 2], t: [0, "2*pi"] }).value
    Output
    3.0840523612227521336:3.08405239204927601998
  11. 11.Triple integralAgrees
    Find the volume of the tetrahedron x,y,z≥0x, y, z \ge 0, x+y+z≤1x + y + z \le 1.
    Independent answer
    ∫01∫01−x(1−x−y) dy dx=16\int_0^1\int_0^{1-x}(1 - x - y)\,dy\,dx = \tfrac16.
    RatMath code
    const inner = symbolic.integrate("1 - x - y", "y", { from: 0, to: "1 - x" }).value;
    symbolic.integrate(String(inner), "x", { from: 0, to: 1 }).value
    Output
    1/6
  12. 12.Spherical coordinatesAgrees
    Use spherical coordinates to find the volume of a ball of radius 2.
    Independent answer
    ∫02π∫0π∫02ρ2sin⁡ϕ dρ dϕ dθ=32π3\int_0^{2\pi}\int_0^\pi\int_0^2 \rho^2\sin\phi\,d\rho\,d\phi\,d\theta = \tfrac{32\pi}{3}.
    RatMath code
    const r = symbolic.integrate("rho^2", "rho", { from: 0, to: 2 }).value;          // 8/3
    const p = symbolic.integrate("sin(phi)", "phi", { from: 0, to: "pi" }).value;      // 2
    symbolic.simplify(`(${r})*(${p})*2*pi`)
    Output
    32*pi/3
  13. 13.JacobianAgrees
    Find the Jacobian determinant of x=rcos⁡θx = r\cos\theta, y=rsin⁡θy = r\sin\theta.
    Independent answer
    cos⁡θ⋅rcos⁡θ−(−rsin⁡θ)sin⁡θ=r\cos\theta\cdot r\cos\theta - (-r\sin\theta)\sin\theta = r.
    RatMath code
    analytic.changeOfVariables("1", ["x", "y"], { x: "r*cos(t)", y: "r*sin(t)" }, ["r", "t"], { r: [0, 1], t: [0, 1] }).determinant
    Output
    r
  14. 14.Conservative fieldAgrees
    Find ∫Cy dx+x dy\int_C y\,dx + x\,dy along any path from (0,0)(0, 0) to (1,2)(1, 2).
    Independent answer
    F=∇(xy)\mathbf F = \nabla(xy): the integral is xy∣(0,0)(1,2)=2xy\big|_{(0,0)}^{(1,2)} = 2.
    RatMath code
    const P = analytic.potential(["y", "x"], ["x", "y"]);
    [P.conservative, String(P.potential), P.value([1, 2], [0, 0])]
    Output
    [true, "x*y", 2]
  15. 15.CirculationAgrees
    Find ∮C−y dx+x dy\oint_C -y\,dx + x\,dy around the unit circle, counterclockwise.
    Independent answer
    With x=cos⁡tx = \cos t, y=sin⁡ty = \sin t: ∫02π(sin⁡2t+cos⁡2t) dt=2π\int_0^{2\pi}(\sin^2 t + \cos^2 t)\,dt = 2\pi.
    RatMath code
    // the parameter interval must be rational, so t runs over [0, 1] and the angle is 2πt
    analytic.lineIntegral(["-y", "x"], ["x", "y"], { x: "cos(2*pi*t)", y: "sin(2*pi*t)" }, [0, 1]).exact()
    Output
    6.2831853071795[8289406:9005979]
    lineIntegral refuses an end such as "2*pi" ("not a number") although surfaceIntegral and curve().length accept it; the curve is reparametrised over [0,1][0, 1].
  16. 16.Green's theoremAgrees
    Use Green's theorem for ∮Cx2y dx+x dy\oint_C x^2y\,dx + x\,dy around the unit square [0,1]2[0,1]^2, counterclockwise.
    Independent answer
    ∬(1−x2) dA=1−13=23\iint (1 - x^2)\,dA = 1 - \tfrac13 = \tfrac23.
    RatMath code
    const g = analytic.greens(["x^2*y", "x"], ["x", "y"], { x: [0, 1], y: [0, 1] });
    [g.agree, g.right.value]
    Output
    [true, 2/3]
  17. 17.Divergence and curlAgrees
    For F=(xy,yz,zx)\mathbf F = (xy, yz, zx) find ∇⋅F\nabla\cdot\mathbf F and ∇×F\nabla\times\mathbf F.
    Independent answer
    ∇⋅F=x+y+z\nabla\cdot\mathbf F = x + y + z; ∇×F=(−y,−z,−x)\nabla\times\mathbf F = (-y, -z, -x).
    RatMath code
    const F = ["x*y", "y*z", "z*x"], V = ["x", "y", "z"];
    [String(analytic.divergence(F, V)), analytic.curl(F, V).map(String)]
    Output
    ["y + z + x", ["-y", "-z", "-x"]]
  18. 18.Divergence theoremAgrees
    Find the flux of F=(x,y,z)\mathbf F = (x, y, z) out of the unit sphere.
    Independent answer
    ∭3 dV=3⋅43π=4π\iiint 3\,dV = 3\cdot\tfrac43\pi = 4\pi.
    RatMath code
    analytic.surfaceIntegral(["x", "y", "z"], ["x", "y", "z"], { x: "sin(u)*cos(v)", y: "sin(u)*sin(v)", z: "cos(u)" }, ["u", "v"], { u: [0, "pi"], v: [0, "2*pi"] }).exact()
    Output
    12.5663643516400401201:12.56637685120204579867
  19. 19.Surface areaAgrees
    Find the area of the part of z=x2+y2z = x^2 + y^2 below z=1z = 1.
    Independent answer
    ∫02π∫011+4r2 r dr dθ=π6(55−1)≈5.3304\int_0^{2\pi}\int_0^1 \sqrt{1 + 4r^2}\,r\,dr\,d\theta = \tfrac{\pi}{6}(5\sqrt5 - 1) \approx 5.3304.
    RatMath code
    analytic.surfaceIntegral("1", ["x", "y", "z"], { x: "r*cos(t)", y: "r*sin(t)", z: "r^2" }, ["r", "t"], { r: [0, 1], t: [0, "2*pi"] }).exact()
    Output
    5.33041[088120323048454:619438729317831]
  20. 20.Curves in spaceAgrees
    For the helix r(t)=(cos⁡t,sin⁡t,t)\mathbf r(t) = (\cos t, \sin t, t), find the length for 0≤t≤2π0 \le t \le 2\pi and the curvature.
    Independent answer
    Speed 2\sqrt2: length 22 π≈8.88582\sqrt2\,\pi \approx 8.8858. Curvature ∣r′×r′′∣∣r′∣3=222=12\tfrac{|\mathbf r'\times\mathbf r''|}{|\mathbf r'|^3} = \tfrac{\sqrt2}{2\sqrt2} = \tfrac12.
    RatMath code
    const c = analytic.curve(["cos(t)", "sin(t)", "t"], "t");
    [c.length([0, "2*pi"]), c.curvature()]
    Output
    [8.8857658763167324940[2:4], "1/2"]