36 of 40 focal problems use RatMath for a calculation or a substantive step.
Direct calculation
35 · 87.5%
Assisted
1 · 2.5%
Worked by hand
4 · 10%
Using the packages
Angle units and principal branches determine which answers mean what the course expects. Keep exact unit-circle values until the problem requests a decimal.
Calculator interface
Place a unit circle beside the graph, with turns, radians and degrees sharing a cursor. Let learners specify an interval before solving a periodic equation and inspect a parametric curve's direction.
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
36 of 40 days include a checked executable example. On 14 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 · Circular functions. Familiar angles in one or two turns, denominators 2, 3, 4 or 6 of π and a specified branch for inverse functions.
Unit benchmark · algebraic.sqrt, integer scale k. Largest passing sample 1,000,000 (0.266 ms, 74.3 MiB peak process RSS). The runs did not locate a ceiling for this family.
Days 9–16 · Graphs and vectors. Two- or three-component vectors and a handful of points, with radii and scale factors usually under 50.
Unit benchmark · geo.midpoint, absolute coordinate. Largest passing sample 1,000,000,000 (0.175 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family.
Days 17–24 · Algebraic and exponential models. Polynomials of degree 2–5, simple rational functions and one exponential or logarithm at a time.
Unit benchmark · symbolic.expand, degree. Largest passing sample 128 (47.68 ms, 96.3 MiB peak process RSS). The runs did not locate a ceiling for this family.
Days 25–32 · Conics and parametric curves. One conic or one two-component parametrization with a bounded parameter interval.
Unit benchmark · analytic.curve.length, parameter interval end. Largest passing sample 10,000 (3.10 ms, 76.2 MiB peak process RSS). The runs did not locate a ceiling for this family.
Days 33–40 · Sequences and limits. A short recurrence, a finite sum of tens of terms or a single limit of elementary functions.
Unit benchmark · symbolic.limit, polynomial degree. 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.
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(["sin(5pi/6)", "cos(7pi/4)", "tan(2pi/3)"].map((e) => symbolic.simplify(e)));
Checked output
[1/2, sqrt(2)/2, -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. Familiar angles in one or two turns, denominators 2, 3, 4 or 6 of π and a specified branch for inverse functions.
Focal example. The code above passed its displayed check in 1.51 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.simplify("225*pi/180")));
Checked output
5*pi/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. Familiar angles in one or two turns, denominators 2, 3, 4 or 6 of π and a specified branch for inverse functions.
Focal example. The code above passed its displayed check in 0.670 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(symbolic.solve("2cos(x)^2 - cos(x) - 1 = 0", "x").within("[0, 2*pi)").map(String));
Checked output
["0", "2*pi/3", "4*pi/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. Familiar angles in one or two turns, denominators 2, 3, 4 or 6 of π and a specified branch for inverse functions.
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 62.03 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
State the domain restriction sin(2x) ≠ 0 before canceling a common factor.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.equal("(1 - cos(2x))/sin(2x)", "tan(x)")));
Checked output
equal (normal form, after the rules the assumptions allow)
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. Familiar angles in one or two turns, denominators 2, 3, 4 or 6 of π and a specified branch for inverse functions.
Focal example. The code above passed its displayed check in 5.25 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.equal · 8 passing test cases, 28 distinct argument descriptions
{type="op", op="-", args=[Object, Object] (n=2)}, "x*exp(x)", {assume={x="x > 1"}} or {type="op", op="+", args=[Object, Object] (n=2)}, "1/(x^2+1)^2", {assume={x="x > 1"}} · every result differentiates back to the integrand
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("sin(5pi/12)")));
Checked output
sqrt(6)/4 + sqrt(2)/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. Familiar angles in one or two turns, denominators 2, 3, 4 or 6 of π and a specified branch for inverse functions.
Focal example. The code above passed its displayed check in 1.19 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([symbolic.simplify("asin(-sqrt(3)/2)"), symbolic.simplify("cos(atan(3/4))")]);
Checked output
[-pi/3, 4/5]
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Familiar angles in one or two turns, denominators 2, 3, 4 or 6 of π and a specified branch for inverse functions.
Focal example. The code above passed its displayed check in 3.99 ms on Node.
Related workload in this unit.symbolic.expand · degree. Baseline test points across courses 1, 2, 4, 8. Sum the expanded coefficients at x=1 by direct substitution; result 2^n. Also check at x=0 and 2.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 128 (47.68 ms, 96.3 MiB peak process RSS). The runs did not locate a ceiling for this family. A univariate binomial has n+1 terms. With several variables the number of monomials can grow combinatorially even at modest degree.
Measured times, memory and outcomes
degree · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
26.10
75.9
2
Baseline
Passed
3.05
75.5
4
Baseline
Passed
2.75
77.3
8
Baseline
Passed
4.23
79.5
16
Stretch
Passed
5.88
82.6
32
Stretch
Passed
6.12
87.9
64
Stretch
Passed
15.73
89.5
128
Stretch
Passed
47.68
96.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.simplify · 2 passing test cases, 11 distinct argument descriptions
Find the least nonnegative angle coterminal with −510°.
Worked solution
Add two full revolutions to enter [0,360).
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`-510+2*360`));
Checked output
210
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. Familiar angles in one or two turns, denominators 2, 3, 4 or 6 of π and a specified branch for inverse functions.
Focal example. The code above passed its displayed check in 0.109 ms on Node.
Same arithmetic expression. Replaced its first numeral 510 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
In a right triangle, an acute angle is and its adjacent leg is 12. Find the opposite leg to two decimal places.
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(symbolic.evaluate(symbolic.parse("12*tan(35*pi/180)")));
Checked output
8.40249045851651735249:8.4024904585165173538
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. Familiar angles in one or two turns, denominators 2, 3, 4 or 6 of π and a specified branch for inverse functions.
Focal example. The code above passed its displayed check in 3.33 ms on Node.
Same API, measured input family.symbolic.evaluate / symbolic.parse · scalar multiplier. Baseline test points across courses 1, 2, 10, 100. At π/6, n sin(π/6)=n/2. Check inclusion or double agreement.
Practical limit. Largest passing sample 1,000,000 (6.79 ms, 75.2 MiB peak process RSS). The runs did not locate a ceiling for this family. Angle units and distance to poles matter more than multiplier size. Use enclosures when cancellation or a near-zero denominator affects the answer.
Measured times, memory and outcomes
scalar multiplier · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
2.28
75.9
2
Baseline
Passed
2.46
76.7
10
Baseline
Passed
2.30
76.1
100
Baseline
Passed
2.26
75.9
1,000
Stretch
Passed
4.48
76.4
1,000,000
Stretch
Passed
6.79
75.2
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 09 / 40 · Graphs and vectors
Sinusoids
Direct calculation@ratmath/symbolic
Problem
Give the amplitude, period, phase shift and midline of .
Worked solution
Amplitude 3, period , phase shift to the right, midline .
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";
const s = symbolic.sinusoid("3sin(2x - pi/2) + 1");
console.log([s.amplitude, s.period, s.phaseShift, s.midline].map(String));
Checked output
["3", "pi", "pi/4", "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-component vectors and a handful of points, with radii and scale factors usually under 50.
Focal example. The code above passed its displayed check in 4.53 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.sinusoid · 3 passing test cases, 5 distinct argument descriptions
Convert the polar point to rectangular coordinates.
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([symbolic.simplify("4cos(5pi/6)"), symbolic.simplify("4sin(5pi/6)")]);
Checked output
[-2*sqrt(3), 2]
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Two- or three-component vectors and a handful of points, with radii and scale factors usually under 50.
Focal example. The code above passed its displayed check in 0.885 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 complex from "@ratmath/complex";
console.log(String(complex.complex(1, 1).pow(8)));
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. Two- or three-component vectors and a handful of points, with radii and scale factors usually under 50.
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.153 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
Direct calculation@ratmath/symbolic · @ratmath/geo
Problem
For and , find , and the angle between them to 0.01°.
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";
import * as geo from "@ratmath/geo";
const u = [3, -4], v = [2, 1];
console.log(
[geo.distance([0, 0], u), geo.dot(geo.point(...u), geo.point(...v)), symbolic.evaluate(symbolic.parse("acos(2/(5*sqrt(5)))*180/pi"))]
);
Checked output
[5, 2, 79.6951535312339680[4793:5835]]
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-component vectors and a handful of points, with radii and scale factors usually under 50.
Focal example. The code above passed its displayed check in 2.73 ms on Node.
Same API, measured input family.symbolic.evaluate / symbolic.parse · scalar multiplier. Baseline test points across courses 1, 2, 10, 100. At π/6, n sin(π/6)=n/2. Check inclusion or double agreement.
Practical limit. Largest passing sample 1,000,000 (6.79 ms, 75.2 MiB peak process RSS). The runs did not locate a ceiling for this family. Angle units and distance to poles matter more than multiplier size. Use enclosures when cancellation or a near-zero denominator affects the answer.
Measured times, memory and outcomes
scalar multiplier · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
2.28
75.9
2
Baseline
Passed
2.46
76.7
10
Baseline
Passed
2.30
76.1
100
Baseline
Passed
2.26
75.9
1,000
Stretch
Passed
4.48
76.4
1,000,000
Stretch
Passed
6.79
75.2
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
geo.distance · 3 passing test cases, 2 distinct argument descriptions
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as 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. Two- or three-component vectors and a handful of points, with radii and scale factors usually under 50.
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
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as geo from "@ratmath/geo";
console.log(String(geo.rotation([0, 0], "1/4").apply([4, 1])));
Checked output
(-1, 4)
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Two- or three-component vectors and a handful of points, with radii and scale factors usually under 50.
Focal example. The code above passed its displayed check in 0.202 ms on Node.
Related workload in this unit.geo.midpoint · absolute coordinate. Baseline test points across courses 0, 1, 10, 100. Midpoint of (−k,0) and (k,2k) equals (0,k).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,000 (0.175 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Coordinate size and dimension affect exact distance and dot products. Floating geometry near coincidence can lose significant digits.
Measured times, memory and outcomes
absolute coordinate · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
0
Baseline
Passed
0.193
74.9
1
Baseline
Passed
0.197
75.2
10
Baseline
Passed
0.151
75.4
100
Baseline
Passed
0.169
75.6
1,000,000
Stretch
Passed
0.298
76.3
1,000,000,000
Stretch
Passed
0.175
75.5
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
geo.rotation · 2 passing test cases, 5 distinct argument descriptions
A wheel of radius 3 m spins through 2 radians per second. What is its rim speed?
Worked solution
Linear speed equals radius times angular speed in radians per second.
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*2`));
Checked output
6
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Two- or three-component vectors and a handful of points, with radii and scale factors usually under 50.
Focal example. The code above passed its displayed check in 0.098 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 displacement is 3 units east and 4 north. What is its length?
Worked solution
The components are perpendicular.
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as algebraic from "@ratmath/algebraic";
console.log(String(algebraic.sqrt(3*3+4*4).toRational()));
Checked output
5
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Two- or three-component vectors and a handful of points, with radii and scale factors usually under 50.
Focal example. The code above passed its displayed check in 0.135 ms on Node.
Same API, measured input family.algebraic.sqrt · integer scale k. Baseline test points across courses 1, 2, 7, 50. √(k²) has the nonnegative rational value k.
Practical limit. Largest passing sample 1,000,000 (0.266 ms, 74.3 MiB peak process RSS). The runs did not locate a ceiling for this family. This sweep uses perfect squares. Nonsquares involve algebraic representations and higher-degree combinations can cost substantially more.
Measured times, memory and outcomes
integer scale k · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.312
75.2
2
Baseline
Passed
0.275
75.7
7
Baseline
Passed
0.237
75.3
50
Baseline
Passed
0.238
74.1
10,000
Stretch
Passed
0.285
74.1
1,000,000
Stretch
Passed
0.266
74.3
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
algebraic.sqrt · 17 passing test cases, 8 distinct argument descriptions
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. Polynomials of degree 2–5, simple rational functions and one exponential or logarithm at a time.
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 18 / 40 · Algebraic and exponential models
Zeros of a polynomial
Direct calculation@ratmath/symbolic
Problem
Find all zeros of .
Worked solution
: .
Using RatMath
Write the equation and name the variable to solve for. Check returned candidates against the original domain and any restrictions in the question.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.solve("x^4 - 5x^2 + 4 = 0", "x")));
Checked output
x = -2, -1, 1, 2
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Polynomials of degree 2–5, simple rational functions and one exponential or logarithm at a time.
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.55 ms on Node.
Same API, measured input family.symbolic.solve · absolute coefficient. Baseline test points across courses 1, 2, 10, 100. Solve n·x+1=3n+1; the unique root is 3.
Practical limit. Largest passing sample 1,000,000,000 (6.48 ms, 75.9 MiB peak process RSS). The runs did not locate a ceiling for this family. One linear unknown has a simple root here. A vanishing coefficient may produce no solution or infinitely many. Multiple parameters require case analysis.
Measured times, memory and outcomes
absolute coefficient · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
16.76
75.8
2
Baseline
Passed
7.72
74.9
10
Baseline
Passed
29.10
75.2
100
Baseline
Passed
12.79
74.6
10,000
Stretch
Passed
28.50
76.3
1,000,000,000
Stretch
Passed
6.48
75.9
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.solve · 21 passing test cases, 71 distinct argument descriptions
Write the equation and name the variable to solve for. Check returned candidates against the original domain and any restrictions in the question.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.solve("log(x)/log(10) + log(x - 3)/log(10) = 1", "x")));
Checked output
x = 5
rejected x = -2: 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. Polynomials of degree 2–5, simple rational functions and one exponential or logarithm at a time.
For this problem type. Start with one unknown, small signed coefficients and degree one or two. Higher-degree or parameter-dependent equations need separate cases.
Focal example. The code above passed its displayed check in 8.73 ms on Node.
Same API, measured input family.symbolic.solve · absolute coefficient. Baseline test points across courses 1, 2, 10, 100. Solve n·x+1=3n+1; the unique root is 3.
Practical limit. Largest passing sample 1,000,000,000 (6.48 ms, 75.9 MiB peak process RSS). The runs did not locate a ceiling for this family. One linear unknown has a simple root here. A vanishing coefficient may produce no solution or infinitely many. Multiple parameters require case analysis.
Measured times, memory and outcomes
absolute coefficient · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
16.76
75.8
2
Baseline
Passed
7.72
74.9
10
Baseline
Passed
29.10
75.2
100
Baseline
Passed
12.79
74.6
10,000
Stretch
Passed
28.50
76.3
1,000,000,000
Stretch
Passed
6.48
75.9
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.solve · 21 passing test cases, 71 distinct argument descriptions
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. Polynomials of degree 2–5, simple rational functions and one exponential or logarithm at a time.
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
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. Polynomials of degree 2–5, simple rational functions and one exponential or logarithm at a time.
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
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. Polynomials of degree 2–5, simple rational functions and one exponential or logarithm at a time.
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
Does every denominator zero create a vertical asymptote?
Worked solution
No. The factor at x=1 in (x²−1)/(x−1) cancels. The graph approaches 2 there.
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. Polynomials of degree 2–5, simple rational functions and one exponential or logarithm at a time.
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 24 / 40 · Algebraic and exponential models
Log scales
Direct calculation@ratmath/core
Problem
On a base-ten logarithmic axis, what factor separates readings 2 and 5?
Worked solution
Divide 10⁵ by 10².
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`10^(5-2)`));
Checked output
1000
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. Polynomials of degree 2–5, simple rational functions and one exponential or logarithm at a time.
Focal example. The code above passed its displayed check in 0.151 ms on Node.
Same arithmetic expression. Replaced its first numeral 10 with 0, 1, 2, 7, 12, 100, 1000, -3, 1/2. All 9 defined variants agreed exactly with Python’s rational arithmetic. This varies the arithmetic operation while holding the rest of the expression fixed.
Related workload in this unit.core.Rational.multiply · operand bits. Baseline test points across courses 8, 32, 64, 256. Cross-multiply the unreduced integer products; operands have unlike denominators.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 131,072 (1.53 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Intermediate products can have twice the bit length of their factors. Repeated squaring can exhaust the engine’s BigInt allocation limit in a small number of steps.
Measured times, memory and outcomes
operand bits · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
8
Baseline
Passed
0.317
74.6
32
Baseline
Passed
0.035
75.5
64
Baseline
Passed
0.045
75.1
256
Baseline
Passed
0.106
74
1,024
Stretch
Passed
0.035
75.3
8,192
Stretch
Passed
0.075
75.8
32,768
Stretch
Passed
0.245
75
131,072
Stretch
Passed
1.53
75.5
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as geo from "@ratmath/geo";
const p = geo.conicProperties("x^2/25 + y^2/9 = 1");
console.log([p.vertices.map(String), p.foci.map(String)]);
Checked output
[["(5, 0)", "(-5, 0)"], ["(4, 0)", "(-4, 0)"]]
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One conic or one two-component parametrization with a bounded parameter interval.
Focal example. The code above passed its displayed check in 0.793 ms on Node.
Related workload in this unit.analytic.curve.length · parameter interval end. Baseline test points across courses 1, 2, 5, 10. The straight curve (3t,4t) from 0 to n has length 5n.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 10,000 (3.10 ms, 76.2 MiB peak process RSS). The runs did not locate a ceiling for this family. Smooth straight-line speed is constant here. Near a cusp or a zero of speed, curvature can be undefined and length integration harder.
Measured times, memory and outcomes
parameter interval end · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
2.87
75.7
2
Baseline
Passed
2.89
75.5
5
Baseline
Passed
2.81
75.3
10
Baseline
Passed
2.85
76.1
100
Stretch
Passed
2.93
75.3
1,000
Stretch
Passed
3.16
75.2
10,000
Stretch
Passed
3.10
76.2
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
geo.conicProperties · 8 passing test cases, 17 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 conic or one two-component parametrization with a bounded parameter interval.
Focal example. The code above passed its displayed check in 0.305 ms on Node.
Related workload in this unit.analytic.curve.length · parameter interval end. Baseline test points across courses 1, 2, 5, 10. The straight curve (3t,4t) from 0 to n has length 5n.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 10,000 (3.10 ms, 76.2 MiB peak process RSS). The runs did not locate a ceiling for this family. Smooth straight-line speed is constant here. Near a cusp or a zero of speed, curvature can be undefined and length integration harder.
Measured times, memory and outcomes
parameter interval end · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
2.87
75.7
2
Baseline
Passed
2.89
75.5
5
Baseline
Passed
2.81
75.3
10
Baseline
Passed
2.85
76.1
100
Stretch
Passed
2.93
75.3
1,000
Stretch
Passed
3.16
75.2
10,000
Stretch
Passed
3.10
76.2
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
geo.conicProperties · 8 passing test cases, 17 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 conic or one two-component parametrization with a bounded parameter interval.
Focal example. The code above passed its displayed check in 5.55 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.eliminate · 7 passing test cases, 15 distinct argument descriptions
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(String(linalg.inverse([[2, 1], [5, 3]]).exact()));
Checked output
[3, -1]
[-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. One conic or one two-component parametrization with a bounded parameter interval.
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 0.619 ms on Node.
Related workload in this unit.linalg.rref.exact · matrix side. Baseline test points across courses 1, 2, 4, 8. A lower triangular square matrix with diagonal 1 is invertible and reduces to the identity.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 128 (119 ms, 92.8 MiB peak process RSS). The first sampled passing call above 100 ms used 128 (119 ms). The runs did not locate a ceiling for this family. Exact elimination preserves pivots. Input dimensions, rank and the size of intermediate fractions affect memory and time.
Measured times, memory and outcomes
matrix side · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.937
76.1
2
Baseline
Passed
0.800
75.3
4
Baseline
Passed
1.05
75.4
8
Baseline
Passed
2.45
74.4
16
Stretch
Passed
3.07
75.6
32
Stretch
Passed
8.82
78.7
64
Stretch
Passed
19.67
89.3
128
Stretch
Passed
119
92.8
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
linalg.inverse · 2 passing test cases, 2 distinct argument descriptions
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as geo from "@ratmath/geo";
const c = geo.circleFromEquation("x^2 + y^2 - 6x + 4y - 12 = 0");
console.log([String(c.center), c.radius]);
Checked output
["(3, -2)", 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 conic or one two-component parametrization with a bounded parameter interval.
Focal example. The code above passed its displayed check in 1.74 ms on Node.
Related workload in this unit.geo.midpoint · absolute coordinate. Baseline test points across courses 0, 1, 10, 100. Midpoint of (−k,0) and (k,2k) equals (0,k).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,000 (0.175 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Coordinate size and dimension affect exact distance and dot products. Floating geometry near coincidence can lose significant digits.
Measured times, memory and outcomes
absolute coordinate · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
0
Baseline
Passed
0.193
74.9
1
Baseline
Passed
0.197
75.2
10
Baseline
Passed
0.151
75.4
100
Baseline
Passed
0.169
75.6
1,000,000
Stretch
Passed
0.298
76.3
1,000,000,000
Stretch
Passed
0.175
75.5
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
geo.circleFromEquation · 2 passing test cases, 4 distinct argument descriptions
Describe the set equidistant from (0,1) and the line y = −1.
Worked solution
Equate squared distances x²+(y−1)² = (y+1)² to obtain y=x²/4.
Working without a calculator
Use the argument or construction in the worked solution. This lesson assigns the reasoning to the student.
Input range and limits
Typical inputs for this unit. One conic or one two-component parametrization with a bounded parameter interval.
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 · Conics and parametric curves
Tracing direction
Worked by hand
Problem
The curve (cos t, sin t) starts at (1,0). Which way does it travel as t increases from zero?
Worked solution
The initial velocity is (0,1), so the path moves counterclockwise.
Working without a calculator
Use the argument or construction in the worked solution. This lesson assigns the reasoning to the student.
Input range and limits
Typical inputs for this unit. One conic or one two-component parametrization with a bounded parameter interval.
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 · Conics and parametric curves
Composition
Direct calculation@ratmath/symbolic
Problem
For and , find and .
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";
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. One conic or one two-component parametrization with a bounded parameter interval.
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
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. A short recurrence, a finite sum of tens of terms or a single limit of elementary functions.
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
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 - 9)/(x - 3)", "x", 3).value));
Checked output
6
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. A short recurrence, a finite sum of tens of terms or a single limit of elementary functions.
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 1.45 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 35 / 40 · Sequences and limits
Arithmetic series
Direct calculation@ratmath/symbolic
Problem
Find the sum of the first 30 terms of .
Worked solution
; .
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as symbolic from "@ratmath/symbolic";
console.log(String(symbolic.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. A short recurrence, a finite sum of tens of terms or a single limit of elementary functions.
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. A short recurrence, a finite sum of tens of terms or a single limit of elementary functions.
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
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("(3x^2 - x)/(5x^2 + 2)", "x", "inf").value));
Checked output
3/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. A short recurrence, a finite sum of tens of terms or a single limit of elementary functions.
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 1.26 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 38 / 40 · Sequences and limits
Average rate of change
Direct calculation@ratmath/core
Problem
Find the average change per unit x of x² on [2,5].
Worked solution
Use the secant slope, subtracting outputs and dividing by the input change.
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-2^2)/(5-2)`));
Checked output
7
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. A short recurrence, a finite sum of tens of terms or a single limit of elementary functions.
For this problem type. Use a few coin denominations or one transaction, usually with two decimal places and totals small enough to count by hand.
Focal example. The code above passed its displayed check in 4.18 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.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
For x<1 let f(x)=2x and for x≥1 let f(x)=k. Which k joins the pieces continuously?
Worked solution
Match the left limit 2 to the right-hand value k.
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*1`));
Checked output
2
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. A short recurrence, a finite sum of tens of terms or a single limit of elementary functions.
Focal example. The code above passed its displayed check in 0.094 ms on Node.
Same arithmetic expression. Replaced its first numeral 2 with 0, 1, 2, 7, 12, 100, 1000, -3, 1/2. All 9 defined variants agreed exactly with Python’s rational arithmetic. This varies the arithmetic operation while holding the rest of the expression fixed.
Related workload in this unit.core.R · whole-number operand. Baseline test points across courses 0, 1, 10, 20, 100, 1,000, 1,000,000. (n+7)(n−3) by independent BigInt arithmetic.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 9,007,199,254,740,991 (1.67 ms, 75.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Exact integer arithmetic grows with operand bit length. Enter large integers as decimal strings or BigInts before any JavaScript Number conversion.
Measured times, memory and outcomes
whole-number operand · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
0
Baseline
Passed
1.75
75
1
Baseline
Passed
1.70
75.7
10
Baseline
Passed
1.78
75.1
20
Baseline
Passed
1.88
75.4
100
Baseline
Passed
1.55
75.4
1,000
Baseline
Passed
1.36
75.3
1,000,000
Baseline
Passed
1.39
74.8
1,000,000,000
Stretch
Passed
1.69
76.3
9,007,199,254,740,991
Stretch
Passed
1.67
75.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
Its principal value lies in [0,π]. The angle with cosine 1/2 in that interval is π/3.
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. A short recurrence, a finite sum of tens of terms or a single limit of elementary functions.
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.