Course Test · School: elementary and middle
Grade 8: linear equations, functions and the Pythagorean theorem: 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, algebraic, symbolic, stats, 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.Scientific notationAgrees. Write the answer in scientific notation.Independent answer.RatMath code
R`3.2 * 10^5 * 4 * 10^(-2)`.toRational().toScientificNotation()Output1.28E4
Only Rational hastoScientificNotation; the product is an Integer, so it is turned into a Rational first. RatMath writes as1.28E4. - 2.Laws of exponentsAgreesSimplify .Independent answer.RatMath code
R`2^(-3) * 2^5 / 2^4`Output1/4
- 3.Simplifying square rootsAgreesSimplify .Independent answer.RatMath code
symbolic.simplify("sqrt(50)")Output5*sqrt(2)
- 4.Estimating irrational numbersAgreesBetween which two whole numbers does lie? Give it to the nearest tenth.Independent answer, so between 6 and 7; , , so .RatMath code
const r = algebraic.sqrt(48); [r.toFixed(0, "floor"), r.toFixed(1)]Output["6", "6.9"]
toFixedrounds a certified value, refining until the rounding is decided: .Fix: ratmath/algebraic#9, the arithmetic reads plain numbers, sosqrt(48)worksFix: ratmath/algebraic#10,toFixed(k, mode)on algebraic numbers - 5.Repeating decimal to fractionAgreesWrite as a fraction in lowest terms.Independent answer, , .RatMath code
R`0.#36`Output4/11
- 6.Variables on both sidesAgreesSolve .Independent answer, , .RatMath code
symbolic.solve("5(x - 2) = 3x + 6", "x")Outputx = 8
- 7.Number of solutionsAgreesHow many solutions does have? And ?Independent answerNone ( is false); infinitely many (every ).RatMath code
[symbolic.solve("2(x + 3) = 2x + 5", "x"), symbolic.solve("2(x + 3) = 2x + 6", "x")]Output[no real solution, every x where the equation is defined]
- 8.SlopeAgreesFind the slope of the line through and .Independent answer.RatMath code
R`(-7 - 5)/(4 - (-2))`Output-2
- 9.Equation of a lineAgreesWrite the equation of the line through and in slope–intercept form.Independent answer, so .RatMath code
const l = geo.line([-2, 5], [4, -7]); [l.toSlopeIntercept(), l.toPointSlope([-2, 5])]Output["y = -2x + 1", "y - 5 = -2(x + 2)"]
Lines print in slope–intercept and point–slope form.Fix: ratmath/geo#11, measurement helpers, 3Dvectorandplane,conicProperties; topology:surface,simplicialComplex, finite spaces - 10.System by substitutionAgreesSolve the system , .Independent answer, , .RatMath code
symbolic.solveSystem(["y = 2x - 3", "x + y = 9"], ["x", "y"])Outputx = 4, y = 5
- 11.System by eliminationAgreesSolve , .Independent answerAdding: , , .RatMath code
symbolic.solveSystem(["3x + 2y = 16", "5x - 2y = 0"], ["x", "y"])Outputx = 2, y = 5
- 12.Linear functionsAgreesA linear function has and . Find .Independent answerRate of change , so and .RatMath code
const f = algebraic.interpolate([[0, 4], [3, 13]]); // coefficients, constant first PRINT(f); R`${f[0]} + ${f[1]}*10`Output34
- 13.Pythagorean theoremAgreesA right triangle has legs 9 and 12. How long is the hypotenuse?Independent answer.RatMath code
geo.distance([0, 0], [9, 12])Output15
- 14.Distance between pointsAgreesFind the distance between and .Independent answer.RatMath code
geo.distance([1, -2], [7, 6])Output10
- 15.Missing legAgreesA 13-foot ladder leans against a wall with its foot 5 feet from the wall. How high up the wall does it reach?Independent answerfeet.RatMath code
algebraic.sqrt(R`13^2 - 5^2`)Output12
Fix: ratmath/algebraic#9, the arithmetic reads plain numbers, sosqrt(48)works - 16.Volume of a cylinderAgreesFind the volume of a cylinder with radius 3 and height 10, in terms of .Independent answer.RatMath code
symbolic.simplify("pi*3^2*10")Output90*pi
- 17.Cones and spheresAgreesFind the volume of a cone with radius 6 and height 4, and of a sphere with radius 3, in terms of .Independent answerCone ; sphere .RatMath code
[symbolic.simplify("1/3*pi*6^2*4"), symbolic.simplify("4/3*pi*3^3")]Output[48*pi, 36*pi]
- 18.TransformationsAgreesReflect the point in the -axis, then translate it 2 right and 4 up. Where does it land?Independent answer, then .RatMath code
const yAxis = geo.line([0, 0], [0, 1]); geo.translation([2, 4]).compose(geo.reflection(yAxis)).apply([3, -5])Output(-1, -1)
- 19.Angles of a triangleAgreesThe angles of a triangle are , and . Find them.Independent answer, : .RatMath code
symbolic.solve("x + 2x + 3x = 180", "x")Outputx = 30
- 20.Line of best fitAgreesFind the least-squares line for the points .Independent answer, , , : slope , intercept . .RatMath code
const fit = stats.leastSquares([1, 2, 3, 4, 5], [2, 4, 5, 4, 6]); [fit.slope, fit.intercept]Output[4/5, 9/5]