Grade 8: linear equations, functions and the Pythagorean theorem
Use the left and right arrow keys to turn pages.
Course summary
Where RatMath helps
92.5%
37 of 40 focal problems use RatMath for a calculation or a substantive step.
Direct calculation
36 · 90%
Assisted
1 · 2.5%
Worked by hand
3 · 7.5%
Using the packages
Students can move between exact roots and decimal estimates. A symbolic value alone does little to show why two lines have one intersection or why a transformation preserves length.
Calculator interface
Link a graph, a table and the symbolic equation. Drag points at integer grid locations, keep slope as a ratio, and label the exact radical alongside its decimal approximation.
Each of the 40 focal problems has equal weight. Direct means the displayed package calculation answers the computational question after the inputs are set up. Assisted means it contributes a step and the worked solution supplies essential reasoning, interpretation or selection. Worked by hand means the guide relies on a construction, argument or judgment for that task. The helpful share combines direct and assisted days. Courses and instructors assign different mixes of problems. The percentages describe this syllabus.
Classroom inputs and practical limits
37 of 40 days include a checked executable example. On 12 days the measured size sweep exercises a named API used in the lesson. Each day identifies its tested inputs and the mathematical property checked. Hand-worked days give the input scale and the argument to verify.
Ranges across the five units
Days 1–8 · Number systems. Integer exponents usually of magnitude at most 10, small radicals and scientific notation with a few significant digits.
Unit benchmark · core.Rational.multiply, operand bits. Largest passing sample 131,072 (1.53 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family.
Days 9–16 · Linear models. Lines from two points, typically with coordinates between −20 and 20, or a table with fewer than ten rows.
Unit benchmark · symbolic.solve, absolute coefficient. Largest passing sample 1,000,000,000 (6.48 ms, 75.9 MiB peak process RSS). The runs did not locate a ceiling for this family.
Days 17–24 · Systems and data. Two equations in two unknowns, or a scatterplot with about 5–30 pairs.
Unit benchmark · linalg.solve.exact, unknowns. Largest passing sample 128 (64.25 ms, 90.7 MiB peak process RSS). The runs did not locate a ceiling for this family.
Days 25–32 · Distance and solids. Right triangles and solids with a few positive lengths; squares and roots of two- or three-digit numbers.
Unit benchmark · algebraic.sqrt, integer scale k. Largest passing sample 1,000,000 (0.266 ms, 74.3 MiB peak process RSS). The runs did not locate a ceiling for this family.
Days 33–40 · Transformations and angles. One to three plane transformations of a triangle or quadrilateral, with simple angle fractions or integer coordinates.
Unit benchmark · geo.midpoint, absolute coordinate. Largest passing sample 1,000,000,000 (0.175 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family.
Put the arithmetic inside the R tag so RatMath parses the literals. Keep fractions as ratios throughout the calculation and attach the units from the problem to the result.
JavaScript module
import { R } from "@ratmath/core";
console.log(R`3.2 * 10^5 * 4 * 10^(-2)`.toRational().toScientificNotation());
Checked output
1.28E4
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Integer exponents usually of magnitude at most 10, small radicals and scientific notation with a few significant digits.
Focal example. The code above passed its displayed check in 0.322 ms on Node.
Related workload in this unit.core.Rational.roundTo · decimal places. Baseline test points across courses 0, 1, 2, 4, 10. Round one third toward zero and compare with (10^d−1)/(3×10^d).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000 (0.132 ms, 75.8 MiB peak process RSS). The runs did not locate a ceiling for this family. Extra decimal places require longer integers and more output. Choose rounding mode and decimal places explicitly for money or signed values.
Measured times, memory and outcomes
decimal places · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
0
Baseline
Passed
0.113
75
1
Baseline
Passed
0.151
75
2
Baseline
Passed
0.123
75.6
4
Baseline
Passed
0.119
75.1
10
Baseline
Passed
0.120
76.2
50
Stretch
Passed
0.418
75.2
250
Stretch
Passed
0.124
75.2
1,000
Stretch
Passed
0.132
75.8
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
Input contract · An integer can lose a digit before RatMath receives it. The decimal integer 9007199254740993 supplied as a JavaScript Number has already become 9007199254740992. The Rational constructor refuses this unsafe Number. Supply a BigInt or an exact string. Converting a rounded Number back to BigInt preserves the earlier error.
Runtime limit · BigInt capacity depends on the runtime. Bun 1.4.2 and Node both accepted 2^1048575 and 2^1048576. The latter shift failed on Bun 1.4.0. Core now declares Bun ≥1.4.2. Passing these two shifts only establishes a lower bound on capacity.
Day 02 / 40 · Number systems
Laws of exponents
Direct calculation@ratmath/core
Problem
Simplify .
Worked solution
.
Using RatMath
Put the arithmetic inside the R tag so RatMath parses the literals. Keep fractions as ratios throughout the calculation and attach the units from the problem to the result.
JavaScript module
import { R } from "@ratmath/core";
console.log(String(R`2^(-3) * 2^5 / 2^4`));
Checked output
1/4
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Integer exponents usually of magnitude at most 10, small radicals and scientific notation with a few significant digits.
Focal example. The code above passed its displayed check in 0.289 ms on Node.
Same arithmetic expression. Replaced its first numeral 2 with 1, 2, 7, 12, 100, 1000, -3, 1/2. All 8 defined variants agreed exactly with Python’s rational arithmetic. This varies the arithmetic operation while holding the rest of the expression fixed.
Related workload in this unit.core.Rational.multiply · operand bits. Baseline test points across courses 8, 32, 64, 256. Cross-multiply the unreduced integer products; operands have unlike denominators.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 131,072 (1.53 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Intermediate products can have twice the bit length of their factors. Repeated squaring can exhaust the engine’s BigInt allocation limit in a small number of steps.
Measured times, memory and outcomes
operand bits · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
8
Baseline
Passed
0.317
74.6
32
Baseline
Passed
0.035
75.5
64
Baseline
Passed
0.045
75.1
256
Baseline
Passed
0.106
74
1,024
Stretch
Passed
0.035
75.3
8,192
Stretch
Passed
0.075
75.8
32,768
Stretch
Passed
0.245
75
131,072
Stretch
Passed
1.53
75.5
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.simplify("sqrt(50)")));
Checked output
5*sqrt(2)
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Integer exponents usually of magnitude at most 10, small radicals and scientific notation with a few significant digits.
Focal example. The code above passed its displayed check in 1.64 ms on Node.
Related workload in this unit.symbolic.expand · degree. Baseline test points across courses 1, 2, 4, 8. Sum the expanded coefficients at x=1 by direct substitution; result 2^n. Also check at x=0 and 2.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 128 (47.68 ms, 96.3 MiB peak process RSS). The runs did not locate a ceiling for this family. A univariate binomial has n+1 terms. With several variables the number of monomials can grow combinatorially even at modest degree.
Measured times, memory and outcomes
degree · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
26.10
75.9
2
Baseline
Passed
3.05
75.5
4
Baseline
Passed
2.75
77.3
8
Baseline
Passed
4.23
79.5
16
Stretch
Passed
5.88
82.6
32
Stretch
Passed
6.12
87.9
64
Stretch
Passed
15.73
89.5
128
Stretch
Passed
47.68
96.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.simplify · 2 passing test cases, 11 distinct argument descriptions
Between which two whole numbers does lie? Give it to the nearest tenth.
Worked solution
, so between 6 and 7; , , so .
Using RatMath
The floor gives the lower whole number. Add one for the upper bound and read the separately rounded tenth.
JavaScript module
import * as algebraic from "@ratmath/algebraic";
const r = algebraic.sqrt(48);
console.log([r.toFixed(0, "floor"), r.toFixed(1)]);
Checked output
["6", "6.9"]
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Integer exponents usually of magnitude at most 10, small radicals and scientific notation with a few significant digits.
Focal example. The code above passed its displayed check in 2.14 ms on Node.
Same API, measured input family.algebraic.sqrt · integer scale k. Baseline test points across courses 1, 2, 7, 50. √(k²) has the nonnegative rational value k.
Practical limit. Largest passing sample 1,000,000 (0.266 ms, 74.3 MiB peak process RSS). The runs did not locate a ceiling for this family. This sweep uses perfect squares. Nonsquares involve algebraic representations and higher-degree combinations can cost substantially more.
Measured times, memory and outcomes
integer scale k · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.312
75.2
2
Baseline
Passed
0.275
75.7
7
Baseline
Passed
0.237
75.3
50
Baseline
Passed
0.238
74.1
10,000
Stretch
Passed
0.285
74.1
1,000,000
Stretch
Passed
0.266
74.3
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
algebraic.sqrt · 17 passing test cases, 8 distinct argument descriptions
Put the arithmetic inside the R tag so RatMath parses the literals. Keep fractions as ratios throughout the calculation and attach the units from the problem to the result.
JavaScript module
import { R } from "@ratmath/core";
console.log(String(R`0.#36`));
Checked output
4/11
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Integer exponents usually of magnitude at most 10, small radicals and scientific notation with a few significant digits.
Focal example. The code above passed its displayed check in 0.121 ms on Node.
Related workload in this unit.core.R · whole-number operand. Baseline test points across courses 0, 1, 10, 20, 100, 1,000, 1,000,000. (n+7)(n−3) by independent BigInt arithmetic.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 9,007,199,254,740,991 (1.67 ms, 75.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Exact integer arithmetic grows with operand bit length. Enter large integers as decimal strings or BigInts before any JavaScript Number conversion.
Measured times, memory and outcomes
whole-number operand · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
0
Baseline
Passed
1.75
75
1
Baseline
Passed
1.70
75.7
10
Baseline
Passed
1.78
75.1
20
Baseline
Passed
1.88
75.4
100
Baseline
Passed
1.55
75.4
1,000
Baseline
Passed
1.36
75.3
1,000,000
Baseline
Passed
1.39
74.8
1,000,000,000
Stretch
Passed
1.69
76.3
9,007,199,254,740,991
Stretch
Passed
1.67
75.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
Compare 8² = 64 and 9² = 81 with 70. Monotonicity of squaring on nonnegative inputs puts the root between 8 and 9.
Using RatMath
Construct an Integer or Rational before applying its methods. Use fraction strings or integer inputs to preserve exact values.
JavaScript module
import { Integer } from "@ratmath/core";
console.log([8,9].map(n=>new Integer(n).pow(2)).map(String).join(", "));
Checked output
64, 81
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Integer exponents usually of magnitude at most 10, small radicals and scientific notation with a few significant digits.
Focal example. The code above passed its displayed check in 0.089 ms on Node.
Related workload in this unit.core.Rational.multiply · operand bits. Baseline test points across courses 8, 32, 64, 256. Cross-multiply the unreduced integer products; operands have unlike denominators.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 131,072 (1.53 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Intermediate products can have twice the bit length of their factors. Repeated squaring can exhaust the engine’s BigInt allocation limit in a small number of steps.
Measured times, memory and outcomes
operand bits · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
8
Baseline
Passed
0.317
74.6
32
Baseline
Passed
0.035
75.5
64
Baseline
Passed
0.045
75.1
256
Baseline
Passed
0.106
74
1,024
Stretch
Passed
0.035
75.3
8,192
Stretch
Passed
0.075
75.8
32,768
Stretch
Passed
0.245
75
131,072
Stretch
Passed
1.53
75.5
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.Integer · 170 passing test cases, 60 distinct argument descriptions
Divide the coefficients and subtract the exponents.
Using RatMath
Put the arithmetic inside the R tag so RatMath parses the literals. Keep fractions as ratios throughout the calculation and attach the units from the problem to the result.
JavaScript module
import { R } from "@ratmath/core";
console.log(String(R`(6*10^7)/(3*10^4)`));
Checked output
2000
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Integer exponents usually of magnitude at most 10, small radicals and scientific notation with a few significant digits.
Focal example. The code above passed its displayed check in 0.102 ms on Node.
Same arithmetic expression. Replaced its first numeral 6 with 0, 1, 2, 7, 12, 100, 1000, -3, 1/2. All 9 defined variants agreed exactly with Python’s rational arithmetic. This varies the arithmetic operation while holding the rest of the expression fixed.
Related workload in this unit.core.Rational.multiply · operand bits. Baseline test points across courses 8, 32, 64, 256. Cross-multiply the unreduced integer products; operands have unlike denominators.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 131,072 (1.53 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Intermediate products can have twice the bit length of their factors. Repeated squaring can exhaust the engine’s BigInt allocation limit in a small number of steps.
Measured times, memory and outcomes
operand bits · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
8
Baseline
Passed
0.317
74.6
32
Baseline
Passed
0.035
75.5
64
Baseline
Passed
0.045
75.1
256
Baseline
Passed
0.106
74
1,024
Stretch
Passed
0.035
75.3
8,192
Stretch
Passed
0.075
75.8
32,768
Stretch
Passed
0.245
75
131,072
Stretch
Passed
1.53
75.5
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
Input contract · An integer can lose a digit before RatMath receives it. The decimal integer 9007199254740993 supplied as a JavaScript Number has already become 9007199254740992. The Rational constructor refuses this unsafe Number. Supply a BigInt or an exact string. Converting a rounded Number back to BigInt preserves the earlier error.
Runtime limit · BigInt capacity depends on the runtime. Bun 1.4.2 and Node both accepted 2^1048575 and 2^1048576. The latter shift failed on Bun 1.4.0. Core now declares Bun ≥1.4.2. Passing these two shifts only establishes a lower bound on capacity.
Day 08 / 40 · Number systems
Repeating decimals
Direct calculation@ratmath/core
Problem
Write as a decimal.
Worked solution
Using RatMath
Put the arithmetic inside the R tag so RatMath parses the literals. Keep fractions as ratios throughout the calculation and attach the units from the problem to the result.
JavaScript module
import { R } from "@ratmath/core";
console.log(R`2/11`.toRepeatingDecimal());
Checked output
0.#18
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Integer exponents usually of magnitude at most 10, small radicals and scientific notation with a few significant digits.
Focal example. The code above passed its displayed check in 0.473 ms on Node.
Related workload in this unit.core.Rational.roundTo · decimal places. Baseline test points across courses 0, 1, 2, 4, 10. Round one third toward zero and compare with (10^d−1)/(3×10^d).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000 (0.132 ms, 75.8 MiB peak process RSS). The runs did not locate a ceiling for this family. Extra decimal places require longer integers and more output. Choose rounding mode and decimal places explicitly for money or signed values.
Measured times, memory and outcomes
decimal places · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
0
Baseline
Passed
0.113
75
1
Baseline
Passed
0.151
75
2
Baseline
Passed
0.123
75.6
4
Baseline
Passed
0.119
75.1
10
Baseline
Passed
0.120
76.2
50
Stretch
Passed
0.418
75.2
250
Stretch
Passed
0.124
75.2
1,000
Stretch
Passed
0.132
75.8
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
Write the equation and name the variable to solve for. Check returned candidates against the original domain and any restrictions in the question.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.solve("5(x - 2) = 3x + 6", "x")));
Checked output
x = 8
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Lines from two points, typically with coordinates between −20 and 20, or a table with fewer than ten rows.
For this problem type. Start with one unknown, small signed coefficients and degree one or two. Higher-degree or parameter-dependent equations need separate cases.
Focal example. The code above passed its displayed check in 1.20 ms on Node.
Same API, measured input family.symbolic.solve · absolute coefficient. Baseline test points across courses 1, 2, 10, 100. Solve n·x+1=3n+1; the unique root is 3.
Practical limit. Largest passing sample 1,000,000,000 (6.48 ms, 75.9 MiB peak process RSS). The runs did not locate a ceiling for this family. One linear unknown has a simple root here. A vanishing coefficient may produce no solution or infinitely many. Multiple parameters require case analysis.
Measured times, memory and outcomes
absolute coefficient · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
16.76
75.8
2
Baseline
Passed
7.72
74.9
10
Baseline
Passed
29.10
75.2
100
Baseline
Passed
12.79
74.6
10,000
Stretch
Passed
28.50
76.3
1,000,000,000
Stretch
Passed
6.48
75.9
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.solve · 21 passing test cases, 71 distinct argument descriptions
[no real solution, every x where the equation is defined]
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Lines from two points, typically with coordinates between −20 and 20, or a table with fewer than ten rows.
For this problem type. Start with one unknown, small signed coefficients and degree one or two. Higher-degree or parameter-dependent equations need separate cases.
Focal example. The code above passed its displayed check in 0.903 ms on Node.
Same API, measured input family.symbolic.solve · absolute coefficient. Baseline test points across courses 1, 2, 10, 100. Solve n·x+1=3n+1; the unique root is 3.
Practical limit. Largest passing sample 1,000,000,000 (6.48 ms, 75.9 MiB peak process RSS). The runs did not locate a ceiling for this family. One linear unknown has a simple root here. A vanishing coefficient may produce no solution or infinitely many. Multiple parameters require case analysis.
Measured times, memory and outcomes
absolute coefficient · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
16.76
75.8
2
Baseline
Passed
7.72
74.9
10
Baseline
Passed
29.10
75.2
100
Baseline
Passed
12.79
74.6
10,000
Stretch
Passed
28.50
76.3
1,000,000,000
Stretch
Passed
6.48
75.9
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.solve · 21 passing test cases, 71 distinct argument descriptions
Put the arithmetic inside the R tag so RatMath parses the literals. Keep fractions as ratios throughout the calculation and attach the units from the problem to the result.
JavaScript module
import { R } from "@ratmath/core";
console.log(String(R`(-7 - 5)/(4 - (-2))`));
Checked output
-2
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Lines from two points, typically with coordinates between −20 and 20, or a table with fewer than ten rows.
Focal example. The code above passed its displayed check in 0.129 ms on Node.
Same arithmetic expression. Replaced its first numeral 7 with 0, 1, 2, 7, 12, 100, 1000, -3, 1/2. All 9 defined variants agreed exactly with Python’s rational arithmetic. This varies the arithmetic operation while holding the rest of the expression fixed.
Related workload in this unit.core.Rational.add · denominator. Baseline test points across courses 1, 2, 3, 12, 100, 1,000. Cross-multiply 1/n + 1/(n+1) against (2n+1)/(n(n+1)).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,007 (0.038 ms, 76.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Exact work depends on the bit lengths of both numerator and denominator. A long sum of relatively prime fractions can build a large common denominator.
Measured times, memory and outcomes
denominator · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.034
74.9
2
Baseline
Passed
0.036
75.6
3
Baseline
Passed
0.040
75.9
12
Baseline
Passed
0.039
75.2
100
Baseline
Passed
0.041
75
1,000
Baseline
Passed
0.035
75.8
1,000,003
Stretch
Passed
0.044
75
1,000,000,007
Stretch
Passed
0.038
76.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
Write the equation of the line through and in slope–intercept form.
Worked solution
, so .
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as geo from "@ratmath/geo";
const l = geo.line([-2, 5], [4, -7]);
console.log([l.toSlopeIntercept(), l.toPointSlope([-2, 5])]);
Checked output
["y = -2x + 1", "y - 5 = -2(x + 2)"]
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Lines from two points, typically with coordinates between −20 and 20, or a table with fewer than ten rows.
Focal example. The code above passed its displayed check in 0.512 ms on Node.
Related workload in this unit.geo.midpoint · absolute coordinate. Baseline test points across courses 0, 1, 10, 100. Midpoint of (−k,0) and (k,2k) equals (0,k).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,000 (0.175 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Coordinate size and dimension affect exact distance and dot products. Floating geometry near coincidence can lose significant digits.
Measured times, memory and outcomes
absolute coordinate · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
0
Baseline
Passed
0.193
74.9
1
Baseline
Passed
0.197
75.2
10
Baseline
Passed
0.151
75.4
100
Baseline
Passed
0.169
75.6
1,000,000
Stretch
Passed
0.298
76.3
1,000,000,000
Stretch
Passed
0.175
75.5
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
geo.line · 10 passing test cases, 15 distinct argument descriptions
Direct calculation@ratmath/algebraic · @ratmath/core
Problem
A linear function has and . Find .
Worked solution
Rate of change , so and .
Using RatMath
Put the arithmetic inside the R tag so RatMath parses the literals. Keep fractions as ratios throughout the calculation and attach the units from the problem to the result.
JavaScript module
import * as algebraic from "@ratmath/algebraic";
import { R } from "@ratmath/core";
const PRINT = console.log;
const f = algebraic.interpolate([[0, 4], [3, 13]]); // coefficients, constant first
PRINT(f);
console.log(String(R`${f[0]} + ${f[1]}*10`));
Checked output
34
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Lines from two points, typically with coordinates between −20 and 20, or a table with fewer than ten rows.
For this problem type. Use roughly 3–10 distinct nodes. On the line, compare both a nodal value and a value between nodes.
Focal example. The code above passed its displayed check in 0.386 ms on Node.
Same API, measured input family.algebraic.interpolate · equally spaced nodes. Baseline test points across courses 2, 3, 4, 6. The polynomial interpolating 3+2x has coefficients 3,2 and all higher terms vanish.
Practical limit. Largest passing sample 100 (10.18 ms, 83.9 MiB peak process RSS). The runs did not locate a ceiling for this family. Node count and spacing matter. Duplicate nodes can make interpolation undefined. Exact rational coefficients often grow with degree.
Measured times, memory and outcomes
equally spaced nodes · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
2
Baseline
Passed
0.507
75.3
3
Baseline
Passed
0.670
74.3
4
Baseline
Passed
0.473
75.4
6
Baseline
Passed
0.573
75
10
Stretch
Passed
0.539
74.7
25
Stretch
Passed
2.42
75.3
50
Stretch
Passed
7.14
77.7
100
Stretch
Passed
10.18
83.9
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
5 pounds of apples cost $8.75. At the same rate, what do 8 pounds cost?
Worked solution
$1.75 a pound, so $14.00.
Using RatMath
Put the arithmetic inside the R tag so RatMath parses the literals. Keep fractions as ratios throughout the calculation and attach the units from the problem to the result.
JavaScript module
import { R } from "@ratmath/core";
console.log(String(R`8.75 / 5 * 8`));
Checked output
14
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Lines from two points, typically with coordinates between −20 and 20, or a table with fewer than ten rows.
Focal example. The code above passed its displayed check in 0.130 ms on Node.
Same arithmetic expression. Replaced its first numeral 8.75 with 0, 1, 2, 7, 12, 100, 1000, -3, 1/2. All 9 defined variants agreed exactly with Python’s rational arithmetic. This varies the arithmetic operation while holding the rest of the expression fixed.
Related workload in this unit.core.Rational.add · denominator. Baseline test points across courses 1, 2, 3, 12, 100, 1,000. Cross-multiply 1/n + 1/(n+1) against (2n+1)/(n(n+1)).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,007 (0.038 ms, 76.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Exact work depends on the bit lengths of both numerator and denominator. A long sum of relatively prime fractions can build a large common denominator.
Measured times, memory and outcomes
denominator · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.034
74.9
2
Baseline
Passed
0.036
75.6
3
Baseline
Passed
0.040
75.9
12
Baseline
Passed
0.039
75.2
100
Baseline
Passed
0.041
75
1,000
Baseline
Passed
0.035
75.8
1,000,003
Stretch
Passed
0.044
75
1,000,000,007
Stretch
Passed
0.038
76.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
A tank already holds 9 litres and fills at 2 litres per minute. How much after 7 minutes?
Worked solution
Its affine model is 9 + 2t.
Using RatMath
Put the arithmetic inside the R tag so RatMath parses the literals. Keep fractions as ratios throughout the calculation and attach the units from the problem to the result.
JavaScript module
import { R } from "@ratmath/core";
console.log(String(R`9+2*7`));
Checked output
23
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Lines from two points, typically with coordinates between −20 and 20, or a table with fewer than ten rows.
Focal example. The code above passed its displayed check in 0.246 ms on Node.
Same arithmetic expression. Replaced its first numeral 9 with 0, 1, 2, 7, 12, 100, 1000, -3, 1/2. All 9 defined variants agreed exactly with Python’s rational arithmetic. This varies the arithmetic operation while holding the rest of the expression fixed.
Related workload in this unit.core.R · whole-number operand. Baseline test points across courses 0, 1, 10, 20, 100, 1,000, 1,000,000. (n+7)(n−3) by independent BigInt arithmetic.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 9,007,199,254,740,991 (1.67 ms, 75.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Exact integer arithmetic grows with operand bit length. Enter large integers as decimal strings or BigInts before any JavaScript Number conversion.
Measured times, memory and outcomes
whole-number operand · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
0
Baseline
Passed
1.75
75
1
Baseline
Passed
1.70
75.7
10
Baseline
Passed
1.78
75.1
20
Baseline
Passed
1.88
75.4
100
Baseline
Passed
1.55
75.4
1,000
Baseline
Passed
1.36
75.3
1,000,000
Baseline
Passed
1.39
74.8
1,000,000,000
Stretch
Passed
1.69
76.3
9,007,199,254,740,991
Stretch
Passed
1.67
75.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
Can the line through (2,1) and (2,5) have a finite slope?
Worked solution
Its run is zero. No finite rise-to-run ratio exists. Write x = 2.
Working without a calculator
Use the argument or construction in the worked solution. This lesson assigns the reasoning to the student.
Input range and limits
Typical inputs for this unit. Lines from two points, typically with coordinates between −20 and 20, or a table with fewer than ten rows.
Scope of verification. This day asks for a hand argument, construction or interpretation. The worked instance gives the input. General claims need the reasoning shown above. A measured time, memory ceiling or finite input sweep would not verify that claim.
Day 17 / 40 · Systems and data
System by substitution
Direct calculation@ratmath/symbolic
Problem
Solve the system , .
Worked solution
, , .
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.solveSystem(["y = 2x - 3", "x + y = 9"], ["x", "y"])));
Checked output
x = 4, y = 5
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Two equations in two unknowns, or a scatterplot with about 5–30 pairs.
For this problem type. Linear systems in written exercises usually have two or three unknowns and as many equations. Include a dependent or inconsistent pair.
Focal example. The code above passed its displayed check in 4.23 ms on Node.
Related workload in this unit.linalg.solve.exact · unknowns. Baseline test points across courses 1, 2, 4, 8. For dense I+J and b=(n+1)·1 every component of x must be one.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 128 (64.25 ms, 90.7 MiB peak process RSS). The runs did not locate a ceiling for this family. Solving a nonsingular system checks one solution. Singular or inconsistent systems require rank and consistency checks. Large denominators increase exact cost.
Measured times, memory and outcomes
unknowns · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
22.32
75.6
2
Baseline
Passed
2.28
75.3
4
Baseline
Passed
7.02
75.1
8
Baseline
Passed
2.47
75.3
16
Stretch
Passed
4.34
77.1
32
Stretch
Passed
8.06
79.4
64
Stretch
Passed
63.87
89.9
128
Stretch
Passed
64.25
90.7
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.solveSystem · 4 passing test cases, 13 distinct argument descriptions
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.solveSystem(["3x + 2y = 16", "5x - 2y = 0"], ["x", "y"])));
Checked output
x = 2, y = 5
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Two equations in two unknowns, or a scatterplot with about 5–30 pairs.
For this problem type. Linear systems in written exercises usually have two or three unknowns and as many equations. Include a dependent or inconsistent pair.
Focal example. The code above passed its displayed check in 1.52 ms on Node.
Related workload in this unit.linalg.solve.exact · unknowns. Baseline test points across courses 1, 2, 4, 8. For dense I+J and b=(n+1)·1 every component of x must be one.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 128 (64.25 ms, 90.7 MiB peak process RSS). The runs did not locate a ceiling for this family. Solving a nonsingular system checks one solution. Singular or inconsistent systems require rank and consistency checks. Large denominators increase exact cost.
Measured times, memory and outcomes
unknowns · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
22.32
75.6
2
Baseline
Passed
2.28
75.3
4
Baseline
Passed
7.02
75.1
8
Baseline
Passed
2.47
75.3
16
Stretch
Passed
4.34
77.1
32
Stretch
Passed
8.06
79.4
64
Stretch
Passed
63.87
89.9
128
Stretch
Passed
64.25
90.7
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.solveSystem · 4 passing test cases, 13 distinct argument descriptions
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as stats from "@ratmath/stats";
const fit = stats.leastSquares([1, 2, 3, 4, 5], [2, 4, 5, 4, 6]);
console.log([fit.slope, fit.intercept]);
Checked output
[4/5, 9/5]
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Two equations in two unknowns, or a scatterplot with about 5–30 pairs.
For this problem type. Hand fits use about 4–12 paired observations. A classroom dataset can have tens to hundreds of rows and one to five predictors. Include a nonconstant predictor.
Focal example. The code above passed its displayed check in 0.530 ms on Node.
Same API, measured input family.stats.leastSquares · observations. Baseline test points across courses 2, 4, 10, 50. All residuals must vanish on the exact line y=2x+3.
Practical limit. Largest passing sample 20,000 (276 ms, 132.4 MiB peak process RSS). The first sampled passing call above 100 ms used 20,000 (276 ms). The runs did not locate a ceiling for this family. Rows, predictors and coefficient bit lengths all affect cost. A perfect line tests arithmetic, while noisy, singular or nearly collinear data require different diagnostics.
Measured times, memory and outcomes
observations · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
2
Baseline
Passed
3.11
74.8
4
Baseline
Passed
0.578
75.9
10
Baseline
Passed
1.74
76
50
Baseline
Passed
2.62
75
200
Stretch
Passed
4.21
76.8
2,000
Stretch
Passed
36.00
88.2
20,000
Stretch
Passed
276
132.4
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
stats.leastSquares · 4 passing test cases, 5 distinct argument descriptions
For the fitted line , find the residual of the observation .
Worked solution
; residual .
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as stats from "@ratmath/stats";
console.log(String(stats.leastSquares([1, 2, 3, 4, 5], [2, 4, 5, 4, 6]).residuals[2]));
Checked output
4/5
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Two equations in two unknowns, or a scatterplot with about 5–30 pairs.
For this problem type. Hand fits use about 4–12 paired observations. A classroom dataset can have tens to hundreds of rows and one to five predictors. Include a nonconstant predictor.
Focal example. The code above passed its displayed check in 0.222 ms on Node.
Same API, measured input family.stats.leastSquares · observations. Baseline test points across courses 2, 4, 10, 50. All residuals must vanish on the exact line y=2x+3.
Practical limit. Largest passing sample 20,000 (276 ms, 132.4 MiB peak process RSS). The first sampled passing call above 100 ms used 20,000 (276 ms). The runs did not locate a ceiling for this family. Rows, predictors and coefficient bit lengths all affect cost. A perfect line tests arithmetic, while noisy, singular or nearly collinear data require different diagnostics.
Measured times, memory and outcomes
observations · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
2
Baseline
Passed
3.11
74.8
4
Baseline
Passed
0.578
75.9
10
Baseline
Passed
1.74
76
50
Baseline
Passed
2.62
75
200
Stretch
Passed
4.21
76.8
2,000
Stretch
Passed
36.00
88.2
20,000
Stretch
Passed
276
132.4
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
stats.leastSquares · 4 passing test cases, 5 distinct argument descriptions
A scatterplot has one point far to the right. What should you inspect before trusting a fitted slope?
Worked solution
Compare the trend with and without the point, check the data entry and explain whether the point belongs to the population.
Working without a calculator
Use the argument or construction in the worked solution. This lesson assigns the reasoning to the student.
Input range and limits
Typical inputs for this unit. Two equations in two unknowns, or a scatterplot with about 5–30 pairs.
Scope of verification. This day asks for a hand argument, construction or interpretation. The worked instance gives the input. General claims need the reasoning shown above. A measured time, memory ceiling or finite input sweep would not verify that claim.
Day 22 / 40 · Systems and data
Residual sign
Direct calculation@ratmath/core
Problem
A line predicts 12 units and the observed value is 9. Find and interpret the residual.
Worked solution
Observed minus predicted is −3. The point is below the line.
Using RatMath
Put the arithmetic inside the R tag so RatMath parses the literals. Keep fractions as ratios throughout the calculation and attach the units from the problem to the result.
JavaScript module
import { R } from "@ratmath/core";
console.log(String(R`9-12`));
Checked output
-3
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Two equations in two unknowns, or a scatterplot with about 5–30 pairs.
Focal example. The code above passed its displayed check in 0.083 ms on Node.
Same arithmetic expression. Replaced its first numeral 9 with 0, 1, 2, 7, 12, 100, 1000, -3, 1/2. All 9 defined variants agreed exactly with Python’s rational arithmetic. This varies the arithmetic operation while holding the rest of the expression fixed.
Related workload in this unit.core.R · whole-number operand. Baseline test points across courses 0, 1, 10, 20, 100, 1,000, 1,000,000. (n+7)(n−3) by independent BigInt arithmetic.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 9,007,199,254,740,991 (1.67 ms, 75.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Exact integer arithmetic grows with operand bit length. Enter large integers as decimal strings or BigInts before any JavaScript Number conversion.
Measured times, memory and outcomes
whole-number operand · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
0
Baseline
Passed
1.75
75
1
Baseline
Passed
1.70
75.7
10
Baseline
Passed
1.78
75.1
20
Baseline
Passed
1.88
75.4
100
Baseline
Passed
1.55
75.4
1,000
Baseline
Passed
1.36
75.3
1,000,000
Baseline
Passed
1.39
74.8
1,000,000,000
Stretch
Passed
1.69
76.3
9,007,199,254,740,991
Stretch
Passed
1.67
75.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
A theatre sold 120 tickets for $780. Adult tickets cost $8 and child tickets $5. How many of each were sold?
Worked solution
, : , so 60 adult and 60 child tickets.
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.solveSystem(["a + c = 120", "8a + 5c = 780"], ["a", "c"])));
Checked output
a = 60, c = 60
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Two equations in two unknowns, or a scatterplot with about 5–30 pairs.
For this problem type. Linear systems in written exercises usually have two or three unknowns and as many equations. Include a dependent or inconsistent pair.
Focal example. The code above passed its displayed check in 1.59 ms on Node.
Related workload in this unit.linalg.solve.exact · unknowns. Baseline test points across courses 1, 2, 4, 8. For dense I+J and b=(n+1)·1 every component of x must be one.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 128 (64.25 ms, 90.7 MiB peak process RSS). The runs did not locate a ceiling for this family. Solving a nonsingular system checks one solution. Singular or inconsistent systems require rank and consistency checks. Large denominators increase exact cost.
Measured times, memory and outcomes
unknowns · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
22.32
75.6
2
Baseline
Passed
2.28
75.3
4
Baseline
Passed
7.02
75.1
8
Baseline
Passed
2.47
75.3
16
Stretch
Passed
4.34
77.1
32
Stretch
Passed
8.06
79.4
64
Stretch
Passed
63.87
89.9
128
Stretch
Passed
64.25
90.7
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.solveSystem · 4 passing test cases, 13 distinct argument descriptions
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as geo from "@ratmath/geo";
console.log(String(geo.distance([-3, 4], [5, 4])));
Checked output
8
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Two equations in two unknowns, or a scatterplot with about 5–30 pairs.
Focal example. The code above passed its displayed check in 0.254 ms on Node.
Related workload in this unit.geo.midpoint · absolute coordinate. Baseline test points across courses 0, 1, 10, 100. Midpoint of (−k,0) and (k,2k) equals (0,k).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,000 (0.175 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Coordinate size and dimension affect exact distance and dot products. Floating geometry near coincidence can lose significant digits.
Measured times, memory and outcomes
absolute coordinate · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
0
Baseline
Passed
0.193
74.9
1
Baseline
Passed
0.197
75.2
10
Baseline
Passed
0.151
75.4
100
Baseline
Passed
0.169
75.6
1,000,000
Stretch
Passed
0.298
76.3
1,000,000,000
Stretch
Passed
0.175
75.5
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
geo.distance · 3 passing test cases, 2 distinct argument descriptions
A right triangle has legs 9 and 12. How long is the hypotenuse?
Worked solution
.
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as geo from "@ratmath/geo";
console.log(String(geo.distance([0, 0], [9, 12])));
Checked output
15
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Right triangles and solids with a few positive lengths; squares and roots of two- or three-digit numbers.
Focal example. The code above passed its displayed check in 0.092 ms on Node.
Related workload in this unit.geo.midpoint · absolute coordinate. Baseline test points across courses 0, 1, 10, 100. Midpoint of (−k,0) and (k,2k) equals (0,k).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,000 (0.175 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Coordinate size and dimension affect exact distance and dot products. Floating geometry near coincidence can lose significant digits.
Measured times, memory and outcomes
absolute coordinate · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
0
Baseline
Passed
0.193
74.9
1
Baseline
Passed
0.197
75.2
10
Baseline
Passed
0.151
75.4
100
Baseline
Passed
0.169
75.6
1,000,000
Stretch
Passed
0.298
76.3
1,000,000,000
Stretch
Passed
0.175
75.5
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
geo.distance · 3 passing test cases, 2 distinct argument descriptions
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as geo from "@ratmath/geo";
console.log(String(geo.distance([1, -2], [7, 6])));
Checked output
10
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Right triangles and solids with a few positive lengths; squares and roots of two- or three-digit numbers.
Focal example. The code above passed its displayed check in 0.063 ms on Node.
Related workload in this unit.geo.midpoint · absolute coordinate. Baseline test points across courses 0, 1, 10, 100. Midpoint of (−k,0) and (k,2k) equals (0,k).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,000 (0.175 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Coordinate size and dimension affect exact distance and dot products. Floating geometry near coincidence can lose significant digits.
Measured times, memory and outcomes
absolute coordinate · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
0
Baseline
Passed
0.193
74.9
1
Baseline
Passed
0.197
75.2
10
Baseline
Passed
0.151
75.4
100
Baseline
Passed
0.169
75.6
1,000,000
Stretch
Passed
0.298
76.3
1,000,000,000
Stretch
Passed
0.175
75.5
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
geo.distance · 3 passing test cases, 2 distinct argument descriptions
Direct calculation@ratmath/algebraic · @ratmath/core
Problem
A 13-foot ladder leans against a wall with its foot 5 feet from the wall. How high up the wall does it reach?
Worked solution
feet.
Using RatMath
Put the arithmetic inside the R tag so RatMath parses the literals. Keep fractions as ratios throughout the calculation and attach the units from the problem to the result.
JavaScript module
import * as algebraic from "@ratmath/algebraic";
import { R } from "@ratmath/core";
console.log(String(algebraic.sqrt(R`13^2 - 5^2`)));
Checked output
12
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Right triangles and solids with a few positive lengths; squares and roots of two- or three-digit numbers.
Focal example. The code above passed its displayed check in 0.791 ms on Node.
Same API, measured input family.algebraic.sqrt · integer scale k. Baseline test points across courses 1, 2, 7, 50. √(k²) has the nonnegative rational value k.
Practical limit. Largest passing sample 1,000,000 (0.266 ms, 74.3 MiB peak process RSS). The runs did not locate a ceiling for this family. This sweep uses perfect squares. Nonsquares involve algebraic representations and higher-degree combinations can cost substantially more.
Measured times, memory and outcomes
integer scale k · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.312
75.2
2
Baseline
Passed
0.275
75.7
7
Baseline
Passed
0.237
75.3
50
Baseline
Passed
0.238
74.1
10,000
Stretch
Passed
0.285
74.1
1,000,000
Stretch
Passed
0.266
74.3
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
algebraic.sqrt · 17 passing test cases, 8 distinct argument descriptions
Find the volume of a cylinder with radius 3 and height 10, in terms of .
Worked solution
.
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.simplify("pi*3^2*10")));
Checked output
90*pi
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Right triangles and solids with a few positive lengths; squares and roots of two- or three-digit numbers.
Focal example. The code above passed its displayed check in 1.08 ms on Node.
Related workload in this unit.symbolic.expand · degree. Baseline test points across courses 1, 2, 4, 8. Sum the expanded coefficients at x=1 by direct substitution; result 2^n. Also check at x=0 and 2.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 128 (47.68 ms, 96.3 MiB peak process RSS). The runs did not locate a ceiling for this family. A univariate binomial has n+1 terms. With several variables the number of monomials can grow combinatorially even at modest degree.
Measured times, memory and outcomes
degree · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
26.10
75.9
2
Baseline
Passed
3.05
75.5
4
Baseline
Passed
2.75
77.3
8
Baseline
Passed
4.23
79.5
16
Stretch
Passed
5.88
82.6
32
Stretch
Passed
6.12
87.9
64
Stretch
Passed
15.73
89.5
128
Stretch
Passed
47.68
96.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.simplify · 2 passing test cases, 11 distinct argument descriptions
Find the volume of a cone with radius 6 and height 4, and of a sphere with radius 3, in terms of .
Worked solution
Cone ; sphere .
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log([symbolic.simplify("1/3*pi*6^2*4"), symbolic.simplify("4/3*pi*3^3")]);
Checked output
[48*pi, 36*pi]
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Right triangles and solids with a few positive lengths; squares and roots of two- or three-digit numbers.
Focal example. The code above passed its displayed check in 6.44 ms on Node.
Related workload in this unit.symbolic.expand · degree. Baseline test points across courses 1, 2, 4, 8. Sum the expanded coefficients at x=1 by direct substitution; result 2^n. Also check at x=0 and 2.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 128 (47.68 ms, 96.3 MiB peak process RSS). The runs did not locate a ceiling for this family. A univariate binomial has n+1 terms. With several variables the number of monomials can grow combinatorially even at modest degree.
Measured times, memory and outcomes
degree · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
26.10
75.9
2
Baseline
Passed
3.05
75.5
4
Baseline
Passed
2.75
77.3
8
Baseline
Passed
4.23
79.5
16
Stretch
Passed
5.88
82.6
32
Stretch
Passed
6.12
87.9
64
Stretch
Passed
15.73
89.5
128
Stretch
Passed
47.68
96.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.simplify · 2 passing test cases, 11 distinct argument descriptions
A rectangular prism measures 2.5 m by 4 m by 3.2 m. Find its volume.
Worked solution
; .
Using RatMath
Attach the unit when entering each measurement. Convert compatible quantities to a common unit before reading or comparing their values.
JavaScript module
import * as units from "@ratmath/core/units";
console.log(String(units.Q("2.5 m").multiply(units.Q("4 m")).multiply(units.Q("3.2 m"))));
Checked output
32 m^3
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Right triangles and solids with a few positive lengths; squares and roots of two- or three-digit numbers.
For this problem type. Use one measured quantity with a short unit expression. Common conversions range from a factor of 10 to 1,000 in either direction.
Focal example. The code above passed its displayed check in 0.179 ms on Node.
Same API, measured input family.units.Q · length in metres. Baseline test points across courses 1, 10, 100, 1,000. After conversion to cm the numeric value is exactly 100n.
Practical limit. Largest passing sample 1,000,000,000 (0.305 ms, 75.7 MiB peak process RSS). The runs did not locate a ceiling for this family. These tests convert lengths. Check units and dimensional compatibility, especially for areas, volumes, affine temperature scales and compound units.
Measured times, memory and outcomes
length in metres · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.514
76.1
10
Baseline
Passed
0.444
74.1
100
Baseline
Passed
0.442
75.3
1,000
Baseline
Passed
0.480
74.4
1,000,000
Stretch
Passed
0.710
75
1,000,000,000
Stretch
Passed
0.305
75.7
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Day 31 / 40 · Distance and solids
Diagonal of a box
Direct calculation@ratmath/algebraic
Problem
A box has perpendicular edges 2, 3 and 6. Find its space diagonal.
Worked solution
The squared diagonal is 4+9+36 = 49, hence the positive length is 7.
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as algebraic from "@ratmath/algebraic";
console.log(String(algebraic.sqrt(49).toRational()));
Checked output
7
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Right triangles and solids with a few positive lengths; squares and roots of two- or three-digit numbers.
Focal example. The code above passed its displayed check in 0.107 ms on Node.
Same API, measured input family.algebraic.sqrt · integer scale k. Baseline test points across courses 1, 2, 7, 50. √(k²) has the nonnegative rational value k.
Practical limit. Largest passing sample 1,000,000 (0.266 ms, 74.3 MiB peak process RSS). The runs did not locate a ceiling for this family. This sweep uses perfect squares. Nonsquares involve algebraic representations and higher-degree combinations can cost substantially more.
Measured times, memory and outcomes
integer scale k · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.312
75.2
2
Baseline
Passed
0.275
75.7
7
Baseline
Passed
0.237
75.3
50
Baseline
Passed
0.238
74.1
10,000
Stretch
Passed
0.285
74.1
1,000,000
Stretch
Passed
0.266
74.3
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
algebraic.sqrt · 17 passing test cases, 8 distinct argument descriptions
With height fixed, what happens to volume when the radius doubles?
Worked solution
The two factors of radius each double, while π and height stay fixed.
Using RatMath
Put the arithmetic inside the R tag so RatMath parses the literals. Keep fractions as ratios throughout the calculation and attach the units from the problem to the result.
JavaScript module
import { R } from "@ratmath/core";
console.log(String(R`2^2`));
Checked output
4
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Right triangles and solids with a few positive lengths; squares and roots of two- or three-digit numbers.
Focal example. The code above passed its displayed check in 0.076 ms on Node.
Same arithmetic expression. Replaced its first numeral 2 with 0, 1, 2, 7, 12, 100, 1000, -3, 1/2. All 9 defined variants agreed exactly with Python’s rational arithmetic. This varies the arithmetic operation while holding the rest of the expression fixed.
Related workload in this unit.core.Rational.multiply · operand bits. Baseline test points across courses 8, 32, 64, 256. Cross-multiply the unreduced integer products; operands have unlike denominators.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 131,072 (1.53 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Intermediate products can have twice the bit length of their factors. Repeated squaring can exhaust the engine’s BigInt allocation limit in a small number of steps.
Measured times, memory and outcomes
operand bits · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
8
Baseline
Passed
0.317
74.6
32
Baseline
Passed
0.035
75.5
64
Baseline
Passed
0.045
75.1
256
Baseline
Passed
0.106
74
1,024
Stretch
Passed
0.035
75.3
8,192
Stretch
Passed
0.075
75.8
32,768
Stretch
Passed
0.245
75
131,072
Stretch
Passed
1.53
75.5
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
Reflect the point in the -axis, then translate it 2 right and 4 up. Where does it land?
Worked solution
, then .
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as geo from "@ratmath/geo";
const yAxis = geo.line([0, 0], [0, 1]);
console.log(String(geo.translation([2, 4]).compose(geo.reflection(yAxis)).apply([3, -5])));
Checked output
(-1, -1)
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One to three plane transformations of a triangle or quadrilateral, with simple angle fractions or integer coordinates.
Focal example. The code above passed its displayed check in 0.424 ms on Node.
Related workload in this unit.geo.midpoint · absolute coordinate. Baseline test points across courses 0, 1, 10, 100. Midpoint of (−k,0) and (k,2k) equals (0,k).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,000 (0.175 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Coordinate size and dimension affect exact distance and dot products. Floating geometry near coincidence can lose significant digits.
Measured times, memory and outcomes
absolute coordinate · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
0
Baseline
Passed
0.193
74.9
1
Baseline
Passed
0.197
75.2
10
Baseline
Passed
0.151
75.4
100
Baseline
Passed
0.169
75.6
1,000,000
Stretch
Passed
0.298
76.3
1,000,000,000
Stretch
Passed
0.175
75.5
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
geo.line · 10 passing test cases, 15 distinct argument descriptions
Write the equation and name the variable to solve for. Check returned candidates against the original domain and any restrictions in the question.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.solve("x + 2x + 3x = 180", "x")));
Checked output
x = 30
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One to three plane transformations of a triangle or quadrilateral, with simple angle fractions or integer coordinates.
For this problem type. Start with one unknown, small signed coefficients and degree one or two. Higher-degree or parameter-dependent equations need separate cases.
Focal example. The code above passed its displayed check in 0.512 ms on Node.
Same API, measured input family.symbolic.solve · absolute coefficient. Baseline test points across courses 1, 2, 10, 100. Solve n·x+1=3n+1; the unique root is 3.
Practical limit. Largest passing sample 1,000,000,000 (6.48 ms, 75.9 MiB peak process RSS). The runs did not locate a ceiling for this family. One linear unknown has a simple root here. A vanishing coefficient may produce no solution or infinitely many. Multiple parameters require case analysis.
Measured times, memory and outcomes
absolute coefficient · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
16.76
75.8
2
Baseline
Passed
7.72
74.9
10
Baseline
Passed
29.10
75.2
100
Baseline
Passed
12.79
74.6
10,000
Stretch
Passed
28.50
76.3
1,000,000,000
Stretch
Passed
6.48
75.9
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.solve · 21 passing test cases, 71 distinct argument descriptions
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as geo from "@ratmath/geo";
console.log(String(geo.midpoint([-4, 7], [6, -1])));
Checked output
(1, 3)
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One to three plane transformations of a triangle or quadrilateral, with simple angle fractions or integer coordinates.
Focal example. The code above passed its displayed check in 0.107 ms on Node.
Same API, measured input family.geo.midpoint · absolute coordinate. Baseline test points across courses 0, 1, 10, 100. Midpoint of (−k,0) and (k,2k) equals (0,k).
Practical limit. Largest passing sample 1,000,000,000 (0.175 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Coordinate size and dimension affect exact distance and dot products. Floating geometry near coincidence can lose significant digits.
Measured times, memory and outcomes
absolute coordinate · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
0
Baseline
Passed
0.193
74.9
1
Baseline
Passed
0.197
75.2
10
Baseline
Passed
0.151
75.4
100
Baseline
Passed
0.169
75.6
1,000,000
Stretch
Passed
0.298
76.3
1,000,000,000
Stretch
Passed
0.175
75.5
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
geo.midpoint · 1 passing test case, 1 distinct argument description
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as geo from "@ratmath/geo";
console.log(String(geo.rotation([0, 0], "1/4").apply([4, 1])));
Checked output
(-1, 4)
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One to three plane transformations of a triangle or quadrilateral, with simple angle fractions or integer coordinates.
Focal example. The code above passed its displayed check in 0.202 ms on Node.
Related workload in this unit.geo.midpoint · absolute coordinate. Baseline test points across courses 0, 1, 10, 100. Midpoint of (−k,0) and (k,2k) equals (0,k).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,000 (0.175 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Coordinate size and dimension affect exact distance and dot products. Floating geometry near coincidence can lose significant digits.
Measured times, memory and outcomes
absolute coordinate · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
0
Baseline
Passed
0.193
74.9
1
Baseline
Passed
0.197
75.2
10
Baseline
Passed
0.151
75.4
100
Baseline
Passed
0.169
75.6
1,000,000
Stretch
Passed
0.298
76.3
1,000,000,000
Stretch
Passed
0.175
75.5
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
geo.rotation · 2 passing test cases, 5 distinct argument descriptions
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as geo from "@ratmath/geo";
console.log(String(geo.dilation([1, 1], 3).apply([3, 2])));
Checked output
(7, 4)
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One to three plane transformations of a triangle or quadrilateral, with simple angle fractions or integer coordinates.
Focal example. The code above passed its displayed check in 0.095 ms on Node.
Related workload in this unit.geo.midpoint · absolute coordinate. Baseline test points across courses 0, 1, 10, 100. Midpoint of (−k,0) and (k,2k) equals (0,k).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,000 (0.175 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Coordinate size and dimension affect exact distance and dot products. Floating geometry near coincidence can lose significant digits.
Measured times, memory and outcomes
absolute coordinate · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
0
Baseline
Passed
0.193
74.9
1
Baseline
Passed
0.197
75.2
10
Baseline
Passed
0.151
75.4
100
Baseline
Passed
0.169
75.6
1,000,000
Stretch
Passed
0.298
76.3
1,000,000,000
Stretch
Passed
0.175
75.5
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
geo.dilation · 1 passing test case, 2 distinct argument descriptions
Direct calculation@ratmath/symbolic · @ratmath/core
Problem
Two supplementary angles measure and . Find and both angles.
Worked solution
, ; the angles are and .
Using RatMath
Write the equation and name the variable to solve for. Check returned candidates against the original domain and any restrictions in the question.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
import { R } from "@ratmath/core";
const PRINT = console.log;
const s = symbolic.solve("(3x + 10) + (2x - 5) = 180", "x");
PRINT(s);
const x = R`35`;
console.log([x, R`3*${x} + 10`, R`2*${x} - 5`]);
Checked output
[35, 115, 65]
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One to three plane transformations of a triangle or quadrilateral, with simple angle fractions or integer coordinates.
For this problem type. Start with one unknown, small signed coefficients and degree one or two. Higher-degree or parameter-dependent equations need separate cases.
Focal example. The code above passed its displayed check in 1.04 ms on Node.
Same API, measured input family.symbolic.solve · absolute coefficient. Baseline test points across courses 1, 2, 10, 100. Solve n·x+1=3n+1; the unique root is 3.
Practical limit. Largest passing sample 1,000,000,000 (6.48 ms, 75.9 MiB peak process RSS). The runs did not locate a ceiling for this family. One linear unknown has a simple root here. A vanishing coefficient may produce no solution or infinitely many. Multiple parameters require case analysis.
Measured times, memory and outcomes
absolute coefficient · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
16.76
75.8
2
Baseline
Passed
7.72
74.9
10
Baseline
Passed
29.10
75.2
100
Baseline
Passed
12.79
74.6
10,000
Stretch
Passed
28.50
76.3
1,000,000,000
Stretch
Passed
6.48
75.9
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.solve · 21 passing test cases, 71 distinct argument descriptions
Translate (1,−1) by (2,3) and then (−4,1). Where does it end?
Worked solution
Add each displacement to the corresponding coordinate.
Using RatMath
Construct an Integer or Rational before applying its methods. Use fraction strings or integer inputs to preserve exact values.
JavaScript module
import { Integer } from "@ratmath/core";
console.log([new Integer(1+2-4),new Integer(-1+3+1)]);
Checked output
[-1, 3]
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One to three plane transformations of a triangle or quadrilateral, with simple angle fractions or integer coordinates.
Focal example. The code above passed its displayed check in 0.057 ms on Node.
Related workload in this unit.core.R · whole-number operand. Baseline test points across courses 0, 1, 10, 20, 100, 1,000, 1,000,000. (n+7)(n−3) by independent BigInt arithmetic.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 9,007,199,254,740,991 (1.67 ms, 75.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Exact integer arithmetic grows with operand bit length. Enter large integers as decimal strings or BigInts before any JavaScript Number conversion.
Measured times, memory and outcomes
whole-number operand · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
0
Baseline
Passed
1.75
75
1
Baseline
Passed
1.70
75.7
10
Baseline
Passed
1.78
75.1
20
Baseline
Passed
1.88
75.4
100
Baseline
Passed
1.55
75.4
1,000
Baseline
Passed
1.36
75.3
1,000,000
Baseline
Passed
1.39
74.8
1,000,000,000
Stretch
Passed
1.69
76.3
9,007,199,254,740,991
Stretch
Passed
1.67
75.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.Integer · 170 passing test cases, 60 distinct argument descriptions
Does an enlargement of a nondegenerate triangle by factor 2 preserve congruence?
Worked solution
Its angles stay the same and all side lengths double. It is similar and fails the equal-side-length test for congruence.
Working without a calculator
Use the argument or construction in the worked solution. This lesson assigns the reasoning to the student.
Input range and limits
Typical inputs for this unit. One to three plane transformations of a triangle or quadrilateral, with simple angle fractions or integer coordinates.
Scope of verification. This day asks for a hand argument, construction or interpretation. The worked instance gives the input. General claims need the reasoning shown above. A measured time, memory ceiling or finite input sweep would not verify that claim.