38 of 40 focal problems use RatMath for a calculation or a substantive step.
Direct calculation
36 · 90%
Assisted
2 · 5%
Worked by hand
2 · 5%
Using the packages
The symbolic solver is useful once the unknown and the equation have been named. Building an equation from a story and checking which solutions satisfy a context remain important student tasks.
Calculator interface
Let learners enter an operation on both sides and see the equality preserved. Display excluded values on a number line and offer substitution into the original equation beside each root.
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 12 days the measured size sweep exercises a named API used in the lesson. Each day identifies its tested inputs and the mathematical property checked. Hand-worked days give the input scale and the argument to verify.
Ranges across the five units
Days 1–8 · Equations and inequalities. One unknown, two sides and about two to six terms, with integer or simple rational coefficients.
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 9–16 · Lines and systems. One line or a pair of lines. Two variables, small integer slopes or fractions with single-digit denominators.
Unit benchmark · linalg.solve.exact, unknowns. Largest passing sample 128 (64.25 ms, 90.7 MiB peak process RSS). The runs did not locate a ceiling for this family.
Days 17–24 · Powers and polynomials. One or two variables, degrees usually 1–4 and a handful of terms per factor.
Unit benchmark · symbolic.expand, degree. Largest passing sample 128 (47.68 ms, 96.3 MiB peak process RSS). The runs did not locate a ceiling for this family.
Days 25–32 · Quadratic models. Real quadratics, coefficients usually under 50 in magnitude, including double roots and no real root.
Unit benchmark · symbolic.expand, degree. Largest passing sample 128 (47.68 ms, 96.3 MiB peak process RSS). The runs did not locate a ceiling for this family.
Days 33–40 · Functions and sequences. Arithmetic or geometric sequences of about 5–20 terms; growth rates per period must share the time unit.
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.
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("4(2x - 3) - 5 = 3x + 8", "x")));
Checked output
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. One unknown, two sides and about two to six terms, with integer or simple rational coefficients.
For this problem type. Start with one unknown, small signed coefficients and degree one or two. Higher-degree or parameter-dependent equations need separate cases.
Focal example. The code above passed its displayed check in 0.612 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
Assume a nondegenerate trapezoid so its height is positive. Dividing by h would require a separate case if the equation were used with h=0.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.solve("A = 1/2*h*(b + c)", "b")));
Checked output
b = (2*A - c*h)/h
provided -h != 0
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One unknown, two sides and about two to six terms, with integer or simple rational coefficients.
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 6.88 ms on Node.
Same API, measured input family.symbolic.solve · absolute coefficient. Baseline test points across courses 1, 2, 10, 100. Solve n·x+1=3n+1; the unique root is 3.
Practical limit. Largest passing sample 1,000,000,000 (6.48 ms, 75.9 MiB peak process RSS). The runs did not locate a ceiling for this family. One linear unknown has a simple root here. A vanishing coefficient may produce no solution or infinitely many. Multiple parameters require case analysis.
Measured times, memory and outcomes
absolute coefficient · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
16.76
75.8
2
Baseline
Passed
7.72
74.9
10
Baseline
Passed
29.10
75.2
100
Baseline
Passed
12.79
74.6
10,000
Stretch
Passed
28.50
76.3
1,000,000,000
Stretch
Passed
6.48
75.9
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.solve · 21 passing test cases, 71 distinct argument descriptions
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.solveInequality("-3 < 2x + 1 <= 7", "x")));
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. One unknown, two sides and about two to six terms, with integer or simple rational coefficients.
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 3.26 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
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("abs(2x - 5) = 9", "x")));
Checked output
x = -2, 7
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One unknown, two sides and about two to six terms, with integer or simple rational coefficients.
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 3.73 ms on Node.
Same API, measured input family.symbolic.solve · absolute coefficient. Baseline test points across courses 1, 2, 10, 100. Solve n·x+1=3n+1; the unique root is 3.
Practical limit. Largest passing sample 1,000,000,000 (6.48 ms, 75.9 MiB peak process RSS). The runs did not locate a ceiling for this family. One linear unknown has a simple root here. A vanishing coefficient may produce no solution or infinitely many. Multiple parameters require case analysis.
Measured times, memory and outcomes
absolute coefficient · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
16.76
75.8
2
Baseline
Passed
7.72
74.9
10
Baseline
Passed
29.10
75.2
100
Baseline
Passed
12.79
74.6
10,000
Stretch
Passed
28.50
76.3
1,000,000,000
Stretch
Passed
6.48
75.9
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.solve · 21 passing test cases, 71 distinct argument descriptions
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.solveInequality("-2x + 5 >= 13", "x")));
Checked output
(-inf, -4]
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One unknown, two sides and about two to six terms, with integer or simple rational coefficients.
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 1.40 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
Write the equation and name the variable to solve for. Check returned candidates against the original domain and any restrictions in the question.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.solve("5(x - 2) = 3x + 6", "x")));
Checked output
x = 8
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One unknown, two sides and about two to six terms, with integer or simple rational coefficients.
For this problem type. Start with one unknown, small signed coefficients and degree one or two. Higher-degree or parameter-dependent equations need separate cases.
Focal example. The code above passed its displayed check in 1.20 ms on Node.
Same API, measured input family.symbolic.solve · absolute coefficient. Baseline test points across courses 1, 2, 10, 100. Solve n·x+1=3n+1; the unique root is 3.
Practical limit. Largest passing sample 1,000,000,000 (6.48 ms, 75.9 MiB peak process RSS). The runs did not locate a ceiling for this family. One linear unknown has a simple root here. A vanishing coefficient may produce no solution or infinitely many. Multiple parameters require case analysis.
Measured times, memory and outcomes
absolute coefficient · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
16.76
75.8
2
Baseline
Passed
7.72
74.9
10
Baseline
Passed
29.10
75.2
100
Baseline
Passed
12.79
74.6
10,000
Stretch
Passed
28.50
76.3
1,000,000,000
Stretch
Passed
6.48
75.9
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.solve · 21 passing test cases, 71 distinct argument descriptions
Subtract 2x and get 2 = 3. The solution set is empty.
Using RatMath
Write the equation and name the variable to solve for. Check returned candidates against the original domain and any restrictions in the question.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(symbolic.solve("2*(x+1)=2*x+3","x").solutions.length);
Checked output
0
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One unknown, two sides and about two to six terms, with integer or simple rational coefficients.
For this problem type. Start with one unknown, small signed coefficients and degree one or two. Higher-degree or parameter-dependent equations need separate cases.
Focal example. The code above passed its displayed check in 0.301 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
Why must the inequality sign flip when dividing −2x < 6 by −2?
Worked solution
Multiplying a number line by a negative reverses its order. The solution is x > −3. A single substituted value cannot justify the order rule.
Working without a calculator
Use the argument or construction in the worked solution. This lesson assigns the reasoning to the student.
Input range and limits
Typical inputs for this unit. One unknown, two sides and about two to six terms, with integer or simple rational coefficients.
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 09 / 40 · Lines and systems
Slope and intercept
Direct calculation@ratmath/symbolic
Problem
Write in slope–intercept form. What are the slope and the -intercept?
Worked solution
: slope , intercept .
Using RatMath
Write the equation and name the variable to solve for. Check returned candidates against the original domain and any restrictions in the question.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.solve("3x - 4y = 12", "y")));
Checked output
y = 3*x/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. One line or a pair of lines. Two variables, small integer slopes or fractions with single-digit denominators.
For this problem type. Start with one unknown, small signed coefficients and degree one or two. Higher-degree or parameter-dependent equations need separate cases.
Focal example. The code above passed its displayed check in 0.707 ms on Node.
Same API, measured input family.symbolic.solve · absolute coefficient. Baseline test points across courses 1, 2, 10, 100. Solve n·x+1=3n+1; the unique root is 3.
Practical limit. Largest passing sample 1,000,000,000 (6.48 ms, 75.9 MiB peak process RSS). The runs did not locate a ceiling for this family. One linear unknown has a simple root here. A vanishing coefficient may produce no solution or infinitely many. Multiple parameters require case analysis.
Measured times, memory and outcomes
absolute coefficient · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
16.76
75.8
2
Baseline
Passed
7.72
74.9
10
Baseline
Passed
29.10
75.2
100
Baseline
Passed
12.79
74.6
10,000
Stretch
Passed
28.50
76.3
1,000,000,000
Stretch
Passed
6.48
75.9
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.solve · 21 passing test cases, 71 distinct argument descriptions
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as geo from "@ratmath/geo";
console.log(String(geo.parallelThrough(geo.line([0, 5], [1, 8]), [2, -1])));
Checked output
3·x - y - 7 = 0
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One line or a pair of lines. Two variables, small integer slopes or fractions with single-digit denominators.
Focal example. The code above passed its displayed check in 0.447 ms on Node.
Related workload in this unit.geo.midpoint · absolute coordinate. Baseline test points across courses 0, 1, 10, 100. Midpoint of (−k,0) and (k,2k) equals (0,k).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,000 (0.175 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Coordinate size and dimension affect exact distance and dot products. Floating geometry near coincidence can lose significant digits.
Measured times, memory and outcomes
absolute coordinate · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
0
Baseline
Passed
0.193
74.9
1
Baseline
Passed
0.197
75.2
10
Baseline
Passed
0.151
75.4
100
Baseline
Passed
0.169
75.6
1,000,000
Stretch
Passed
0.298
76.3
1,000,000,000
Stretch
Passed
0.175
75.5
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
geo.line · 10 passing test cases, 15 distinct argument descriptions
A theatre sold 120 tickets for $780. Adult tickets cost $8 and child tickets $5. How many of each were sold?
Worked solution
, : , so 60 adult and 60 child tickets.
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.solveSystem(["a + c = 120", "8a + 5c = 780"], ["a", "c"])));
Checked output
a = 60, c = 60
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One line or a pair of lines. Two variables, small integer slopes or fractions with single-digit denominators.
For this problem type. Linear systems in written exercises usually have two or three unknowns and as many equations. Include a dependent or inconsistent pair.
Focal example. The code above passed its displayed check in 1.59 ms on Node.
Related workload in this unit.linalg.solve.exact · unknowns. Baseline test points across courses 1, 2, 4, 8. For dense I+J and b=(n+1)·1 every component of x must be one.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 128 (64.25 ms, 90.7 MiB peak process RSS). The runs did not locate a ceiling for this family. Solving a nonsingular system checks one solution. Singular or inconsistent systems require rank and consistency checks. Large denominators increase exact cost.
Measured times, memory and outcomes
unknowns · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
22.32
75.6
2
Baseline
Passed
2.28
75.3
4
Baseline
Passed
7.02
75.1
8
Baseline
Passed
2.47
75.3
16
Stretch
Passed
4.34
77.1
32
Stretch
Passed
8.06
79.4
64
Stretch
Passed
63.87
89.9
128
Stretch
Passed
64.25
90.7
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.solveSystem · 4 passing test cases, 13 distinct argument descriptions
Put the arithmetic inside the R tag so RatMath parses the literals. Keep fractions as ratios throughout the calculation and attach the units from the problem to the result.
JavaScript module
import { R } from "@ratmath/core";
console.log(String(R`(-7 - 5)/(4 - (-2))`));
Checked output
-2
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One line or a pair of lines. Two variables, small integer slopes or fractions with single-digit denominators.
Focal example. The code above passed its displayed check in 0.129 ms on Node.
Same arithmetic expression. Replaced its first numeral 7 with 0, 1, 2, 7, 12, 100, 1000, -3, 1/2. All 9 defined variants agreed exactly with Python’s rational arithmetic. This varies the arithmetic operation while holding the rest of the expression fixed.
Related workload in this unit.core.Rational.add · denominator. Baseline test points across courses 1, 2, 3, 12, 100, 1,000. Cross-multiply 1/n + 1/(n+1) against (2n+1)/(n(n+1)).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,007 (0.038 ms, 76.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Exact work depends on the bit lengths of both numerator and denominator. A long sum of relatively prime fractions can build a large common denominator.
Measured times, memory and outcomes
denominator · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.034
74.9
2
Baseline
Passed
0.036
75.6
3
Baseline
Passed
0.040
75.9
12
Baseline
Passed
0.039
75.2
100
Baseline
Passed
0.041
75
1,000
Baseline
Passed
0.035
75.8
1,000,003
Stretch
Passed
0.044
75
1,000,000,007
Stretch
Passed
0.038
76.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
Write the equation of the line through and in slope–intercept form.
Worked solution
, so .
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as geo from "@ratmath/geo";
const l = geo.line([-2, 5], [4, -7]);
console.log([l.toSlopeIntercept(), l.toPointSlope([-2, 5])]);
Checked output
["y = -2x + 1", "y - 5 = -2(x + 2)"]
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One line or a pair of lines. Two variables, small integer slopes or fractions with single-digit denominators.
Focal example. The code above passed its displayed check in 0.512 ms on Node.
Related workload in this unit.geo.midpoint · absolute coordinate. Baseline test points across courses 0, 1, 10, 100. Midpoint of (−k,0) and (k,2k) equals (0,k).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,000 (0.175 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Coordinate size and dimension affect exact distance and dot products. Floating geometry near coincidence can lose significant digits.
Measured times, memory and outcomes
absolute coordinate · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
0
Baseline
Passed
0.193
74.9
1
Baseline
Passed
0.197
75.2
10
Baseline
Passed
0.151
75.4
100
Baseline
Passed
0.169
75.6
1,000,000
Stretch
Passed
0.298
76.3
1,000,000,000
Stretch
Passed
0.175
75.5
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
geo.line · 10 passing test cases, 15 distinct argument descriptions
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.solveSystem(["y = 2x - 3", "x + y = 9"], ["x", "y"])));
Checked output
x = 4, y = 5
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One line or a pair of lines. Two variables, small integer slopes or fractions with single-digit denominators.
For this problem type. Linear systems in written exercises usually have two or three unknowns and as many equations. Include a dependent or inconsistent pair.
Focal example. The code above passed its displayed check in 4.23 ms on Node.
Related workload in this unit.linalg.solve.exact · unknowns. Baseline test points across courses 1, 2, 4, 8. For dense I+J and b=(n+1)·1 every component of x must be one.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 128 (64.25 ms, 90.7 MiB peak process RSS). The runs did not locate a ceiling for this family. Solving a nonsingular system checks one solution. Singular or inconsistent systems require rank and consistency checks. Large denominators increase exact cost.
Measured times, memory and outcomes
unknowns · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
22.32
75.6
2
Baseline
Passed
2.28
75.3
4
Baseline
Passed
7.02
75.1
8
Baseline
Passed
2.47
75.3
16
Stretch
Passed
4.34
77.1
32
Stretch
Passed
8.06
79.4
64
Stretch
Passed
63.87
89.9
128
Stretch
Passed
64.25
90.7
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.solveSystem · 4 passing test cases, 13 distinct argument descriptions
Set y to zero for the x-intercept (4,0), then set x to zero for (0,6).
Using RatMath
Construct an Integer or Rational before applying its methods. Use fraction strings or integer inputs to preserve exact values.
JavaScript module
import { Rational } from "@ratmath/core";
console.log([new Rational(12,3),new Rational(12,2)]);
Checked output
[4, 6]
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One line or a pair of lines. Two variables, small integer slopes or fractions with single-digit denominators.
Focal example. The code above passed its displayed check in 0.068 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.Rational · 485 passing test cases, 447 distinct argument descriptions
Revenue is 7q and cost is 20 + 3q. At what quantity do they agree?
Worked solution
The contribution per unit is 4. Five contributions cover the fixed cost.
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`20/(7-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. One line or a pair of lines. Two variables, small integer slopes or fractions with single-digit denominators.
Focal example. The code above passed its displayed check in 0.109 ms on Node.
Same arithmetic expression. Replaced its first numeral 20 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
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.simplify("(3x^2*y^3)^2 * 2x*y^(-4)")));
Checked output
18*x^5*y^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. One or two variables, degrees usually 1–4 and a handful of terms per factor.
Focal example. The code above passed its displayed check in 2.36 ms on Node.
Related workload in this unit.symbolic.expand · degree. Baseline test points across courses 1, 2, 4, 8. Sum the expanded coefficients at x=1 by direct substitution; result 2^n. Also check at x=0 and 2.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 128 (47.68 ms, 96.3 MiB peak process RSS). The runs did not locate a ceiling for this family. A univariate binomial has n+1 terms. With several variables the number of monomials can grow combinatorially even at modest degree.
Measured times, memory and outcomes
degree · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
26.10
75.9
2
Baseline
Passed
3.05
75.5
4
Baseline
Passed
2.75
77.3
8
Baseline
Passed
4.23
79.5
16
Stretch
Passed
5.88
82.6
32
Stretch
Passed
6.12
87.9
64
Stretch
Passed
15.73
89.5
128
Stretch
Passed
47.68
96.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.simplify · 2 passing test cases, 11 distinct argument descriptions
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.expand("(2x - 3)(x^2 + 4x - 1)")));
Checked output
2*x^3 + 5*x^2 - 14*x + 3
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One or two variables, degrees usually 1–4 and a handful of terms per factor.
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 0.211 ms on Node.
Same API, measured input family.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. 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. 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.expand · 6 passing test cases, 28 distinct argument descriptions
"sin(x)^2 + cos(x)^2", undefined or "tan(x)*cos(x)", undefined · trigonometry
Day 19 / 40 · Powers and polynomials
Factoring a trinomial
Direct calculation@ratmath/symbolic
Problem
Factor .
Worked solution
.
Using RatMath
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("x^2 - 5x - 24")));
Checked output
(x + 3)*(x - 8)
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One or two variables, degrees usually 1–4 and a handful of terms per factor.
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 1.80 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
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^2 + 7x - 3")));
Checked output
(2*x + 3)*(3*x - 1)
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One or two variables, degrees usually 1–4 and a handful of terms per factor.
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 2.80 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
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("16x^2 - 49")));
Checked output
(4*x + 7)*(4*x - 7)
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One or two variables, degrees usually 1–4 and a handful of terms per factor.
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 1.18 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`2^(-3) * 2^5 / 2^4`));
Checked output
1/4
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One or two variables, degrees usually 1–4 and a handful of terms per factor.
Focal example. The code above passed its displayed check in 0.289 ms on Node.
Same arithmetic expression. Replaced its first numeral 2 with 1, 2, 7, 12, 100, 1000, -3, 1/2. All 8 defined variants agreed exactly with Python’s rational arithmetic. This varies the arithmetic operation while holding the rest of the expression fixed.
Related workload in this unit.core.Rational.multiply · operand bits. Baseline test points across courses 8, 32, 64, 256. Cross-multiply the unreduced integer products; operands have unlike denominators.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 131,072 (1.53 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Intermediate products can have twice the bit length of their factors. Repeated squaring can exhaust the engine’s BigInt allocation limit in a small number of steps.
Measured times, memory and outcomes
operand bits · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
8
Baseline
Passed
0.317
74.6
32
Baseline
Passed
0.035
75.5
64
Baseline
Passed
0.045
75.1
256
Baseline
Passed
0.106
74
1,024
Stretch
Passed
0.035
75.3
8,192
Stretch
Passed
0.075
75.8
32,768
Stretch
Passed
0.245
75
131,072
Stretch
Passed
1.53
75.5
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
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`50^2-1`));
Checked output
2499
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One or two variables, degrees usually 1–4 and a handful of terms per factor.
Focal example. The code above passed its displayed check in 0.102 ms on Node.
Same arithmetic expression. Replaced its first numeral 50 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
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. One or two variables, degrees usually 1–4 and a handful of terms per factor.
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
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^2 - 6x + 5 = 0", "x")));
Checked output
x = 1, 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. Real quadratics, coefficients usually under 50 in magnitude, including double roots and no real root.
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 2.75 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("2x^2 + 3x - 4 = 0", "x")));
Checked output
x = -sqrt(41)/4 - 3/4, sqrt(41)/4 - 3/4
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Real quadratics, coefficients usually under 50 in magnitude, including double roots and no real root.
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 8.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
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";
const c = symbolic.completeSquare("x^2 - 8x + 11");
console.log([String(c.form), c.vertex.map(String)]);
Checked output
["(x - 4)^2 - 5", ["4", "-5"]]
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Real quadratics, coefficients usually under 50 in magnitude, including double roots and no real root.
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 1.84 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.completeSquare · 2 passing test cases, 4 distinct argument descriptions
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.solveSystem(["y = x^2", "y = x + 2"], ["x", "y"])));
Checked output
x = -1, y = 1
x = 2, y = 4
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Real quadratics, coefficients usually under 50 in magnitude, including double roots and no real root.
For this problem type. Linear systems in written exercises usually have two or three unknowns and as many equations. Include a dependent or inconsistent pair.
Focal example. The code above passed its displayed check in 6.84 ms on Node.
Related workload in this unit.linalg.solve.exact · unknowns. Baseline test points across courses 1, 2, 4, 8. For dense I+J and b=(n+1)·1 every component of x must be one.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 128 (64.25 ms, 90.7 MiB peak process RSS). The runs did not locate a ceiling for this family. Solving a nonsingular system checks one solution. Singular or inconsistent systems require rank and consistency checks. Large denominators increase exact cost.
Measured times, memory and outcomes
unknowns · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
22.32
75.6
2
Baseline
Passed
2.28
75.3
4
Baseline
Passed
7.02
75.1
8
Baseline
Passed
2.47
75.3
16
Stretch
Passed
4.34
77.1
32
Stretch
Passed
8.06
79.4
64
Stretch
Passed
63.87
89.9
128
Stretch
Passed
64.25
90.7
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.solveSystem · 4 passing test cases, 13 distinct argument descriptions
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("1/x + 1/(x - 2) = 4/3", "x")));
Checked output
x = 1/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. Real quadratics, coefficients usually under 50 in magnitude, including double roots and no real root.
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.46 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
How many distinct real roots does (x−3)² = 0 have?
Worked solution
Only x = 3 gives a zero square. The same linear factor appears twice.
Using RatMath
Write the equation and name the variable to solve for. Check returned candidates against the original domain and any restrictions in the question.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.solve("(x-3)^2=0","x")));
Checked output
x = 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. Real quadratics, coefficients usually under 50 in magnitude, including double roots and no real root.
For this problem type. Start with one unknown, small signed coefficients and degree one or two. Higher-degree or parameter-dependent equations need separate cases.
Focal example. The code above passed its displayed check in 0.478 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
The roots of a quadratic are −2 and 8. Where is its axis of symmetry?
Worked solution
Its roots are equidistant from the axis. Take their midpoint.
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+8)/2`));
Checked output
3
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Real quadratics, coefficients usually under 50 in magnitude, including double roots and no real root.
Focal example. The code above passed its displayed check in 0.164 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 rectangle has width x and length x+1 with area 12. Can x = −4 be the width?
Worked solution
The algebraic roots are 3 and −4. Only the positive width 3 describes this 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`3*(3+1)`));
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. Real quadratics, coefficients usually under 50 in magnitude, including double roots and no real root.
Focal example. The code above passed its displayed check in 0.110 ms on Node.
Same arithmetic expression. Replaced its first numeral 3 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
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("2x^2 - 3x + 1").subs({ x: -2 }).simplify()));
Checked output
15
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Arithmetic or geometric sequences of about 5–20 terms; growth rates per period must share the time unit.
Focal example. The code above passed its displayed check in 0.389 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`7 + (50 - 1)*4`));
Checked output
203
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. Arithmetic or geometric sequences of about 5–20 terms; growth rates per period must share the time unit.
Focal example. The code above passed its displayed check in 0.087 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
A population of 500 doubles every 3 years. How large is it after 12 years?
Worked solution
Four doublings: .
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`500 * 2^(12/3)`));
Checked output
8000
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. Arithmetic or geometric sequences of about 5–20 terms; growth rates per period must share the time unit.
Focal example. The code above passed its displayed check in 0.065 ms on Node.
Same arithmetic expression. Replaced its first numeral 500 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
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.simplify("sqrt(12) + sqrt(27)")));
Checked output
5*sqrt(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. Arithmetic or geometric sequences of about 5–20 terms; growth rates per period must share the time unit.
Focal example. The code above passed its displayed check in 0.937 ms on Node.
Related workload in this unit.symbolic.expand · degree. Baseline test points across courses 1, 2, 4, 8. Sum the expanded coefficients at x=1 by direct substitution; result 2^n. Also check at x=0 and 2.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 128 (47.68 ms, 96.3 MiB peak process RSS). The runs did not locate a ceiling for this family. A univariate binomial has n+1 terms. With several variables the number of monomials can grow combinatorially even at modest degree.
Measured times, memory and outcomes
degree · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
26.10
75.9
2
Baseline
Passed
3.05
75.5
4
Baseline
Passed
2.75
77.3
8
Baseline
Passed
4.23
79.5
16
Stretch
Passed
5.88
82.6
32
Stretch
Passed
6.12
87.9
64
Stretch
Passed
15.73
89.5
128
Stretch
Passed
47.68
96.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.simplify · 2 passing test cases, 11 distinct argument descriptions
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";
const f = "x^2 + 1", g = "2x - 3";
console.log(
[symbolic.compose(f, g).value.subs({ x: 2 }).simplify(), symbolic.compose(g, f).value]
);
Checked output
[2, 2*x^2 - 1]
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Arithmetic or geometric sequences of about 5–20 terms; growth rates per period must share the time unit.
Focal example. The code above passed its displayed check in 4.84 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.compose · 6 passing test cases, 10 distinct argument descriptions
Direct calculation@ratmath/algebraic · @ratmath/core
Problem
A linear function has and . Find .
Worked solution
Rate of change , so and .
Using RatMath
Put the arithmetic inside the R tag so RatMath parses the literals. Keep fractions as ratios throughout the calculation and attach the units from the problem to the result.
JavaScript module
import * as algebraic from "@ratmath/algebraic";
import { R } from "@ratmath/core";
const PRINT = console.log;
const f = algebraic.interpolate([[0, 4], [3, 13]]); // coefficients, constant first
PRINT(f);
console.log(String(R`${f[0]} + ${f[1]}*10`));
Checked output
34
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Arithmetic or geometric sequences of about 5–20 terms; growth rates per period must share the time unit.
For this problem type. Use roughly 3–10 distinct nodes. On the line, compare both a nodal value and a value between nodes.
Focal example. The code above passed its displayed check in 0.386 ms on Node.
Same API, measured input family.algebraic.interpolate · equally spaced nodes. Baseline test points across courses 2, 3, 4, 6. The polynomial interpolating 3+2x has coefficients 3,2 and all higher terms vanish.
Practical limit. Largest passing sample 100 (10.18 ms, 83.9 MiB peak process RSS). The runs did not locate a ceiling for this family. Node count and spacing matter. Duplicate nodes can make interpolation undefined. Exact rational coefficients often grow with degree.
Measured times, memory and outcomes
equally spaced nodes · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
2
Baseline
Passed
0.507
75.3
3
Baseline
Passed
0.670
74.3
4
Baseline
Passed
0.473
75.4
6
Baseline
Passed
0.573
75
10
Stretch
Passed
0.539
74.7
25
Stretch
Passed
2.42
75.3
50
Stretch
Passed
7.14
77.7
100
Stretch
Passed
10.18
83.9
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
One account grows by 5 dollars per year and another by 5% per year. Which produces a constant difference?
Worked solution
The fixed-dollar rule is arithmetic. The percentage rule has a constant ratio and its dollar increments depend on the balance.
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. Arithmetic or geometric sequences of about 5–20 terms; growth rates per period must share the time unit.
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 40 / 40 · Functions and sequences
Recursive to explicit
Direct calculation@ratmath/core
Problem
A sequence begins with 7 and adds 4 each time. Find its tenth term.
Worked solution
Nine steps separate the first and tenth terms.
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+9*4`));
Checked output
43
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. Arithmetic or geometric sequences of about 5–20 terms; growth rates per period must share the time unit.
Focal example. The code above passed its displayed check in 0.087 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