38 of 40 focal problems use RatMath for a calculation or a substantive step.
Direct calculation
37 · 92.5%
Assisted
1 · 2.5%
Worked by hand
2 · 5%
Using the packages
Exact ratios, fraction division and signed coordinates fit Core well. Students must choose a common unit and decide whether a comparison asks for a difference or a quotient.
Calculator interface
Use a double number line linked to a ratio table. Keep units on both axes and let a learner switch between one unit, one hundred units and the actual whole.
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
38 of 40 days include a checked executable example. On 10 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 · Ratios and rates. Two related quantities, ratio tables of three to six rows, quantities usually 1–100 and simple percentages.
Unit benchmark · core.Rational.add, denominator. 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.
Days 9–16 · Fraction operations. Two signed or unsigned fractions with denominators about 2–20; one division or a short sequence of operations.
Unit benchmark · core.Rational.add, denominator. 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.
Days 17–24 · Signed numbers and expressions. Signed values usually −20 to 20, one unknown and expressions of two to five terms.
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 25–32 · Shapes and measuring. Two- and three-dimensional figures composed of a few rectangles, triangles or boxes; small integer or half-unit lengths.
Unit benchmark · units.Q, length in metres. 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.
Days 33–40 · Data and comparisons. Data lists of roughly 5–30 observations, or a frequency table with fewer than ten classes.
Unit benchmark · stats.median, observations. Largest passing sample 100,000 (89.20 ms, 116 MiB peak process RSS). The runs did not locate a ceiling for this family.
Accuracy notes (1)
Open · Two distinct categorical tuples can merge. A uniform table on the two arrays [‘a,sb’,‘c’] and [‘a’,‘b,sc’] should give each probability 1/2. The table reports one outcome with probability 1 because the composite string keys collide. Use unambiguous scalar IDs for such labels. Ordinary numeric dice faces have distinct keys.
A class has 12 boys and 18 girls. Write the ratio of boys to girls in simplest form.
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`12/18`));
Checked output
2/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 related quantities, ratio tables of three to six rows, quantities usually 1–100 and simple percentages.
Focal example. The code above passed its displayed check in 0.076 ms on Node.
Same arithmetic expression. Replaced its first numeral 12 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
Six cans of soup cost $4.50. What is the price per can?
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`4.50 / 6`.toDecimal());
Checked output
0.75
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 related quantities, ratio tables of three to six rows, quantities usually 1–100 and simple percentages.
Focal example. The code above passed its displayed check in 0.093 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
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. Two related quantities, ratio tables of three to six rows, quantities usually 1–100 and simple percentages.
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 recipe uses 2 cups of lentils for 3 cups of water. How much water goes with 5 cups of lentils?
Worked solution
Keep the water-to-lentil ratio at 3/2.
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`5*3/2`));
Checked output
15/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. Two related quantities, ratio tables of three to six rows, quantities usually 1–100 and simple percentages.
Focal example. The code above passed its displayed check in 0.074 ms on Node.
Same arithmetic expression. Replaced its first numeral 5 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
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`35/100 * 80`));
Checked output
28
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 related quantities, ratio tables of three to six rows, quantities usually 1–100 and simple percentages.
For this problem type. Use one or two successive rates, often 1–100%, and two decimal places for monetary results. Explicitly identify the base for each rate.
Focal example. The code above passed its displayed check in 0.065 ms on Node.
Same arithmetic expression. Replaced its first numeral 35 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 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("0.4*n = 18", "n")));
Checked output
n = 45
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 related quantities, ratio tables of three to six rows, quantities usually 1–100 and simple percentages.
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 16.28 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
Find the number per hundred by scaling both counts by five.
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`7/20*100`));
Checked output
35
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 related quantities, ratio tables of three to six rows, quantities usually 1–100 and simple percentages.
For this problem type. Use one or two successive rates, often 1–100%, and two decimal places for monetary results. Explicitly identify the base for each rate.
Focal example. The code above passed its displayed check in 0.130 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
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`3/5 * 15`));
Checked output
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. Two related quantities, ratio tables of three to six rows, quantities usually 1–100 and simple percentages.
Focal example. The code above passed its displayed check in 0.076 ms on Node.
Same arithmetic expression. Replaced its first numeral 3 with 0, 1, 2, 7, 12, 100, 1000. All 7 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
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/4) / (2/9)`.toMixedString());
Checked output
3..3/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 signed or unsigned fractions with denominators about 2–20; one division or a short sequence of operations.
Focal example. The code above passed its displayed check in 0.210 ms on Node.
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
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`56.7 / 2.7`));
Checked output
21
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 signed or unsigned fractions with denominators about 2–20; one division or a short sequence of operations.
Focal example. The code above passed its displayed check in 0.094 ms on Node.
Same arithmetic expression. Replaced its first numeral 56.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
Find the greatest common factor and the least common multiple of 24 and 36.
Worked solution
GCF 12, LCM 72.
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`24`.gcd(R`36`), R`24`.lcm(R`36`)]);
Checked output
[12, 72]
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 signed or unsigned fractions with denominators about 2–20; one division or a short sequence of operations.
Focal example. The code above passed its displayed check in 0.416 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
Enter the expression in the form given. Expand or factor the result in reverse to check that it represents the original expression.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.factor("6x + 15")));
Checked output
3*(2*x + 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 signed or unsigned fractions with denominators about 2–20; one division or a short sequence of operations.
For this problem type. Use one or two variables and polynomial degrees roughly 2–6. Rational expressions often have two or three denominator factors.
Focal example. The code above passed its displayed check in 5.83 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.factor · 1 passing test case, 4 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`4 / (1/3)`));
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. Two signed or unsigned fractions with denominators about 2–20; one division or a short sequence of operations.
Focal example. The code above passed its displayed check in 0.155 ms on Node.
Same arithmetic expression. Replaced its first numeral 4 with 0, 1, 2, 7, 12, 100, 1000. All 7 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
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as numtheory from "@ratmath/numtheory";
console.log(numtheory.divisors(36n));
Checked output
[1n, 2n, 3n, 4n, 6n, 9n, 12n, 18n, 36n]
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 signed or unsigned fractions with denominators about 2–20; one division or a short sequence of operations.
Focal example. The code above passed its displayed check in 3.28 ms on Node.
Related workload in this unit.numtheory.factor · known semiprime. Baseline test points across courses 15, 77, 899, 10,403. Recover both planted prime factors, including exponent one.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,036,000,099 (5.12 ms, 77 MiB peak process RSS). The runs did not locate a ceiling for this family. Equal-length integers can have very different factoring times. These planted semiprimes give sample timings, with no general bound for the next integer.
Measured times, memory and outcomes
known semiprime · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
15
Baseline
Passed
0.331
76
77
Baseline
Passed
0.309
76.3
899
Baseline
Passed
0.298
74.9
10,403
Baseline
Passed
0.327
75.7
1,022,117
Stretch
Passed
0.397
75.8
100,160,063
Stretch
Passed
0.922
75.4
1,000,036,000,099
Stretch
Passed
5.12
77
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.
numtheory.divisors · 1 passing test case, 6 distinct argument descriptions
Write 18 + 30 as a product with its greatest common factor.
Worked solution
Both terms are divisible by six and 3 and 5 have no common factor above one. The product is 6(3+5).
Using RatMath
Use the result for the computational step. The worked solution explains the remaining mathematical inference.
JavaScript module
import * as numtheory from "@ratmath/numtheory";
console.log(numtheory.gcd(18,30));
Checked output
6n
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 signed or unsigned fractions with denominators about 2–20; one division or a short sequence of operations.
Focal example. The code above passed its displayed check in 0.111 ms on Node.
Same API, measured input family.numtheory.gcd · operand bits. Baseline test points across courses 4, 8, 16, 32. Consecutive integers m,m+1 are coprime, so gcd(7m,7(m+1))=7.
Practical limit. Largest passing sample 32,768 (0.183 ms, 75.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Euclidean reduction depends on operand size and their quotient sequence. Consecutive Fibonacci numbers need more steps than many inputs of the same bit length.
Measured times, memory and outcomes
operand bits · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
4
Baseline
Passed
0.171
74.8
8
Baseline
Passed
0.132
74.7
16
Baseline
Passed
0.129
74.8
32
Baseline
Passed
0.131
76.2
256
Stretch
Passed
0.124
74.5
4,096
Stretch
Passed
0.165
74.9
32,768
Stretch
Passed
0.183
75.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.
numtheory.gcd · 1 passing test case, 1 distinct argument description
Two halves fit in one, so the quotient is almost twice twenty.
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`19.8/0.5`));
Checked output
198/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 signed or unsigned fractions with denominators about 2–20; one division or a short sequence of operations.
Focal example. The code above passed its displayed check in 0.103 ms on Node.
Same arithmetic expression. Replaced its first numeral 19.8 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
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 - (-12)`));
Checked output
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. Signed values usually −20 to 20, one unknown and expressions of two to five terms.
Focal example. The code above passed its displayed check in 0.205 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.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
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`.abs().add(R`3`.abs())));
Checked output
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. Signed values usually −20 to 20, one unknown and expressions of two to five terms.
Focal example. The code above passed its displayed check in 0.084 ms on Node.
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
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. Signed values usually −20 to 20, one unknown and expressions of two to five terms.
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
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.sym("3x^2 - 2y").subs({ x: 4, y: 5 }).simplify()));
Checked output
38
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. Signed values usually −20 to 20, one unknown and expressions of two to five terms.
Focal example. The code above passed its displayed check in 2.06 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.sym · 14 passing test cases, 44 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`-2-(-7)`));
Checked output
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. Signed values usually −20 to 20, one unknown and expressions of two to five terms.
Focal example. The code above passed its displayed check in 0.091 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.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
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 + 7.5 = 12", "x")));
Checked output
x = 9/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. Signed values usually −20 to 20, one unknown and expressions of two to five terms.
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.01 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
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("3/4*x = 18", "x")));
Checked output
x = 24
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. Signed values usually −20 to 20, one unknown and expressions of two to five terms.
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.16 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`2^5 - 3^3`));
Checked output
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. Signed values usually −20 to 20, one unknown and expressions of two to five terms.
Focal example. The code above passed its displayed check in 0.123 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
A triangle has base 9 cm and height 6 cm. What is its area?
Worked solution
.
Using RatMath
Enter the coordinates in vertex order. Read the requested centre, length or radius using the same coordinate system as the problem.
JavaScript module
import * as geo from "@ratmath/geo";
console.log(String(geo.triangle([0, 0], [9, 0], [2, 6]).area));
Checked output
27
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- and three-dimensional figures composed of a few rectangles, triangles or boxes; small integer or half-unit lengths.
Focal example. The code above passed its displayed check in 0.264 ms on Node.
Same API, measured input family.geo.triangle · scale on a 3–4–5 triangle. Baseline test points across courses 1, 2, 5, 10. The unsigned area scales by k² from 6.
Practical limit. Largest passing sample 1,000,000 (0.273 ms, 75.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Rescaling preserves this triangle’s shape. Collinear and nearly collinear coordinates need separate checks for undefined angles and small signed area.
Measured times, memory and outcomes
scale on a 3–4–5 triangle · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.270
74.8
2
Baseline
Passed
0.388
74.9
5
Baseline
Passed
0.287
76.4
10
Baseline
Passed
0.264
75.6
100
Stretch
Passed
0.278
75.3
10,000
Stretch
Passed
0.268
76.8
1,000,000
Stretch
Passed
0.273
75.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.
geo.triangle · 5 passing test cases, 4 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. Two- and three-dimensional figures composed of a few rectangles, triangles or boxes; small integer or half-unit lengths.
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 27 / 40 · Shapes and measuring
Area and perimeter
Direct calculation@ratmath/core
Problem
A rectangular garden is feet by 4 feet. Find its area and its perimeter.
Worked solution
Area ; perimeter ft.
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";
import { R } from "@ratmath/core";
const L = units.Q("7..1/2 ft"), W = units.Q("4 ft");
console.log([L.multiply(W), L.add(W).multiply(R`2`)]);
Checked output
[30 ft^2, 23 ft]
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- and three-dimensional figures composed of a few rectangles, triangles or boxes; small integer or half-unit lengths.
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.279 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.
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 box is 5 cm long, 3 cm wide and 4 cm tall. What is 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("5 cm").multiply(units.Q("3 cm")).multiply(units.Q("4 cm"))));
Checked output
60 cm^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- and three-dimensional figures composed of a few rectangles, triangles or boxes; small integer or half-unit lengths.
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.285 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 29 / 40 · Shapes and measuring
Measurement conversion
Direct calculation@ratmath/core
Problem
A trail is 3.5 km long. How many metres is that?
Worked solution
3500 m.
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("3.5 km").to("m")));
Checked output
3500 m
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- and three-dimensional figures composed of a few rectangles, triangles or boxes; small integer or half-unit lengths.
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.186 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 30 / 40 · Shapes and measuring
Nets of solids
Worked by hand
Problem
Which faces must appear in a net for a 2×3×4 box?
Worked solution
A pair of 2×3 faces, a pair of 2×4 faces and a pair of 3×4 faces. Fold a sketch to check that the chosen arrangement closes.
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- and three-dimensional figures composed of a few rectangles, triangles or boxes; small integer or half-unit lengths.
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 31 / 40 · Shapes and measuring
Surface area
Direct calculation@ratmath/core
Problem
Find the area of material in a closed 2×3×4 box.
Worked solution
Count both faces in each congruent pair.
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*3+2*4+3*4)`));
Checked output
52
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- and three-dimensional figures composed of a few rectangles, triangles or boxes; small integer or half-unit lengths.
Focal example. The code above passed its displayed check in 0.114 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.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 6×4 rectangle has a 2×1 corner cut out. Find its remaining area.
Worked solution
Subtract the missing rectangle from the enclosing rectangle.
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*4-2*1`));
Checked output
22
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- and three-dimensional figures composed of a few rectangles, triangles or boxes; small integer or half-unit lengths.
Focal example. The code above passed its displayed check in 0.101 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.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
Find the mean, median and mode of 4, 8, 6, 5, 8, 10, 8.
Worked solution
Mean ; sorted 4, 5, 6, 8, 8, 8, 10, so median 8; mode 8.
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";
const d = [4, 8, 6, 5, 8, 10, 8];
console.log([stats.mean(d), stats.median(d), stats.modes(d)]);
Checked output
[7, 8, [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. Data lists of roughly 5–30 observations, or a frequency table with fewer than ten classes.
For this problem type. Use lists of about 4–30 values by hand and tens to hundreds on a calculator. Include ties, fractions and even or odd sample sizes as appropriate.
Focal example. The code above passed its displayed check in 0.656 ms on Node.
Same API, measured input family.stats.median · observations. Baseline test points across courses 3, 6, 25, 100. The median of n descending consecutive integers 1…n is (n+1)/2.
Practical limit. Largest passing sample 100,000 (89.20 ms, 116 MiB peak process RSS). The runs did not locate a ceiling for this family. Retaining or ordering the observations costs memory. Even-length and repeated values need the stated convention for the statistic.
Measured times, memory and outcomes
observations · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
3
Baseline
Passed
0.774
74.4
6
Baseline
Passed
0.685
74.5
25
Baseline
Passed
0.545
76.1
100
Baseline
Passed
0.698
75.3
1,000
Stretch
Passed
1.83
76.2
10,000
Stretch
Passed
9.55
81.4
100,000
Stretch
Passed
89.20
116
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.mean · 4 passing test cases, 10 distinct argument descriptions
For the data 3, 7, 8, 12, 13, 14, 18, 21, find the range, the quartiles and the interquartile range.
Worked solution
Range . Lower half 3, 7, 8, 12 has median ; upper half 13, 14, 18, 21 has median . IQR .
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";
const d = [3, 7, 8, 12, 13, 14, 18, 21];
console.log(
[stats.range(d), stats.quartiles(d, { method: "halves" }), stats.iqr(d, { method: "halves" })]
);
Checked output
[18, [15/2, 25/2, 16], 17/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. Data lists of roughly 5–30 observations, or a frequency table with fewer than ten classes.
For this problem type. Use lists of about 4–30 values by hand and tens to hundreds on a calculator. Include ties, fractions and even or odd sample sizes as appropriate.
Focal example. The code above passed its displayed check in 2.15 ms on Node.
Related workload in this unit.core.range · terms. Baseline test points across courses 1, 10, 100, 1,000. Check length and every consecutive integer from 1 through n.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000 (141 ms, 277.5 MiB peak process RSS). The first sampled passing call above 100 ms used 1,000,000 (141 ms). The runs did not locate a ceiling for this family. Keeping the entire result requires storage proportional to its length. Shortening the displayed list after construction still pays that cost.
Measured times, memory and outcomes
terms · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.173
75.5
10
Baseline
Passed
0.192
74.9
100
Baseline
Passed
0.269
74.7
1,000
Baseline
Passed
1.52
75.6
10,000
Stretch
Passed
5.29
80.9
100,000
Stretch
Passed
11.57
109.6
1,000,000
Stretch
Passed
141
277.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.
stats.range · 2 passing test cases, 3 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.solveInequality("x - 4 > 9", "x")));
Checked output
(13, inf)
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. Data lists of roughly 5–30 observations, or a frequency table with fewer than ten classes.
For this problem type. Use one real variable with one or two inequality signs and low-degree expressions. Record excluded endpoints and signs of factors.
Focal example. The code above passed its displayed check in 2.18 ms on Node.
Related workload in this unit.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. The cutoff for this lesson’s own code is unmeasured. 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. 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.solveInequality · 6 passing test cases, 20 distinct argument descriptions
A class graph shows 5 cats, 8 dogs and 3 fish as pets. How many pets are there in all, and how many more dogs than fish?
Worked solution
16 pets in all; 5 more dogs than fish.
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 stats from "@ratmath/stats";
import { R } from "@ratmath/core";
const pets = { cats: 5, dogs: 8, fish: 3 };
console.log([stats.sum(Object.values(pets)), R`${pets.dogs} - ${pets.fish}`]);
Checked output
[16, 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. Data lists of roughly 5–30 observations, or a frequency table with fewer than ten classes.
Focal example. The code above passed its displayed check in 1.33 ms on Node.
Related workload in this unit.core.range · terms. Baseline test points across courses 1, 10, 100, 1,000. Check length and every consecutive integer from 1 through n.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000 (141 ms, 277.5 MiB peak process RSS). The first sampled passing call above 100 ms used 1,000,000 (141 ms). The runs did not locate a ceiling for this family. Keeping the entire result requires storage proportional to its length. Shortening the displayed list after construction still pays that cost.
Measured times, memory and outcomes
terms · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.173
75.5
10
Baseline
Passed
0.192
74.9
100
Baseline
Passed
0.269
74.7
1,000
Baseline
Passed
1.52
75.6
10,000
Stretch
Passed
5.29
80.9
100,000
Stretch
Passed
11.57
109.6
1,000,000
Stretch
Passed
141
277.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.
stats.sum · 2 passing test cases, 2 distinct argument descriptions
In a random sample of 50 of a school's 1200 students, 18 prefer soccer. Predict how many students in the school prefer soccer.
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`18/50 * 1200`));
Checked output
432
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. Data lists of roughly 5–30 observations, or a frequency table with fewer than ten classes.
Focal example. The code above passed its displayed check in 0.091 ms on Node.
Same arithmetic expression. Replaced its first numeral 18 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
Which question anticipates variability: my age today, or the ages of children on my street?
Worked solution
The second asks about a group whose ages can differ. Identify the population and what one observation measures.
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. Data lists of roughly 5–30 observations, or a frequency table with fewer than ten classes.
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 39 / 40 · Data and comparisons
Mean absolute deviation
Direct calculation@ratmath/core
Problem
Find the mean absolute deviation of 2, 4 and 6 from their mean.
Worked solution
Their mean is 4. Average the distances 2, 0 and 2.
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+0+2)/3`));
Checked output
4/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. Data lists of roughly 5–30 observations, or a frequency table with fewer than ten classes.
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.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 bag has 3 red, 5 blue and 2 green marbles. One is drawn at random. What is the probability that it is not blue?
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 stats from "@ratmath/stats";
console.log(
String(stats.finite({ red: 3, blue: 5, green: 2 }, { normalize: true }).prob((c) => c !== "blue"))
);
Checked output
1/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. Data lists of roughly 5–30 observations, or a frequency table with fewer than ten classes.
For this problem type. Use a few events or a table of roughly 2–36 elementary outcomes. Two to four independent dice are common; verify whether the question needs ordered tuples or a sum.
Focal example. The code above passed its displayed check in 0.447 ms on Node.
Related workload in this unit.stats.die.power · six-sided dice in the ordered sample space. Baseline test points across courses 1, 2, 3, 4. The implicit product has 6^n ordered tuples. Check the exact count and the probability of the all-sixes tuple without listing it.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 100 (2.08 ms, 76.7 MiB peak process RSS). The runs did not locate a ceiling for this family. An independent product stores its factors. Point lookup multiplies one weight per die. An arbitrary predicate may visit 6ⁿ tuples; asking for all entries also consumes exponential space.
Measured times, memory and outcomes
six-sided dice in the ordered sample space · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.650
74.9
2
Baseline
Passed
0.654
75.1
3
Baseline
Passed
0.953
75.2
4
Baseline
Passed
0.755
75.3
7
Stretch
Passed
0.751
75.6
9
Stretch
Passed
0.788
75.6
32
Stretch
Passed
1.68
75.5
100
Stretch
Passed
2.08
76.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.
stats.finite · 7 passing test cases, 14 distinct argument descriptions
Seven ordered dice. The current product represents 279,936 outcomes in 0.34 ms and streams the order-sensitive probability check in 33.46 ms. Accessing .entries materializes all tuples. For the sum, stats.die().sumOf(7) needs only 36 totals. Compare the representations and their measured costs
Accuracy notes (1)
Open · Two distinct categorical tuples can merge. A uniform table on the two arrays [‘a,sb’,‘c’] and [‘a’,‘b,sc’] should give each probability 1/2. The table reports one outcome with probability 1 because the composite string keys collide. Use unambiguous scalar IDs for such labels. Ordinary numeric dice faces have distinct keys.