Course Test · School: high school
Precalculus and trigonometry: 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, linalg, graphics, symbolic, complex, 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.Exact valuesAgreesFind , and .Independent answer, , .RatMath code
["sin(5pi/6)", "cos(7pi/4)", "tan(2pi/3)"].map((e) => symbolic.simplify(e))Output[1/2, sqrt(2)/2, -sqrt(3)]
- 2.RadiansAgreesConvert to radians.Independent answer.RatMath code
symbolic.simplify("225*pi/180")Output5*pi/4
- 3.Trigonometric equationAgreesSolve for .Independent answer: .RatMath code
symbolic.solve("2cos(x)^2 - cos(x) - 1 = 0", "x").within("[0, 2*pi)").map(String)Output["0", "2*pi/3", "4*pi/3"]
symbolic merges the three families into one, ;withinlists its members in , each placed by an exact comparison.Fix: ratmath/symbolic#9,completeSquare,compose,sinusoid, inverse trig values,within,RealSetoperations and chained inequalities,implicitDiff,leibniz, constant factors insum - 4.Verifying an identityAgreesVerify .Independent answer(where ).RatMath code
symbolic.equal("(1 - cos(2x))/sin(2x)", "tan(x)")Outputequal (normal form, after the rules the assumptions allow)
- 5.Sum formulaAgreesFind the exact value of .Independent answer.RatMath code
symbolic.simplify("sin(5pi/12)")Outputsqrt(6)/4 + sqrt(2)/4
- 6.SinusoidsAgreesGive the amplitude, period, phase shift and midline of .Independent answerAmplitude 3, period , phase shift to the right, midline .RatMath code
const s = symbolic.sinusoid("3sin(2x - pi/2) + 1"); [s.amplitude, s.period, s.phaseShift, s.midline].map(String)Output["3", "pi", "pi/4", "1"]
sinusoidreads ; the phase shift is to the right.Fix: ratmath/symbolic#9,completeSquare,compose,sinusoid, inverse trig values,within,RealSetoperations and chained inequalities,implicitDiff,leibniz, constant factors insum - 7.Inverse trigonometryAgreesFind and .Independent answer; a 3–4–5 triangle gives .RatMath code
[symbolic.simplify("asin(-sqrt(3)/2)"), symbolic.simplify("cos(atan(3/4))")]Output[-pi/3, 4/5]
Inverse trigonometric functions at the standard exact values simplify to multiples of ; comes from .Fix: ratmath/symbolic#9,completeSquare,compose,sinusoid, inverse trig values,within,RealSetoperations and chained inequalities,implicitDiff,leibniz, constant factors insum - 8.Polar to rectangularAgreesConvert the polar point to rectangular coordinates.Independent answer.RatMath code
[symbolic.simplify("4cos(5pi/6)"), symbolic.simplify("4sin(5pi/6)")]Output[-2*sqrt(3), 2]
- 9.De Moivre's theoremAgreesCompute .Independent answer.RatMath code
complex.complex(1, 1).pow(8)Output16
- 10.VectorsAgreesFor and , find , and the angle between them to 0.01°.Independent answer, , , .RatMath code
const u = [3, -4], v = [2, 1]; [geo.distance([0, 0], u), geo.dot(geo.point(...u), geo.point(...v)), symbolic.evaluate(symbolic.parse("acos(2/(5*sqrt(5)))*180/pi"))]Output[5, 2, 79.6951535312339680[4793:5835]]
- 11.AsymptotesAgreesFind the vertical and horizontal asymptotes of .Independent answerVertical ; horizontal .RatMath code
[graphics.findPoles("(2x^2 - 3)/(x^2 - 4)", {}, [-10, 10]).map((p) => p.at), symbolic.limit("(2x^2 - 3)/(x^2 - 4)", "x", "inf").value]Output[[-2, 2], 2]
- 12.Zeros of a polynomialAgreesFind all zeros of .Independent answer: .RatMath code
symbolic.solve("x^4 - 5x^2 + 4 = 0", "x")Outputx = -2, -1, 1, 2
- 13.Logarithmic equationAgreesSolve .Independent answer, ( rejected).RatMath code
symbolic.solve("log(x)/log(10) + log(x - 3)/log(10) = 1", "x")Outputx = 5 rejected x = -2: a side of the equation is undefined there
- 14.Exponential decayAgreesCarbon-14 has a half-life of 5730 years. How old is a sample with 30% of its carbon-14 left, to the nearest year?Independent answeryears.RatMath code
const s = symbolic.solve("(1/2)^(t/5730) = 3/10", "t"); PRINT(s); s.solutions[0].approx()Output9952.812854572361
- 15.EllipseAgreesFor , give the vertices and foci.Independent answerVertices ; , foci .RatMath code
const p = geo.conicProperties("x^2/25 + y^2/9 = 1"); [p.vertices.map(String), p.foci.map(String)]Output[["(5, 0)", "(-5, 0)"], ["(4, 0)", "(-4, 0)"]]
conicPropertiesgives vertices, foci, axes and eccentricity.Fix: ratmath/geo#11, measurement helpers, 3Dvectorandplane,conicProperties; topology:surface,simplicialComplex, finite spaces - 16.HyperbolaAgreesFor , give the foci and the asymptotes.Independent answer; , foci ; asymptotes .RatMath code
const p = geo.conicProperties("9x^2 - 16y^2 = 144"); [p.foci.map(String), p.asymptotes.map(String)]Output[["(5, 0)", "(-5, 0)"], ["3·x - 4·y = 0", "3·x + 4·y = 0"]]
Foci and asymptotes (, that is ).Fix: ratmath/geo#11, measurement helpers, 3Dvectorandplane,conicProperties; topology:surface,simplicialComplex, finite spaces - 17.Parametric curvesAgreesEliminate the parameter: , .Independent answer.RatMath code
const e = symbolic.eliminate({ x: "2*cos(t)", y: "3*sin(t)" }, "t"); [e.standard, e.equation, e.verified]Output["x^2/4 + y^2/9 = 1", "9*x^2 + 4*y^2 = 36", "proven"]
eliminatetreats and as unknowns tied by , removes them with resultants, and proves the result by substituting the parametrisation back. - 18.Matrix inverseAgreesFind the inverse of .Independent answerDeterminant 1: .RatMath code
linalg.inverse([[2, 1], [5, 3]]).exact()Output[3, -1] [-5, 2]
- 19.Sigma notationAgreesIndependent answerThe first ten odd numbers: .RatMath code
sum(1, 10, (k) => R`2*${k} - 1`)Output100
- 20.A first limitAgreesIndependent answer.RatMath code
symbolic.limit("(x^2 - 9)/(x - 3)", "x", 3).valueOutput6