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.Dot and cross productsAgreesFor and find and .Independent answer; .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 3Dvectorhas dot and cross products.Fix: ratmath/geo#11, measurement helpers, 3Dvectorandplane,conicProperties; topology:surface,simplicialComplex, finite spaces - 2.Plane through three pointsAgreesFind the plane through , , .Independent answerNormal : .RatMath code
geo.plane([1, 0, 2], [2, 1, 0], [0, 3, 1]).equationOutput5x + 3y + 4z = 13
planetakes the normal as a cross product and prints the equation with whole coefficients.Fix: ratmath/geo#11, measurement helpers, 3Dvectorandplane,conicProperties; topology:surface,simplicialComplex, finite spaces - 3.Partial derivativesAgreesFor find and .Independent answer, .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.Directional derivativeAgreesFor , find at and the derivative in the direction .Independent answer; unit direction : .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.Tangent planeAgreesFind the tangent plane to at .Independent answer.RatMath code
analytic.field("x^2 + y^2", ["x", "y"]).linearization([1, 2]).toString()Output5 + 2*(x - 1) + 4*(y - 2)
- 6.Second derivative testAgreesFind and classify the critical points of .Independent answer, : and . : saddle at the origin; , : local minimum at .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.Lagrange multipliersAgreesFind the maximum of on the circle .Independent answer, give : maximum 4 at .RatMath code
analytic.lagrange("x*y", "x^2 + y^2 - 8", ["x", "y"], { x: [-3, 3], y: [-3, 3] }).max.valueOutput3.99999999999999999999:4.00000000000000000001
- 8.Double integralAgreesIndependent answerInner: . Outer: .RatMath code
symbolic.integrate(String(symbolic.integrate("x + y^2", "y", { from: 0, to: 2 }).value), "x", { from: 0, to: 1 }).valueOutput11/3
- 9.Reversing the orderAgreesIndependent answerReverse: .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"]
reverseOrderdescribes the triangle with 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"). - 10.Polar coordinatesAgreesIndependent answer.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"] }).valueOutput3.0840523612227521336:3.08405239204927601998
- 11.Triple integralAgreesFind the volume of the tetrahedron , .Independent answer.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 }).valueOutput1/6
- 12.Spherical coordinatesAgreesUse spherical coordinates to find the volume of a ball of radius 2.Independent answer.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`)Output32*pi/3
- 13.JacobianAgreesFind the Jacobian determinant of , .Independent answer.RatMath code
analytic.changeOfVariables("1", ["x", "y"], { x: "r*cos(t)", y: "r*sin(t)" }, ["r", "t"], { r: [0, 1], t: [0, 1] }).determinantOutputr
- 14.Conservative fieldAgreesFind along any path from to .Independent answer: the integral is .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.CirculationAgreesFind around the unit circle, counterclockwise.Independent answerWith , : .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()Output6.2831853071795[8289406:9005979]
lineIntegralrefuses an end such as"2*pi"("not a number") althoughsurfaceIntegralandcurve().lengthaccept it; the curve is reparametrised over . - 16.Green's theoremAgreesUse Green's theorem for around the unit square , counterclockwise.Independent answer.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.Divergence and curlAgreesFor find and .Independent answer; .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.Divergence theoremAgreesFind the flux of out of the unit sphere.Independent answer.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()Output12.5663643516400401201:12.56637685120204579867
- 19.Surface areaAgreesFind the area of the part of below .Independent answer.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()Output5.33041[088120323048454:619438729317831]
- 20.Curves in spaceAgreesFor the helix , find the length for and the curvature.Independent answerSpeed : length . Curvature .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"]