35 of 40 focal problems use RatMath for a calculation or a substantive step.
Direct calculation
32 · 80%
Assisted
3 · 7.5%
Worked by hand
5 · 12.5%
Using the packages
Exact matrices make pivots, null spaces and repeated eigenvalues dependable worked examples. Students still need to specify the field, distinguish vectors from coordinates and interpret inconsistent systems.
Calculator interface
Use a row-operation ledger with undo and fraction display. Provide tabs for exact solution, residual, null space and the numerical preview, with labels for basis and coefficient field.
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
35 of 40 days include a checked executable example. On 10 days the measured size sweep exercises a named API used in the lesson. Each day identifies its tested inputs and the mathematical property checked. Hand-worked days give the input scale and the argument to verify.
Ranges across the five units
Days 1–8 · Equations and pivots. About two to six equations or unknowns by hand, and up to about ten in small exact computational examples.
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 9–16 · Linear maps. Linear maps on dimensions 2–6, usually integer or small rational entries; include singular as well as invertible maps.
Unit benchmark · linalg.det.exact, square matrix side. Largest passing sample 200 (383 ms, 131.8 MiB peak process RSS). The first sampled passing call above 100 ms used 200 (383 ms). The runs did not locate a ceiling for this family.
Days 17–24 · Eigenstructure. Eigenvalues and Jordan forms mainly for 2×2 to 4×4 matrices. Repeated roots can matter more than the matrix side.
Unit benchmark · linalg.eigenvalues.exact, matrix side. Largest passing sample 18 (18.30 ms, 87.1 MiB peak process RSS). The runs did not locate a ceiling for this family.
Days 25–32 · Inner products. Two to six basis vectors, simple exact inner products, or tens of observations with two to four fitted coefficients.
Unit benchmark · linalg.leastSquares.exact, observations. Largest passing sample 2,000 (68.14 ms, 92.5 MiB peak process RSS). The runs did not locate a ceiling for this family.
Days 33–40 · Decompositions and applications. Small square or rectangular matrices, usually 2×2 to 6×6; track rank, coefficient bit length and conditioning separately.
Unit benchmark · structures.smithForm, square matrix side. Largest passing sample 50 (7.52 ms, 81.2 MiB peak process RSS). The runs did not locate a ceiling for this family.
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. About two to six equations or unknowns by hand, and up to about ten in small exact computational examples.
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.575 ms on Node.
Same API, measured input family.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. 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. 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.rref · 2 passing test cases, 2 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";
const s = linalg.solve([[1, 1, 1], [2, 1, -1], [1, -1, 2]], [[6], [1], [5]]).exact();
console.log([s.status, s.x]);
Checked output
["unique", [[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. About two to six equations or unknowns by hand, and up to about ten in small exact computational examples.
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.314 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 linalg from "@ratmath/linalg";
console.log(linalg.nullspace([[1, 2, 3], [2, 4, 6]]).exact());
Checked output
[[[-2], [1], [0]], [[-3], [0], [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. About two to six equations or unknowns by hand, and up to about ten in small exact computational examples.
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.627 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.nullspace · 1 passing test case, 1 distinct argument description
Row 2 is twice row 1 and row 4 is row 1 minus row 3: rank 2, nullity .
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 linalg from "@ratmath/linalg";
const s = linalg.spaces([[1, 2, 1], [2, 4, 2], [1, 0, 1], [0, 2, 0]]);
console.log([s.rank, s.nullity]);
Checked output
[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. About two to six equations or unknowns by hand, and up to about ten in small exact computational examples.
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.214 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.spaces · 1 passing test case, 1 distinct argument description
Are , , linearly independent? If not, give a relation.
Worked solution
No: .
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 linalg from "@ratmath/linalg";
console.log(linalg.nullspace([[1, 4, 7], [2, 5, 8], [3, 6, 9]]).exact());
Checked output
[[[1], [-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. About two to six equations or unknowns by hand, and up to about ten in small exact computational examples.
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.241 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.nullspace · 1 passing test case, 1 distinct argument description
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as 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. About two to six equations or unknowns by hand, and up to about ten in small exact computational examples.
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
It asserts 0 = 3 and makes the entire system inconsistent.
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. About two to six equations or unknowns by hand, and up to about ten in small exact computational examples.
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 08 / 40 · Equations and pivots
Free variables
Direct calculation@ratmath/core
Problem
A consistent system has five unknowns and two pivot columns. How many parameters describe its solutions?
Worked solution
Every nonpivot variable is free.
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
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. About two to six equations or unknowns by hand, and up to about ten in small exact computational examples.
Focal example. The code above passed its displayed check in 0.078 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.R · whole-number operand. Baseline test points across courses 0, 1, 10, 20, 100, 1,000, 1,000,000. (n+7)(n−3) by independent BigInt arithmetic.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 9,007,199,254,740,991 (1.67 ms, 75.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Exact integer arithmetic grows with operand bit length. Enter large integers as decimal strings or BigInts before any JavaScript Number conversion.
Measured times, memory and outcomes
whole-number operand · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
0
Baseline
Passed
1.75
75
1
Baseline
Passed
1.70
75.7
10
Baseline
Passed
1.78
75.1
20
Baseline
Passed
1.88
75.4
100
Baseline
Passed
1.55
75.4
1,000
Baseline
Passed
1.36
75.3
1,000,000
Baseline
Passed
1.39
74.8
1,000,000,000
Stretch
Passed
1.69
76.3
9,007,199,254,740,991
Stretch
Passed
1.67
75.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
Enter the 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.det([[2, -1, 0], [1, 3, 4], [0, 5, -2]]).exact()));
Checked output
-54
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. Linear maps on dimensions 2–6, usually integer or small rational entries; include singular as well as invertible maps.
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.117 ms on Node.
Same API, measured input family.linalg.det.exact · square matrix side. Baseline test points across courses 1, 2, 3, 5, 10. Dense matrix I+J has eigenvalues 1 (n−1 times) and n+1.
Practical limit. Largest passing sample 200 (383 ms, 131.8 MiB peak process RSS). The first sampled passing call above 100 ms used 200 (383 ms). The runs did not locate a ceiling for this family. Even with small dimensions, large integer minors increase the cost of exact elimination. The dense structured fixture has small entries.
Measured times, memory and outcomes
square matrix side · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.731
76.1
2
Baseline
Passed
0.810
74.8
3
Baseline
Passed
0.876
75.2
5
Baseline
Passed
1.32
75.4
10
Baseline
Passed
1.58
76.1
25
Stretch
Passed
7.10
77.5
50
Stretch
Passed
21.28
81.7
100
Stretch
Passed
67.11
90.3
200
Stretch
Passed
383
131.8
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.det · 19 passing test cases, 22 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([[1, 2, 3], [0, 1, 4], [5, 6, 0]]).exact()));
Checked output
[-24, 18, 5]
[20, -15, -4]
[-5, 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. Linear maps on dimensions 2–6, usually integer or small rational entries; include singular as well as invertible maps.
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.166 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
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.solve([[1, 1], [1, -1]], [[3], [5]]).exact().x));
Checked output
[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. Linear maps on dimensions 2–6, usually integer or small rational entries; include singular as well as invertible maps.
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 0.360 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
For , find the kernel and decide whether is onto .
Worked solution
Kernel spanned by ; rank 2, so is onto.
Using RatMath
Compare the computed rank to the target dimension two. Equality establishes surjectivity.
JavaScript module
import * as linalg from "@ratmath/linalg";
console.log(
[linalg.nullspace([[1, 1, 0], [0, 1, 1]]).exact(), linalg.rank([[1, 1, 0], [0, 1, 1]]).exact()]
);
Checked output
[[[[1], [-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. Linear maps on dimensions 2–6, usually integer or small rational entries; include singular as well as invertible maps.
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.279 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.nullspace · 1 passing test case, 1 distinct argument description
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. Linear maps on dimensions 2–6, usually integer or small rational entries; include singular as well as invertible maps.
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
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. Linear maps on dimensions 2–6, usually integer or small rational entries; include singular as well as invertible maps.
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
A matrix with determinant −7 has two rows swapped. Find the new determinant.
Worked solution
A single swap reverses the oriented volume.
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)`));
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. Linear maps on dimensions 2–6, usually integer or small rational entries; include singular as well as invertible maps.
Focal example. The code above passed its displayed check in 0.114 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
T(0)=1 violates a necessary condition for linearity. Translation is affine.
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`0+1`));
Checked output
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. Linear maps on dimensions 2–6, usually integer or small rational entries; include singular as well as invertible maps.
Focal example. The code above passed its displayed check in 0.053 ms on Node.
Same arithmetic expression. Replaced its first numeral 0 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
Supply the matrix in row order. Keep exact roots in algebraic form when comparing multiplicities or reporting a stretch factor.
JavaScript module
import * as linalg from "@ratmath/linalg";
console.log(
linalg.eigenvectors([[4, 1], [2, 3]]).exact().map((e) => [e.value.toString(), e.vectors])
);
Checked output
[["2", [[[-1/2], [1]]]], ["5", [[[1], [1]]]]]
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Eigenvalues and Jordan forms mainly for 2×2 to 4×4 matrices. Repeated roots can matter more than the matrix side.
For this problem type. Use 2×2 through 4×4 matrices for hand spectra, including repeated eigenvalues. An entry’s size alone gives little indication of root-isolation cost.
Focal example. The code above passed its displayed check in 1.68 ms on Node.
Related workload in this unit.linalg.eigenvalues.exact · matrix side. Baseline test points across courses 1, 2, 3, 4. An upper bidiagonal matrix has diagonal entries 1 through n as its full spectrum.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 18 (18.30 ms, 87.1 MiB peak process RSS). The runs did not locate a ceiling for this family. The triangular example has rational eigenvalues. General characteristic polynomials, repeated roots and algebraic root isolation are harder.
Measured times, memory and outcomes
matrix side · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
1.92
75.5
2
Baseline
Passed
6.14
75.2
3
Baseline
Passed
3.11
75
4
Baseline
Passed
7.05
76.1
6
Stretch
Passed
4.26
75.4
10
Stretch
Passed
7.90
78.4
18
Stretch
Passed
18.30
87.1
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.eigenvectors · 6 passing test cases, 4 distinct argument descriptions
Direct calculation@ratmath/algebraic · @ratmath/linalg
Problem
Find the eigenvalues of .
Worked solution
: , .
Using RatMath
Supply the matrix in row order. Keep exact roots in algebraic form when comparing multiplicities or reporting a stretch factor.
JavaScript module
import * as algebraic from "@ratmath/algebraic";
import * as linalg from "@ratmath/linalg";
console.log(
linalg.eigenvalues([[2, 1, 0], [1, 2, 1], [0, 1, 2]]).exact().real.map((e) => algebraic.format(e.value))
);
Checked output
["2 − √2", "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. Eigenvalues and Jordan forms mainly for 2×2 to 4×4 matrices. Repeated roots can matter more than the matrix side.
For this problem type. Use 2×2 through 4×4 matrices for hand spectra, including repeated eigenvalues. An entry’s size alone gives little indication of root-isolation cost.
Focal example. The code above passed its displayed check in 2.73 ms on Node.
Same API, measured input family.linalg.eigenvalues.exact · matrix side. Baseline test points across courses 1, 2, 3, 4. An upper bidiagonal matrix has diagonal entries 1 through n as its full spectrum.
Practical limit. Largest passing sample 18 (18.30 ms, 87.1 MiB peak process RSS). The runs did not locate a ceiling for this family. The triangular example has rational eigenvalues. General characteristic polynomials, repeated roots and algebraic root isolation are harder.
Measured times, memory and outcomes
matrix side · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
1.92
75.5
2
Baseline
Passed
6.14
75.2
3
Baseline
Passed
3.11
75
4
Baseline
Passed
7.05
76.1
6
Stretch
Passed
4.26
75.4
10
Stretch
Passed
7.90
78.4
18
Stretch
Passed
18.30
87.1
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.eigenvalues · 8 passing test cases, 17 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 linalg from "@ratmath/linalg";
console.log(linalg.charpoly([[1, 2], [3, 4]]).exact());
Checked output
[-2, -5, 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. Eigenvalues and Jordan forms mainly for 2×2 to 4×4 matrices. Repeated roots can matter more than the matrix side.
For this problem type. Use 2×2 through 4×4 matrices for hand spectra, including repeated eigenvalues. An entry’s size alone gives little indication of root-isolation cost.
Focal example. The code above passed its displayed check in 0.386 ms on Node.
Related workload in this unit.linalg.eigenvalues.exact · matrix side. Baseline test points across courses 1, 2, 3, 4. An upper bidiagonal matrix has diagonal entries 1 through n as its full spectrum.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 18 (18.30 ms, 87.1 MiB peak process RSS). The runs did not locate a ceiling for this family. The triangular example has rational eigenvalues. General characteristic polynomials, repeated roots and algebraic root isolation are harder.
Measured times, memory and outcomes
matrix side · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
1.92
75.5
2
Baseline
Passed
6.14
75.2
3
Baseline
Passed
3.11
75
4
Baseline
Passed
7.05
76.1
6
Stretch
Passed
4.26
75.4
10
Stretch
Passed
7.90
78.4
18
Stretch
Passed
18.30
87.1
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.charpoly · 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 linalg from "@ratmath/linalg";
console.log(String(linalg.power([[1, 1], [1, 0]], 10).exact()));
Checked output
[89, 55]
[55, 34]
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Eigenvalues and Jordan forms mainly for 2×2 to 4×4 matrices. Repeated roots can matter more than the matrix side.
Focal example. The code above passed its displayed check in 0.360 ms on Node.
Related workload in this unit.linalg.eigenvalues.exact · matrix side. Baseline test points across courses 1, 2, 3, 4. An upper bidiagonal matrix has diagonal entries 1 through n as its full spectrum.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 18 (18.30 ms, 87.1 MiB peak process RSS). The runs did not locate a ceiling for this family. The triangular example has rational eigenvalues. General characteristic polynomials, repeated roots and algebraic root isolation are harder.
Measured times, memory and outcomes
matrix side · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
1.92
75.5
2
Baseline
Passed
6.14
75.2
3
Baseline
Passed
3.11
75
4
Baseline
Passed
7.05
76.1
6
Stretch
Passed
4.26
75.4
10
Stretch
Passed
7.90
78.4
18
Stretch
Passed
18.30
87.1
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.power · 1 passing test case, 6 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 linalg from "@ratmath/linalg";
console.log(String(linalg.jordan([[5, 1], [-1, 3]]).exact().J));
Checked output
[4, 1]
[0, 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. Eigenvalues and Jordan forms mainly for 2×2 to 4×4 matrices. Repeated roots can matter more than the matrix side.
For this problem type. Use 2×2 through 4×4 matrices for hand spectra, including repeated eigenvalues. An entry’s size alone gives little indication of root-isolation cost.
Focal example. The code above passed its displayed check in 1.23 ms on Node.
Related workload in this unit.linalg.eigenvalues.exact · matrix side. Baseline test points across courses 1, 2, 3, 4. An upper bidiagonal matrix has diagonal entries 1 through n as its full spectrum.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 18 (18.30 ms, 87.1 MiB peak process RSS). The runs did not locate a ceiling for this family. The triangular example has rational eigenvalues. General characteristic polynomials, repeated roots and algebraic root isolation are harder.
Measured times, memory and outcomes
matrix side · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
1.92
75.5
2
Baseline
Passed
6.14
75.2
3
Baseline
Passed
3.11
75
4
Baseline
Passed
7.05
76.1
6
Stretch
Passed
4.26
75.4
10
Stretch
Passed
7.90
78.4
18
Stretch
Passed
18.30
87.1
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.jordan · 1 passing test case, 1 distinct argument description
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. Eigenvalues and Jordan forms mainly for 2×2 to 4×4 matrices. Repeated roots can matter more than the matrix side.
For this problem type. Use a scalar ODE or a two-state system with a short time interval. Hand traces use a few steps and classroom comparisons commonly use 10–100.
Focal example. The code above passed its displayed check in 2.42 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.
analytic.linearSystem · 2 passing test cases, 9 distinct argument descriptions
Its sole eigenvalue is 2 and the kernel of A−2I is the one-dimensional x-axis. Two independent eigenvectors are required.
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. Eigenvalues and Jordan forms mainly for 2×2 to 4×4 matrices. Repeated roots can matter more than the matrix side.
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 · Eigenstructure
Cayley–Hamilton
Worked by hand
Problem
If A²−3A+2I=0, express A³ as a combination of A and I.
Worked solution
Multiply by A and substitute A²=3A−2I to obtain 7A−6I.
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. Eigenvalues and Jordan forms mainly for 2×2 to 4×4 matrices. Repeated roots can matter more than the matrix side.
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 25 / 40 · Inner products
Gram–Schmidt
Direct calculation@ratmath/linalg
Problem
Apply Gram–Schmidt to , (orthogonal, not yet normalised).
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 linalg from "@ratmath/linalg";
console.log(linalg.gramSchmidt([[1, 1], [1, 0], [0, 1]]).exact());
Checked output
[[[1], [1], [0]], [[1/2], [-1/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 to six basis vectors, simple exact inner products, or tens of observations with two to four fitted coefficients.
Focal example. The code above passed its displayed check in 0.724 ms on Node.
Related workload in this unit.linalg.leastSquares.exact · observations. Baseline test points across courses 2, 3, 5, 20. For y=2+3x, recover both coefficients with zero residual.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 2,000 (68.14 ms, 92.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Cost depends on both observations and independent columns. Collinearity can destroy uniqueness, and near-collinearity makes floating fits sensitive.
Measured times, memory and outcomes
observations · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
2
Baseline
Passed
1.88
75.3
3
Baseline
Passed
2.81
75.9
5
Baseline
Passed
2.05
74.7
20
Baseline
Passed
2.43
75.7
100
Stretch
Passed
4.00
75.9
500
Stretch
Passed
18.48
81.3
2,000
Stretch
Passed
68.14
92.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.
linalg.gramSchmidt · 1 passing test case, 1 distinct argument description
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as linalg from "@ratmath/linalg";
const A = [[1], [1], [1]];
console.log(String(linalg.multiply(A, linalg.leastSquares(A, [[1], [2], [3]]).exact().x)));
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. Two to six basis vectors, simple exact inner products, or tens of observations with two to four fitted coefficients.
For this problem type. Hand fits use about 4–12 paired observations. A classroom dataset can have tens to hundreds of rows and one to five predictors. Include a nonconstant predictor.
Focal example. The code above passed its displayed check in 1.69 ms on Node.
Same API, measured input family.linalg.leastSquares.exact · observations. Baseline test points across courses 2, 3, 5, 20. For y=2+3x, recover both coefficients with zero residual.
Practical limit. Largest passing sample 2,000 (68.14 ms, 92.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Cost depends on both observations and independent columns. Collinearity can destroy uniqueness, and near-collinearity makes floating fits sensitive.
Measured times, memory and outcomes
observations · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
2
Baseline
Passed
1.88
75.3
3
Baseline
Passed
2.81
75.9
5
Baseline
Passed
2.05
74.7
20
Baseline
Passed
2.43
75.7
100
Stretch
Passed
4.00
75.9
500
Stretch
Passed
18.48
81.3
2,000
Stretch
Passed
68.14
92.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.
linalg.leastSquares · 1 passing test case, 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 linalg from "@ratmath/linalg";
console.log(
String(linalg.leastSquares([[1, 0], [1, 1], [1, 2], [1, 3]], [[1], [3], [4], [4]]).exact().x)
);
Checked output
[3/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 to six basis vectors, simple exact inner products, or tens of observations with two to four fitted coefficients.
For this problem type. Hand fits use about 4–12 paired observations. A classroom dataset can have tens to hundreds of rows and one to five predictors. Include a nonconstant predictor.
Focal example. The code above passed its displayed check in 0.287 ms on Node.
Same API, measured input family.linalg.leastSquares.exact · observations. Baseline test points across courses 2, 3, 5, 20. For y=2+3x, recover both coefficients with zero residual.
Practical limit. Largest passing sample 2,000 (68.14 ms, 92.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Cost depends on both observations and independent columns. Collinearity can destroy uniqueness, and near-collinearity makes floating fits sensitive.
Measured times, memory and outcomes
observations · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
2
Baseline
Passed
1.88
75.3
3
Baseline
Passed
2.81
75.9
5
Baseline
Passed
2.05
74.7
20
Baseline
Passed
2.43
75.7
100
Stretch
Passed
4.00
75.9
500
Stretch
Passed
18.48
81.3
2,000
Stretch
Passed
68.14
92.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.
linalg.leastSquares · 1 passing test case, 2 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. Two to six basis vectors, simple exact inner products, or tens of observations with two to four fitted coefficients.
For this problem type. Use 2×2 through 4×4 matrices for hand spectra, including repeated eigenvalues. An entry’s size alone gives little indication of root-isolation cost.
Focal example. The code above passed its displayed check in 3.05 ms on Node.
Related workload in this unit.linalg.eigenvalues.exact · matrix side. Baseline test points across courses 1, 2, 3, 4. An upper bidiagonal matrix has diagonal entries 1 through n as its full spectrum.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 18 (18.30 ms, 87.1 MiB peak process RSS). The runs did not locate a ceiling for this family. The triangular example has rational eigenvalues. General characteristic polynomials, repeated roots and algebraic root isolation are harder.
Measured times, memory and outcomes
matrix side · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
1.92
75.5
2
Baseline
Passed
6.14
75.2
3
Baseline
Passed
3.11
75
4
Baseline
Passed
7.05
76.1
6
Stretch
Passed
4.26
75.4
10
Stretch
Passed
7.90
78.4
18
Stretch
Passed
18.30
87.1
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.symmetricEigen · 1 passing test case, 4 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. Two to six basis vectors, simple exact inner products, or tens of observations with two to four fitted coefficients.
For this problem type. Use 2×2 through 4×4 matrices for hand spectra, including repeated eigenvalues. An entry’s size alone gives little indication of root-isolation cost.
Focal example. The code above passed its displayed check in 0.262 ms on Node.
Related workload in this unit.linalg.eigenvalues.exact · matrix side. Baseline test points across courses 1, 2, 3, 4. An upper bidiagonal matrix has diagonal entries 1 through n as its full spectrum.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 18 (18.30 ms, 87.1 MiB peak process RSS). The runs did not locate a ceiling for this family. The triangular example has rational eigenvalues. General characteristic polynomials, repeated roots and algebraic root isolation are harder.
Measured times, memory and outcomes
matrix side · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
1.92
75.5
2
Baseline
Passed
6.14
75.2
3
Baseline
Passed
3.11
75
4
Baseline
Passed
7.05
76.1
6
Stretch
Passed
4.26
75.4
10
Stretch
Passed
7.90
78.4
18
Stretch
Passed
18.30
87.1
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.definiteness · 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 linalg from "@ratmath/linalg";
console.log(
linalg.leastSquares([[1, 0], [1, 1], [1, 2], [1, 3]], [1, 3, 4, 4]).exact().x.toArray().flat()
);
Checked output
[3/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 to six basis vectors, simple exact inner products, or tens of observations with two to four fitted coefficients.
For this problem type. Hand fits use about 4–12 paired observations. A classroom dataset can have tens to hundreds of rows and one to five predictors. Include a nonconstant predictor.
Focal example. The code above passed its displayed check in 0.404 ms on Node.
Same API, measured input family.linalg.leastSquares.exact · observations. Baseline test points across courses 2, 3, 5, 20. For y=2+3x, recover both coefficients with zero residual.
Practical limit. Largest passing sample 2,000 (68.14 ms, 92.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Cost depends on both observations and independent columns. Collinearity can destroy uniqueness, and near-collinearity makes floating fits sensitive.
Measured times, memory and outcomes
observations · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
2
Baseline
Passed
1.88
75.3
3
Baseline
Passed
2.81
75.9
5
Baseline
Passed
2.05
74.7
20
Baseline
Passed
2.43
75.7
100
Stretch
Passed
4.00
75.9
500
Stretch
Passed
18.48
81.3
2,000
Stretch
Passed
68.14
92.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.
linalg.leastSquares · 1 passing test case, 2 distinct argument descriptions
Find a vector orthogonal to both (1,1,0) and (0,1,1).
Worked solution
Dot products require x+y=0 and y+z=0. Taking y=−1 gives (1,−1,1).
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 to six basis vectors, simple exact inner products, or tens of observations with two to four fitted coefficients.
Scope of verification. This day asks for a hand argument, construction or interpretation. The worked instance gives the input. General claims need the reasoning shown above. A measured time, memory ceiling or finite input sweep would not verify that claim.
Day 32 / 40 · Inner products
Least-squares residual
Direct calculation@ratmath/core
Problem
For a constant fit to 2,5,8, what is the sum of the residuals?
Worked solution
The fitted constant is their mean 5. Residuals −3,0,3 sum 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`(2-5)+(5-5)+(8-5)`));
Checked output
0
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Two to six basis vectors, simple exact inner products, or tens of observations with two to four fitted coefficients.
Focal example. The code above passed its displayed check in 0.312 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
Direct calculation@ratmath/algebraic · @ratmath/linalg
Problem
Find the singular values of .
Worked solution
has eigenvalues 45 and 5: .
Using RatMath
Supply the matrix in row order. Keep exact roots in algebraic form when comparing multiplicities or reporting a stretch factor.
JavaScript module
import * as algebraic from "@ratmath/algebraic";
import * as linalg from "@ratmath/linalg";
console.log(linalg.singularValues([[3, 0], [4, 5]]).exact().map((s) => algebraic.format(s.value)));
Checked output
["3√5", "√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. Small square or rectangular matrices, usually 2×2 to 6×6; track rank, coefficient bit length and conditioning separately.
For this problem type. Use 2×2 through 4×4 matrices for hand spectra, including repeated eigenvalues. An entry’s size alone gives little indication of root-isolation cost.
Focal example. The code above passed its displayed check in 3.20 ms on Node.
Related workload in this unit.linalg.eigenvalues.exact · matrix side. Baseline test points across courses 1, 2, 3, 4. An upper bidiagonal matrix has diagonal entries 1 through n as its full spectrum.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 18 (18.30 ms, 87.1 MiB peak process RSS). The runs did not locate a ceiling for this family. The triangular example has rational eigenvalues. General characteristic polynomials, repeated roots and algebraic root isolation are harder.
Measured times, memory and outcomes
matrix side · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
1.92
75.5
2
Baseline
Passed
6.14
75.2
3
Baseline
Passed
3.11
75
4
Baseline
Passed
7.05
76.1
6
Stretch
Passed
4.26
75.4
10
Stretch
Passed
7.90
78.4
18
Stretch
Passed
18.30
87.1
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.singularValues · 3 passing test cases, 6 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 linalg from "@ratmath/linalg";
const F = linalg.lu([[2, 1], [4, 3]]).exact();
console.log([F.L, F.U].map(String));
Checked output
["[1, 0]\n[2, 1]", "[2, 1]\n[0, 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. Small square or rectangular matrices, usually 2×2 to 6×6; track rank, coefficient bit length and conditioning separately.
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.428 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.lu · 1 passing test case, 1 distinct argument description
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as linalg from "@ratmath/linalg";
console.log(String(linalg.cond([["1", "1"], ["1", "1.0001"]], "inf").exact()));
Checked output
400040001/10000
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. Small square or rectangular matrices, usually 2×2 to 6×6; track rank, coefficient bit length and conditioning separately.
Focal example. The code above passed its displayed check in 0.527 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.cond · 1 passing test case, 4 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. Small square or rectangular matrices, usually 2×2 to 6×6; track rank, coefficient bit length and conditioning separately.
Focal example. The code above passed its displayed check in 7.49 ms on Node. Both enclosure endpoints also met the lesson’s stated numerical tolerance.
Related workload in this unit.linalg.eigenvalues.exact · matrix side. Baseline test points across courses 1, 2, 3, 4. An upper bidiagonal matrix has diagonal entries 1 through n as its full spectrum.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 18 (18.30 ms, 87.1 MiB peak process RSS). The runs did not locate a ceiling for this family. The triangular example has rational eigenvalues. General characteristic polynomials, repeated roots and algebraic root isolation are harder.
Measured times, memory and outcomes
matrix side · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
1.92
75.5
2
Baseline
Passed
6.14
75.2
3
Baseline
Passed
3.11
75
4
Baseline
Passed
7.05
76.1
6
Stretch
Passed
4.26
75.4
10
Stretch
Passed
7.90
78.4
18
Stretch
Passed
18.30
87.1
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.methods.jacobi · 3 passing test cases, 8 distinct argument descriptions
Find the stationary distribution of the chain with transition matrix .
Worked solution
: .
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as stats from "@ratmath/stats";
console.log(stats.markovChain([["0.9", "0.1"], ["0.5", "0.5"]]).stationary().distribution);
Checked output
{ "0": 5/6, "1": 1/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. Small square or rectangular matrices, usually 2×2 to 6×6; track rank, coefficient bit length and conditioning separately.
For this problem type. Use about 2–10 states, nonnegative rational transition probabilities and rows summing to one. Vary the class structure when testing uniqueness.
Focal example. The code above passed its displayed check in 0.871 ms on Node.
Same API, measured input family.stats.markovChain.stationary · states. Baseline test points across courses 2, 3, 5, 10. A strictly positive uniform transition matrix has uniform stationary probabilities.
Practical limit. Largest passing sample 100 (655 ms, 144.2 MiB peak process RSS). The first sampled passing call above 100 ms used 50 (112 ms). The runs did not locate a ceiling for this family. An explicit transition matrix has n² entries. Check row sums, closed communicating classes and periodicity before interpreting a stationary law as a limit.
Measured times, memory and outcomes
states · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
2
Baseline
Passed
5.03
74.6
3
Baseline
Passed
1.61
75.6
5
Baseline
Passed
2.69
75
10
Baseline
Passed
16.48
77
20
Stretch
Passed
36.57
83.9
50
Stretch
Passed
112
92.9
100
Stretch
Passed
655
144.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.
stats.markovChain · 2 passing test cases, 3 distinct argument descriptions
Find the Smith normal form of and the abelian group modulo its columns.
Worked solution
of entries ; of minors ; . So and the cokernel is .
Using RatMath
Enter the integer matrix with its original row and column bases. Read the diagonal invariant factors together with any free summands.
JavaScript module
import * as structures from "@ratmath/structures";
console.log(structures.smithForm([[2, 4, 4], [-6, 6, 12], [10, -4, -16]]).diagonal);
Checked output
[2n, 6n, 12n]
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. Small square or rectangular matrices, usually 2×2 to 6×6; track rank, coefficient bit length and conditioning separately.
For this problem type. Hand examples use roughly 2–6 rows and columns over the integers. Keep entries small and specify the coefficient ring.
Focal example. The code above passed its displayed check in 0.724 ms on Node.
Same API, measured input family.structures.smithForm · square matrix side. Baseline test points across courses 1, 2, 3, 5. For a diagonal matrix with 1,2,4,… each invariant factor already divides the next.
Practical limit. Largest passing sample 50 (7.52 ms, 81.2 MiB peak process RSS). The runs did not locate a ceiling for this family. Diagonal input is favorable. Dense integer matrices can create large intermediate coefficients even when their final invariant factors are small.
Measured times, memory and outcomes
square matrix side · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.310
74.3
2
Baseline
Passed
0.448
75.9
3
Baseline
Passed
0.400
75.2
5
Baseline
Passed
0.423
74.8
10
Stretch
Passed
0.565
75.5
25
Stretch
Passed
2.55
76.1
50
Stretch
Passed
7.52
81.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.
structures.smithForm · 1 passing test case, 6 distinct argument descriptions
Can a map through a two-dimensional intermediate space have rank three?
Worked solution
No. The final image is the image of a subspace of dimension at most two.
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. Small square or rectangular matrices, usually 2×2 to 6×6; track rank, coefficient bit length and conditioning separately.
Scope of verification. This day asks for a hand argument, construction or interpretation. The worked instance gives the input. General claims need the reasoning shown above. A measured time, memory ceiling or finite input sweep would not verify that claim.
Day 40 / 40 · Decompositions and applications
Singular values and scaling
Direct calculation@ratmath/algebraic · @ratmath/linalg
Problem
What is the largest stretch of the diagonal matrix diag(−4,1)?
Worked solution
A unit vector on the first axis acquires length 4. All unit vectors have squared output length at most 16.
Using RatMath
Supply the matrix in row order. Keep exact roots in algebraic form when comparing multiplicities or reporting a stretch factor.
JavaScript module
import * as algebraic from "@ratmath/algebraic";
import * as linalg from "@ratmath/linalg";
console.log(algebraic.format(linalg.singularValues([[-4,0],[0,1]]).exact()[0].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. Small square or rectangular matrices, usually 2×2 to 6×6; track rank, coefficient bit length and conditioning separately.
For this problem type. Use 2×2 through 4×4 matrices for hand spectra, including repeated eigenvalues. An entry’s size alone gives little indication of root-isolation cost.
Focal example. The code above passed its displayed check in 0.259 ms on Node.
Related workload in this unit.linalg.eigenvalues.exact · matrix side. Baseline test points across courses 1, 2, 3, 4. An upper bidiagonal matrix has diagonal entries 1 through n as its full spectrum.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 18 (18.30 ms, 87.1 MiB peak process RSS). The runs did not locate a ceiling for this family. The triangular example has rational eigenvalues. General characteristic polynomials, repeated roots and algebraic root isolation are harder.
Measured times, memory and outcomes
matrix side · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
1.92
75.5
2
Baseline
Passed
6.14
75.2
3
Baseline
Passed
3.11
75
4
Baseline
Passed
7.05
76.1
6
Stretch
Passed
4.26
75.4
10
Stretch
Passed
7.90
78.4
18
Stretch
Passed
18.30
87.1
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.format · 13 passing test cases, 2 distinct argument descriptions