37 of 40 focal problems use RatMath for a calculation or a substantive step.
Direct calculation
35 · 87.5%
Assisted
2 · 5%
Worked by hand
3 · 7.5%
Using the packages
Factoring, complex arithmetic and solving standard equations have concise APIs. Domain restrictions are easy to lose when a quotient cancels or an equation is squared.
Calculator interface
Let a student toggle original and simplified expressions while keeping holes visible on both graphs. Show candidate roots with their substitutions and rejected roots with a reason.
Each of the 40 focal problems has equal weight. Direct means the displayed package calculation answers the computational question after the inputs are set up. Assisted means it contributes a step and the worked solution supplies essential reasoning, interpretation or selection. Worked by hand means the guide relies on a construction, argument or judgment for that task. The helpful share combines direct and assisted days. Courses and instructors assign different mixes of problems. The percentages describe this syllabus.
Classroom inputs and practical limits
37 of 40 days include a checked executable example. On 18 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 · Complex numbers and polynomial structure. One-variable polynomials of degree 2–5 and complex coefficients of small integer or rational size.
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 9–16 · Rational and radical functions. Numerator and denominator degrees commonly 1–3, square roots and a few domain exclusions.
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 17–24 · Exponentials and logarithms. One exponential or log equation with positive base other than one; growth over about 1–30 periods.
Unit benchmark · symbolic.solve, absolute coefficient. Largest passing sample 1,000,000,000 (6.48 ms, 75.9 MiB peak process RSS). The runs did not locate a ceiling for this family.
Days 25–32 · Systems and transformations. Two or three unknowns and simple affine or quadratic changes of variable.
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 33–40 · Sequences and the binomial theorem. Binomial exponents around 2–12, sums of tens of terms and infinite geometric series with |r|<1.
Unit benchmark · discrete.binomial, objects. Largest passing sample 10,000 (8.36 ms, 88 MiB peak process RSS). The runs did not locate a ceiling for this family.
Day 01 / 40 · Complex numbers and polynomial structure
Multiplying complex numbers
Direct calculation@ratmath/complex
Problem
Worked solution
.
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as complex from "@ratmath/complex";
console.log(String(complex.complex(3, 2).mul(complex.complex(4, -5))));
Checked output
22 - 7i
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-variable polynomials of degree 2–5 and complex coefficients of small integer or rational size.
For this problem type. Use one to three complex inputs, often with small rational coordinates. State the branch, and handle zeros or cut crossings explicitly.
Focal example. The code above passed its displayed check in 0.429 ms on Node.
Same API, measured input family.complex.complex · absolute component. Baseline test points across courses 1, 3, 10, 100. The product (n+i)(n−i) has imaginary part zero and real part n²+1.
Practical limit. Largest passing sample 1,000,000,000 (0.540 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Exact rational complex arithmetic retains both coordinates. Branches, singularities and transcendental functions introduce a separate precision question.
Measured times, memory and outcomes
absolute component · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
1.20
76
3
Baseline
Passed
0.887
75
10
Baseline
Passed
0.519
75.2
100
Baseline
Passed
0.549
74.5
100,000
Stretch
Passed
0.534
75.6
1,000,000,000
Stretch
Passed
0.540
75.5
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
complex.complex · 20 passing test cases, 32 distinct argument descriptions
Day 02 / 40 · Complex numbers and polynomial structure
Dividing complex numbers
Direct calculation@ratmath/complex
Problem
Worked solution
.
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as complex from "@ratmath/complex";
console.log(String(complex.Complex.parse("(2 + i)/(1 - 3i)")));
Checked output
-1/10 + 7/10i
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-variable polynomials of degree 2–5 and complex coefficients of small integer or rational size.
For this problem type. Use one to three complex inputs, often with small rational coordinates. State the branch, and handle zeros or cut crossings explicitly.
Focal example. The code above passed its displayed check in 0.574 ms on Node.
Same API, measured input family.complex.Complex.parse · real part of the numerator. Baseline test points across courses 1, 2, 5, 10. For (n+i)/(1−i), the exact real and imaginary components are (n−1)/2 and (n+1)/2.
Practical limit. Largest passing sample 1,000,000 (1.36 ms, 75.6 MiB peak process RSS). The runs did not locate a ceiling for this family. The exact components are rational. A zero complex denominator makes division undefined and large denominators increase intermediate bit lengths.
Measured times, memory and outcomes
real part of the numerator · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
1.02
74.5
2
Baseline
Passed
1.81
74.8
5
Baseline
Passed
0.615
75.2
10
Baseline
Passed
0.625
75.7
100
Stretch
Passed
0.838
74.7
1,000,000
Stretch
Passed
1.36
75.6
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Day 03 / 40 · Complex numbers and polynomial structure
Complex roots
Direct calculation@ratmath/algebraic · @ratmath/complex
Problem
Solve .
Worked solution
.
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as algebraic from "@ratmath/algebraic";
import * as complex from "@ratmath/complex";
console.log(algebraic.roots([13, 4, 1], { complex: true }).map((r) => r.value.toString()));
Checked output
["−2 + 3i", "−2 − 3i"]
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-variable polynomials of degree 2–5 and complex coefficients of small integer or rational size.
Focal example. The code above passed its displayed check in 3.51 ms on Node.
Related workload in this unit.algebraic.sqrt · integer scale k. Baseline test points across courses 1, 2, 7, 50. √(k²) has the nonnegative rational value k.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000 (0.266 ms, 74.3 MiB peak process RSS). The runs did not locate a ceiling for this family. This sweep uses perfect squares. Nonsquares involve algebraic representations and higher-degree combinations can cost substantially more.
Measured times, memory and outcomes
integer scale k · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.312
75.2
2
Baseline
Passed
0.275
75.7
7
Baseline
Passed
0.237
75.3
50
Baseline
Passed
0.238
74.1
10,000
Stretch
Passed
0.285
74.1
1,000,000
Stretch
Passed
0.266
74.3
Each row measures the stated fixture. 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.
algebraic.roots · 6 passing test cases, 7 distinct argument descriptions
Day 04 / 40 · Complex numbers and polynomial structure
Polynomial division
Direct calculation@ratmath/symbolic
Problem
Divide by .
Worked solution
Quotient , remainder 0.
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.simplify("(x^3 - 2x^2 - 5x + 6)/(x - 3)")));
Checked output
x^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-variable polynomials of degree 2–5 and complex coefficients of small integer or rational size.
Focal example. The code above passed its displayed check in 1.17 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 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-variable polynomials of degree 2–5 and complex coefficients of small integer or rational size.
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 4.56 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.factor · 1 passing test case, 4 distinct argument descriptions
Day 06 / 40 · Complex numbers and polynomial structure
Remainder theorem
Direct calculation@ratmath/symbolic
Problem
Find the remainder when is divided by .
Worked solution
.
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.sym("2x^4 - 3x^2 + x - 7").subs({ x: -2 }).simplify()));
Checked output
11
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One-variable polynomials of degree 2–5 and complex coefficients of small integer or rational size.
Focal example. The code above passed its displayed check in 0.331 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
Day 07 / 40 · Complex numbers and polynomial structure
Conjugate roots
Assisted@ratmath/symbolic
Problem
A real polynomial has a root 2+i. Which other root follows and what quadratic factor results?
Worked solution
Complex conjugation preserves a polynomial with real coefficients. Multiply (x−2−i)(x−2+i) to get x²−4x+5.
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.expand("(x-2)^2+1")));
Checked output
x^2 - 4*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-variable polynomials of degree 2–5 and complex coefficients of small integer or rational size.
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.138 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 08 / 40 · Complex numbers and polynomial structure
Difference of squares
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("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-variable polynomials of degree 2–5 and complex coefficients of small integer or rational size.
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
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("(x^2 - 9)/(x^2 + 5x + 6)")));
Checked output
(x - 3)/(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. Numerator and denominator degrees commonly 1–3, square roots and a few domain exclusions.
Focal example. The code above passed its displayed check in 0.708 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";
console.log(String(symbolic.together("2/(x - 1) + 3/(x + 1)")));
Checked output
(5*x - 1)/(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. Numerator and denominator degrees commonly 1–3, square roots and a few domain exclusions.
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 3.84 ms on Node.
Same API, measured input family.symbolic.together · pole separation parameter. Baseline test points across courses 1, 2, 3, 5. Combine 1/(x−n)+1/(x+n); at x=0, n+1 and −n−1 compare with 2x/(x²−n²). Exclude both original poles.
Practical limit. Largest passing sample 1,000 (9.92 ms, 75.6 MiB peak process RSS). The runs did not locate a ceiling for this family. Combining fractions can conceal holes at canceled factors. Keep the original exclusions even when the printed numerator and denominator simplify.
Measured times, memory and outcomes
pole separation parameter · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
3.07
76.4
2
Baseline
Passed
3.79
77.5
3
Baseline
Passed
3.26
75.4
5
Baseline
Passed
3.53
76.3
10
Stretch
Passed
6.88
76.9
50
Stretch
Passed
3.96
75
1,000
Stretch
Passed
9.92
75.6
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Day 11 / 40 · Rational and radical functions
Rational equation
Direct calculation@ratmath/symbolic
Problem
Solve .
Worked solution
, , or ; neither makes a denominator zero.
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("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. Numerator and denominator degrees commonly 1–3, square roots and a few domain exclusions.
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
Squaring: , or . Checking: gives , extraneous. Only .
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("sqrt(2x + 3) = x", "x")));
Checked output
x = 3
rejected x = -1: the two sides differ there by about 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. Numerator and denominator degrees commonly 1–3, square roots and a few domain exclusions.
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.49 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.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. Numerator and denominator degrees commonly 1–3, square roots and a few domain exclusions.
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
Direct calculation@ratmath/graphics · @ratmath/symbolic
Problem
Find the vertical and horizontal asymptotes of .
Worked solution
Vertical ; horizontal .
Using RatMath
Supply the expression, variable and approach point. At jumps and endpoints the direction of approach matters.
JavaScript module
import * as graphics from "@ratmath/graphics";
import * as symbolic from "@ratmath/symbolic";
console.log(
[graphics.findPoles("(2x^2 - 3)/(x^2 - 4)", {}, [-10, 10]).map((p) => p.at), symbolic.limit("(2x^2 - 3)/(x^2 - 4)", "x", "inf").value]
);
Checked output
[[-2, 2], 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. Numerator and denominator degrees commonly 1–3, square roots and a few domain exclusions.
For this problem type. Use one approach point or infinity, low-degree rational or elementary functions, and both directions when the domain permits.
Focal example. The code above passed its displayed check in 17.70 ms on Node.
Same API, measured input family.symbolic.limit · polynomial degree. Baseline test points across courses 1, 2, 3, 6. For n≥1, (x^n−1)/(x−1) tends to n at x=1.
Practical limit. Largest passing sample 128 (1,021 ms, 91.5 MiB peak process RSS). The first sampled passing call above one second used 128 (1,021 ms). The runs did not locate a ceiling for this family. Cancellation is valid on a punctured neighborhood. Left and right limits and branch choices still require checking in general.
Measured times, memory and outcomes
polynomial degree · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
9.66
76.6
2
Baseline
Passed
9.66
76.4
3
Baseline
Passed
10.35
77
6
Baseline
Passed
16.39
77.6
12
Stretch
Passed
16.71
78.7
32
Stretch
Passed
44.01
88.5
128
Stretch
Passed
1,021
91.5
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.limit · 4 passing test cases, 18 distinct argument descriptions
"1/x", "x", 0, undefined or "1/x", "x", 0, {side="right"} · one side and two
Day 15 / 40 · Rational and radical functions
A removable hole
Assisted@ratmath/symbolic
Problem
Is (x²−4)/(x−2) defined at 2 after cancellation?
Worked solution
The simplified rule is x+2 on the original domain x ≠ 2. The original quotient has a hole at (2,4).
Using RatMath
Supply the expression, variable and approach point. At jumps and endpoints the direction of approach matters.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.limit("(x^2-4)/(x-2)","x",2).value));
Checked output
4
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Numerator and denominator degrees commonly 1–3, square roots and a few domain exclusions.
For this problem type. Use one approach point or infinity, low-degree rational or elementary functions, and both directions when the domain permits.
Focal example. The code above passed its displayed check in 3.80 ms on Node.
Same API, measured input family.symbolic.limit · polynomial degree. Baseline test points across courses 1, 2, 3, 6. For n≥1, (x^n−1)/(x−1) tends to n at x=1.
Practical limit. Largest passing sample 128 (1,021 ms, 91.5 MiB peak process RSS). The first sampled passing call above one second used 128 (1,021 ms). The runs did not locate a ceiling for this family. Cancellation is valid on a punctured neighborhood. Left and right limits and branch choices still require checking in general.
Measured times, memory and outcomes
polynomial degree · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
9.66
76.6
2
Baseline
Passed
9.66
76.4
3
Baseline
Passed
10.35
77
6
Baseline
Passed
16.39
77.6
12
Stretch
Passed
16.71
78.7
32
Stretch
Passed
44.01
88.5
128
Stretch
Passed
1,021
91.5
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.limit · 4 passing test cases, 18 distinct argument descriptions
"1/x", "x", 0, undefined or "1/x", "x", 0, {side="right"} · one side and two
Day 16 / 40 · Rational and radical functions
End behaviour
Direct calculation@ratmath/core
Problem
What horizontal asymptote does (5x²+1)/(2x²−1) approach?
Worked solution
Divide by x² in numerator and denominator and let 1/x² tend to zero.
Using RatMath
Put the arithmetic inside the R tag so RatMath parses the literals. Keep fractions as ratios throughout the calculation and attach the units from the problem to the result.
JavaScript module
import { R } from "@ratmath/core";
console.log(String(R`5/2`));
Checked output
5/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. Numerator and denominator degrees commonly 1–3, square roots and a few domain exclusions.
Focal example. The code above passed its displayed check in 0.125 ms on Node.
Same arithmetic expression. Replaced its first numeral 5 with 0, 1, 2, 7, 12, 100, 1000, -3, 1/2. All 9 defined variants agreed exactly with Python’s rational arithmetic. This varies the arithmetic operation while holding the rest of the expression fixed.
Related workload in this unit.core.Rational.add · denominator. Baseline test points across courses 1, 2, 3, 12, 100, 1,000. Cross-multiply 1/n + 1/(n+1) against (2n+1)/(n(n+1)).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,007 (0.038 ms, 76.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Exact work depends on the bit lengths of both numerator and denominator. A long sum of relatively prime fractions can build a large common denominator.
Measured times, memory and outcomes
denominator · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.034
74.9
2
Baseline
Passed
0.036
75.6
3
Baseline
Passed
0.040
75.9
12
Baseline
Passed
0.039
75.2
100
Baseline
Passed
0.041
75
1,000
Baseline
Passed
0.035
75.8
1,000,003
Stretch
Passed
0.044
75
1,000,000,007
Stretch
Passed
0.038
76.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
Write the equation and name the variable to solve for. Check returned candidates against the original domain and any restrictions in the question.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.solve("3^(2x - 1) = 27", "x")));
Checked output
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 exponential or log equation with positive base other than one; growth over about 1–30 periods.
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.91 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.simplify("log(32)/log(2) + log(1/9)/log(3)")));
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. One exponential or log equation with positive base other than one; growth over about 1–30 periods.
Focal example. The code above passed its displayed check in 0.909 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
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("log(x)/log(3) + log(x - 8)/log(3) = 2", "x")));
Checked output
x = 9
rejected x = -1: a side of the equation is undefined there
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 exponential or log equation with positive base other than one; growth over about 1–30 periods.
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 30.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
$2000 is invested at 6% a year compounded monthly. What is it worth after 5 years, to the cent?
Worked solution
.
Using RatMath
Match the interest convention, cash-flow dates and number of periods to the question. Keep intermediate values at full precision and round money at the requested stage.
JavaScript module
import * as finance from "@ratmath/finance";
console.log(finance.compound(2000, "0.06", 5, { periodsPerYear: 12 }));
Checked output
2697.700305098632138692018344…
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 exponential or log equation with positive base other than one; growth over about 1–30 periods.
For this problem type. Use a few annual cash flows or 12–360 monthly periods, usually with moderate annual rates. Round monetary payments under the contract’s stated convention.
Focal example. The code above passed its displayed check in 0.444 ms on Node.
Same API, measured input family.finance.compound · annual periods. Baseline test points across courses 1, 5, 10, 30. At 5%, the balance on 100 is exactly 100·21^n/20^n.
Practical limit. Largest passing sample 10,000 (207 ms, 89.3 MiB peak process RSS). The first sampled passing call above 100 ms used 10,000 (207 ms). The runs did not locate a ceiling for this family. Fixed-period exact compounding raises rational factors to a power, increasing numerator and denominator lengths. Match rate units to periods.
Measured times, memory and outcomes
annual periods · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.433
75.2
5
Baseline
Passed
1.14
76
10
Baseline
Passed
0.565
75.8
30
Baseline
Passed
0.419
75.3
100
Stretch
Passed
0.468
75.6
500
Stretch
Passed
0.905
75.9
2,000
Stretch
Passed
5.59
78.5
10,000
Stretch
Passed
207
89.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.
finance.compound · 1 passing test case, 3 distinct argument descriptions
1000, "10%", 2 or 1000, "12%", 1, {periodsPerYear=12} · interest and rates
Day 21 / 40 · Exponentials and logarithms
Exponential growth
Direct calculation@ratmath/core
Problem
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. One exponential or log equation with positive base other than one; growth over about 1–30 periods.
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
Carbon-14 has a half-life of 5730 years. How old is a sample with 30% of its carbon-14 left, to the nearest year?
Worked solution
years.
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";
const PRINT = console.log;
const s = symbolic.solve("(1/2)^(t/5730) = 3/10", "t");
PRINT(s);
console.log(s.solutions[0].approx());
Checked output
9952.812854572361
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 exponential or log equation with positive base other than one; growth over about 1–30 periods.
For this problem type. Start with one unknown, small signed coefficients and degree one or two. Higher-degree or parameter-dependent equations need separate cases.
Focal example. The code above passed its displayed check in 16.76 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
Injectivity on positive inputs gives x−1 = 3. Check x = 4 satisfies the domain.
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+1`));
Checked output
4
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One exponential or log equation with positive base other than one; growth over about 1–30 periods.
Focal example. The code above passed its displayed check in 0.109 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
A culture doubles every 3 hours. What multiple of its initial size remains after 12 hours?
Worked solution
Twelve hours contain four doubling periods.
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^(12/3)`));
Checked output
16
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 exponential or log equation with positive base other than one; growth over about 1–30 periods.
Focal example. The code above passed its displayed check in 0.070 ms on Node.
Same arithmetic expression. Replaced its first numeral 2 with 0, 1, 2, 7, 12, 100, 1000, -3, 1/2. All 9 defined variants agreed exactly with Python’s rational arithmetic. This varies the arithmetic operation while holding the rest of the expression fixed.
Related workload in this unit.core.Rational.multiply · operand bits. Baseline test points across courses 8, 32, 64, 256. Cross-multiply the unreduced integer products; operands have unlike denominators.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 131,072 (1.53 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Intermediate products can have twice the bit length of their factors. Repeated squaring can exhaust the engine’s BigInt allocation limit in a small number of steps.
Measured times, memory and outcomes
operand bits · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
8
Baseline
Passed
0.317
74.6
32
Baseline
Passed
0.035
75.5
64
Baseline
Passed
0.045
75.1
256
Baseline
Passed
0.106
74
1,024
Stretch
Passed
0.035
75.3
8,192
Stretch
Passed
0.075
75.8
32,768
Stretch
Passed
0.245
75
131,072
Stretch
Passed
1.53
75.5
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
Adding the first and third: ; the second and third: . 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 symbolic from "@ratmath/symbolic";
console.log(
String(symbolic.solveSystem(["x + y + z = 6", "2x - y + z = 3", "x + 2y - z = 2"], ["x", "y", "z"]))
);
Checked output
x = 1, y = 2, z = 3
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Two or three unknowns and simple affine or quadratic changes of variable.
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.86 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("y = (2x + 3)/(x - 1)", "x")));
Checked output
x = (y + 3)/(y - 2)
provided y - 2 != 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. Two or three unknowns and simple affine or quadratic changes of variable.
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.02 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";
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. Two or three unknowns and simple affine or quadratic changes of variable.
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
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. Two or three unknowns and simple affine or quadratic changes of variable.
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
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.solveSystem(["3x + 2y = 16", "5x - 2y = 0"], ["x", "y"])));
Checked output
x = 2, y = 5
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Two or three unknowns and simple affine or quadratic changes of variable.
For this problem type. Linear systems in written exercises usually have two or three unknowns and as many equations. Include a dependent or inconsistent pair.
Focal example. The code above passed its displayed check in 1.52 ms on Node.
Related workload in this unit.linalg.solve.exact · unknowns. Baseline test points across courses 1, 2, 4, 8. For dense I+J and b=(n+1)·1 every component of x must be one.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 128 (64.25 ms, 90.7 MiB peak process RSS). The runs did not locate a ceiling for this family. Solving a nonsingular system checks one solution. Singular or inconsistent systems require rank and consistency checks. Large denominators increase exact cost.
Measured times, memory and outcomes
unknowns · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
22.32
75.6
2
Baseline
Passed
2.28
75.3
4
Baseline
Passed
7.02
75.1
8
Baseline
Passed
2.47
75.3
16
Stretch
Passed
4.34
77.1
32
Stretch
Passed
8.06
79.4
64
Stretch
Passed
63.87
89.9
128
Stretch
Passed
64.25
90.7
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.solveSystem · 4 passing test cases, 13 distinct argument descriptions
Find the vertex and opening direction of y = −2(x+3)² + 5.
Worked solution
The square vanishes at −3. Its negative coefficient makes (−3,5) the maximum.
Working without a calculator
Use the argument or construction in the worked solution. This lesson assigns the reasoning to the student.
Input range and limits
Typical inputs for this unit. Two or three unknowns and simple affine or quadratic changes of variable.
Scope of verification. This day asks for a hand argument, construction or interpretation. The worked instance gives the input. General claims need the reasoning shown above. A measured time, memory ceiling or finite input sweep would not verify that claim.
Day 31 / 40 · Systems and transformations
Inverse restrictions
Worked by hand
Problem
Why restrict x² to x ≥ 0 before naming √x as its inverse?
Worked solution
On the full real line both 2 and −2 map to 4. The restriction makes squaring one-to-one and selects the nonnegative root.
Working without a calculator
Use the argument or construction in the worked solution. This lesson assigns the reasoning to the student.
Input range and limits
Typical inputs for this unit. Two or three unknowns and simple affine or quadratic changes of variable.
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 32 / 40 · Systems and transformations
Elimination by addition
Direct calculation@ratmath/linalg
Problem
Solve x+y = 7 and x−y = 1.
Worked solution
Add the equations for 2x = 8 and substitute back to obtain (4,3).
Using RatMath
Enter the matrix one row at a time, preserving the order of the unknowns. Use the result with the original matrix to check the required relation.
JavaScript module
import * as linalg from "@ratmath/linalg";
console.log(linalg.solve([[1,1],[1,-1]],[7,1]).exact().x.toStrings().flat().join(", "));
Checked output
4, 3
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Two or three unknowns and simple affine or quadratic changes of variable.
For this problem type. Hand calculations usually use 2–5 rows and columns with small integer or rational entries. Include deficient rank as a separate case.
Focal example. The code above passed its displayed check in 1.63 ms on Node.
Same API, measured input family.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. 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. 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.
linalg.solve · 8 passing test cases, 10 distinct argument descriptions
Matrix, [[-8] (n=1), [-6] (n=1), [6] (n=1), [6] (n=1), …] (64×1) · large systems use it
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.sum("4k + 1", "k", 1, 30).value));
Checked output
1890
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. Binomial exponents around 2–12, sums of tens of terms and infinite geometric series with |r|<1.
Focal example. The code above passed its displayed check in 9.00 ms on Node.
Related workload in this unit.core.range · terms. Baseline test points across courses 1, 10, 100, 1,000. Check length and every consecutive integer from 1 through n.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000 (141 ms, 277.5 MiB peak process RSS). The first sampled passing call above 100 ms used 1,000,000 (141 ms). The runs did not locate a ceiling for this family. Keeping the entire result requires storage proportional to its length. Shortening the displayed list after construction still pays that cost.
Measured times, memory and outcomes
terms · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.173
75.5
10
Baseline
Passed
0.192
74.9
100
Baseline
Passed
0.269
74.7
1,000
Baseline
Passed
1.52
75.6
10,000
Stretch
Passed
5.29
80.9
100,000
Stretch
Passed
11.57
109.6
1,000,000
Stretch
Passed
141
277.5
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.sum · 4 passing test cases, 14 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.sum("12*(1/3)^k", "k", 0, "inf").value));
Checked output
18
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Binomial exponents around 2–12, sums of tens of terms and infinite geometric series with |r|<1.
Focal example. The code above passed its displayed check in 15.56 ms on Node.
Related workload in this unit.core.range · terms. Baseline test points across courses 1, 10, 100, 1,000. Check length and every consecutive integer from 1 through n.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000 (141 ms, 277.5 MiB peak process RSS). The first sampled passing call above 100 ms used 1,000,000 (141 ms). The runs did not locate a ceiling for this family. Keeping the entire result requires storage proportional to its length. Shortening the displayed list after construction still pays that cost.
Measured times, memory and outcomes
terms · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.173
75.5
10
Baseline
Passed
0.192
74.9
100
Baseline
Passed
0.269
74.7
1,000
Baseline
Passed
1.52
75.6
10,000
Stretch
Passed
5.29
80.9
100,000
Stretch
Passed
11.57
109.6
1,000,000
Stretch
Passed
141
277.5
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.sum · 4 passing test cases, 14 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 - 1)^5")));
Checked output
32*x^5 - 80*x^4 + 80*x^3 - 40*x^2 + 10*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. Binomial exponents around 2–12, sums of tens of terms and infinite geometric series with |r|<1.
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.182 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 36 / 40 · Sequences and the binomial theorem
Arithmetic sequence
Direct calculation@ratmath/core
Problem
Find the 50th term of
Worked solution
.
Using RatMath
Put the arithmetic inside the R tag so RatMath parses the literals. Keep fractions as ratios throughout the calculation and attach the units from the problem to the result.
JavaScript module
import { R } from "@ratmath/core";
console.log(String(R`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. Binomial exponents around 2–12, sums of tens of terms and infinite geometric series with |r|<1.
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
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, sum } from "@ratmath/core";
console.log(String(sum(1, 10, (k) => R`2*${k} - 1`)));
Checked output
100
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. Binomial exponents around 2–12, sums of tens of terms and infinite geometric series with |r|<1.
Focal example. The code above passed its displayed check in 0.472 ms on Node.
Related workload in this unit.core.range · terms. Baseline test points across courses 1, 10, 100, 1,000. Check length and every consecutive integer from 1 through n.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000 (141 ms, 277.5 MiB peak process RSS). The first sampled passing call above 100 ms used 1,000,000 (141 ms). The runs did not locate a ceiling for this family. Keeping the entire result requires storage proportional to its length. Shortening the displayed list after construction still pays that cost.
Measured times, memory and outcomes
terms · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.173
75.5
10
Baseline
Passed
0.192
74.9
100
Baseline
Passed
0.269
74.7
1,000
Baseline
Passed
1.52
75.6
10,000
Stretch
Passed
5.29
80.9
100,000
Stretch
Passed
11.57
109.6
1,000,000
Stretch
Passed
141
277.5
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
How many lattice paths go from to with unit steps right and up?
Worked solution
Choose which 3 of the 7 steps go up: .
Using RatMath
Decide what counts as one outcome and whether order matters. Supply the sizes to the counting function and keep the returned whole number exact.
JavaScript module
import * as discrete from "@ratmath/discrete";
console.log(discrete.binomial(7, 3));
Checked output
35n
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. Binomial exponents around 2–12, sums of tens of terms and infinite geometric series with |r|<1.
For this problem type. Use about 3–20 labeled objects in hand examples. Counts can describe sets far too large to list. Enumeration exercises generally use fewer than ten objects.
Focal example. The code above passed its displayed check in 0.109 ms on Node.
Same API, measured input family.discrete.binomial · objects. Baseline test points across courses 2, 5, 10, 52. Check k!(n−k)!·C(n,k)=n! for k=floor(n/2).
Practical limit. Largest passing sample 10,000 (8.36 ms, 88 MiB peak process RSS). The runs did not locate a ceiling for this family. Coefficient bit length grows with n and k. Counting is far cheaper than actually listing all k-subsets.
Measured times, memory and outcomes
objects · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
2
Baseline
Passed
0.144
74.7
5
Baseline
Passed
0.151
73.9
10
Baseline
Passed
0.142
75.1
52
Baseline
Passed
0.141
75.9
100
Stretch
Passed
0.128
75
500
Stretch
Passed
0.171
76
2,000
Stretch
Passed
0.526
78.6
10,000
Stretch
Passed
8.36
88
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.
discrete.binomial · 1 passing test case, 6 distinct argument descriptions
Choose three of five factors to supply 2x and multiply by 2³.
Using RatMath
Decide what counts as one outcome and whether order matters. Supply the sizes to the counting function and keep the returned whole number exact.
JavaScript module
import * as discrete from "@ratmath/discrete";
console.log(discrete.binomial(5,3)*8n);
Checked output
80n
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. Binomial exponents around 2–12, sums of tens of terms and infinite geometric series with |r|<1.
For this problem type. Use about 3–20 labeled objects in hand examples. Counts can describe sets far too large to list. Enumeration exercises generally use fewer than ten objects.
Focal example. The code above passed its displayed check in 0.060 ms on Node.
Same API, measured input family.discrete.binomial · objects. Baseline test points across courses 2, 5, 10, 52. Check k!(n−k)!·C(n,k)=n! for k=floor(n/2).
Practical limit. Largest passing sample 10,000 (8.36 ms, 88 MiB peak process RSS). The runs did not locate a ceiling for this family. Coefficient bit length grows with n and k. Counting is far cheaper than actually listing all k-subsets.
Measured times, memory and outcomes
objects · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
2
Baseline
Passed
0.144
74.7
5
Baseline
Passed
0.151
73.9
10
Baseline
Passed
0.142
75.1
52
Baseline
Passed
0.141
75.9
100
Stretch
Passed
0.128
75
500
Stretch
Passed
0.171
76
2,000
Stretch
Passed
0.526
78.6
10,000
Stretch
Passed
8.36
88
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.
discrete.binomial · 1 passing test case, 6 distinct argument descriptions
Does 1 − 1 + 1 − 1 + … converge in the ordinary sense?
Worked solution
Its partial sums alternate between 1 and 0. They have no single limit.
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. Binomial exponents around 2–12, sums of tens of terms and infinite geometric series with |r|<1.
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.