34 of 40 focal problems use RatMath for a calculation or a substantive step.
Direct calculation
33 · 82.5%
Assisted
1 · 2.5%
Worked by hand
6 · 15%
Using the packages
Exact coordinates help with lengths, intersections and constructions. A numerical check on a particular triangle serves a different purpose from a deduction from congruence or parallelism.
Calculator interface
Allow constraints such as perpendicular or tangent to be attached to the drawing. Distinguish measured values from givens and open a proof panel that lists the assumptions used.
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
34 of 40 days include a checked executable example. On 9 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 · Coordinates and congruence. Plane coordinates usually of magnitude under 20; two endpoints, three triangle vertices or four quadrilateral vertices.
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 9–16 · Similarity and trigonometry. One triangle with positive lengths; interior angles between 0° and 180°. Similarity may also require a second triangle.
Unit benchmark · geo.triangle, scale on a 3–4–5 triangle. Largest passing sample 1,000,000 (0.273 ms, 75.3 MiB peak process RSS). The runs did not locate a ceiling for this family.
Days 17–24 · Polygons and circles. Three to twelve polygon sides or one circle, with a few chords, arcs or angles in the diagram.
Unit benchmark · geo.triangle, scale on a 3–4–5 triangle. Largest passing sample 1,000,000 (0.273 ms, 75.3 MiB peak process RSS). The runs did not locate a ceiling for this family.
Days 25–32 · Measurement and constructions. Positive lengths commonly 1–50, one solid or a small composite, and exact π where an answer calls for it.
Unit benchmark · units.Q, length in metres. Largest passing sample 1,000,000,000 (0.305 ms, 75.7 MiB peak process RSS). The runs did not locate a ceiling for this family.
Days 33–40 · Proof and applications. A diagram with three to eight named points and a short deduction. Noncollinearity or nonzero lengths are often essential.
Unit benchmark · geo.triangle, scale on a 3–4–5 triangle. Largest passing sample 1,000,000 (0.273 ms, 75.3 MiB peak process RSS). The runs did not locate a ceiling for this family.
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.midpoint([-4, 7], [6, -1])));
Checked output
(1, 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. Plane coordinates usually of magnitude under 20; two endpoints, three triangle vertices or four quadrilateral vertices.
Focal example. The code above passed its displayed check in 0.107 ms on Node.
Same API, measured input family.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. 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. 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.midpoint · 1 passing test case, 1 distinct argument description
Find the perpendicular bisector of the segment from to .
Worked solution
Midpoint , slope : .
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as geo from "@ratmath/geo";
console.log(String(geo.perpendicularBisector([1, 2], [5, 6])));
Checked output
x + y - 7 = 0
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Plane coordinates usually of magnitude under 20; two endpoints, three triangle vertices or four quadrilateral vertices.
Focal example. The code above passed its displayed check in 0.206 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.perpendicularBisector · 1 passing test case, 1 distinct argument description
Classify the triangle with vertices , , by its sides and angles, and find its area.
Worked solution
Sides 6, , : scalene. Largest side squared : acute. Area .
Using RatMath
Enter the coordinates in vertex order. Read the requested centre, length or radius using the same coordinate system as the problem.
JavaScript module
import * as geo from "@ratmath/geo";
const T = geo.triangle([0, 0], [6, 0], [2, 4]);
console.log([T.classify(), T.area]);
Checked output
[{ angles: "acute", sides: "scalene" }, 12]
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Plane coordinates usually of magnitude under 20; two endpoints, three triangle vertices or four quadrilateral vertices.
Focal example. The code above passed its displayed check in 0.276 ms on Node.
Same API, measured input family.geo.triangle · scale on a 3–4–5 triangle. Baseline test points across courses 1, 2, 5, 10. The unsigned area scales by k² from 6.
Practical limit. Largest passing sample 1,000,000 (0.273 ms, 75.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Rescaling preserves this triangle’s shape. Collinear and nearly collinear coordinates need separate checks for undefined angles and small signed area.
Measured times, memory and outcomes
scale on a 3–4–5 triangle · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.270
74.8
2
Baseline
Passed
0.388
74.9
5
Baseline
Passed
0.287
76.4
10
Baseline
Passed
0.264
75.6
100
Stretch
Passed
0.278
75.3
10,000
Stretch
Passed
0.268
76.8
1,000,000
Stretch
Passed
0.273
75.3
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
geo.triangle · 5 passing test cases, 4 distinct argument descriptions
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. Plane coordinates usually of magnitude under 20; two endpoints, three triangle vertices or four quadrilateral vertices.
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
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as geo from "@ratmath/geo";
console.log(String(geo.distance([1, -2], [7, 6])));
Checked output
10
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. Plane coordinates usually of magnitude under 20; two endpoints, three triangle vertices or four quadrilateral vertices.
Focal example. The code above passed its displayed check in 0.063 ms on Node.
Related workload in this unit.geo.midpoint · absolute coordinate. Baseline test points across courses 0, 1, 10, 100. Midpoint of (−k,0) and (k,2k) equals (0,k).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,000 (0.175 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Coordinate size and dimension affect exact distance and dot products. Floating geometry near coincidence can lose significant digits.
Measured times, memory and outcomes
absolute coordinate · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
0
Baseline
Passed
0.193
74.9
1
Baseline
Passed
0.197
75.2
10
Baseline
Passed
0.151
75.4
100
Baseline
Passed
0.169
75.6
1,000,000
Stretch
Passed
0.298
76.3
1,000,000,000
Stretch
Passed
0.175
75.5
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
geo.distance · 3 passing test cases, 2 distinct argument descriptions
Reflect the point in the -axis, then translate it 2 right and 4 up. Where does it land?
Worked solution
, then .
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as geo from "@ratmath/geo";
const yAxis = geo.line([0, 0], [0, 1]);
console.log(String(geo.translation([2, 4]).compose(geo.reflection(yAxis)).apply([3, -5])));
Checked output
(-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. Plane coordinates usually of magnitude under 20; two endpoints, three triangle vertices or four quadrilateral vertices.
Focal example. The code above passed its displayed check in 0.424 ms on Node.
Related workload in this unit.geo.midpoint · absolute coordinate. Baseline test points across courses 0, 1, 10, 100. Midpoint of (−k,0) and (k,2k) equals (0,k).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,000 (0.175 ms, 75.5 MiB peak process RSS). The runs did not locate a ceiling for this family. Coordinate size and dimension affect exact distance and dot products. Floating geometry near coincidence can lose significant digits.
Measured times, memory and outcomes
absolute coordinate · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
0
Baseline
Passed
0.193
74.9
1
Baseline
Passed
0.197
75.2
10
Baseline
Passed
0.151
75.4
100
Baseline
Passed
0.169
75.6
1,000,000
Stretch
Passed
0.298
76.3
1,000,000,000
Stretch
Passed
0.175
75.5
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
geo.line · 10 passing test cases, 15 distinct argument descriptions
Do two angles and the included side determine a triangle up to congruence?
Worked solution
Yes, for a nondegenerate triangle. Place the side, draw rays making the prescribed angles and use their intersection. Reflection gives a congruent copy.
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. Plane coordinates usually of magnitude under 20; two endpoints, three triangle vertices or four quadrilateral vertices.
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 · Coordinates and congruence
Parallel slopes
Direct calculation@ratmath/core
Problem
A line has slope −2/3. What slope does a perpendicular nonvertical line have?
Worked solution
The product of the two slopes is −1, so take the negative reciprocal.
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`-1/(-2/3)`));
Checked output
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. Plane coordinates usually of magnitude under 20; two endpoints, three triangle vertices or four quadrilateral vertices.
Focal example. The code above passed its displayed check in 0.127 ms on Node.
Same arithmetic expression. Replaced its first numeral 1 with 0, 1, 2, 7, 12, 100, 1000, -3, 1/2. All 9 defined variants agreed exactly with Python’s rational arithmetic. This varies the arithmetic operation while holding the rest of the expression fixed.
Related workload in this unit.core.Rational.add · denominator. Baseline test points across courses 1, 2, 3, 12, 100, 1,000. Cross-multiply 1/n + 1/(n+1) against (2n+1)/(n(n+1)).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,007 (0.038 ms, 76.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Exact work depends on the bit lengths of both numerator and denominator. A long sum of relatively prime fractions can build a large common denominator.
Measured times, memory and outcomes
denominator · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.034
74.9
2
Baseline
Passed
0.036
75.6
3
Baseline
Passed
0.040
75.9
12
Baseline
Passed
0.039
75.2
100
Baseline
Passed
0.041
75
1,000
Baseline
Passed
0.035
75.8
1,000,003
Stretch
Passed
0.044
75
1,000,000,007
Stretch
Passed
0.038
76.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
A triangle has sides 4, 6 and 8. A similar triangle has longest side 12. Find its other sides.
Worked solution
Scale factor : sides 6 and 9.
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";
const k = R`12/8`;
console.log([R`4`.multiply(k), R`6`.multiply(k)]);
Checked output
[6, 9]
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One triangle with positive lengths; interior angles between 0° and 180°. Similarity may also require a second triangle.
Focal example. The code above passed its displayed check in 0.119 ms on Node.
Related workload in this unit.core.Rational.add · denominator. Baseline test points across courses 1, 2, 3, 12, 100, 1,000. Cross-multiply 1/n + 1/(n+1) against (2n+1)/(n(n+1)).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,007 (0.038 ms, 76.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Exact work depends on the bit lengths of both numerator and denominator. A long sum of relatively prime fractions can build a large common denominator.
Measured times, memory and outcomes
denominator · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.034
74.9
2
Baseline
Passed
0.036
75.6
3
Baseline
Passed
0.040
75.9
12
Baseline
Passed
0.039
75.2
100
Baseline
Passed
0.041
75
1,000
Baseline
Passed
0.035
75.8
1,000,003
Stretch
Passed
0.044
75
1,000,000,007
Stretch
Passed
0.038
76.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
A 30–60–90 triangle has hypotenuse 10. Find the legs.
Worked solution
Short leg 5, long leg .
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("10*sin(pi/6)"), symbolic.simplify("10*sin(pi/3)")]);
Checked output
[5, 5*sqrt(3)]
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One triangle with positive lengths; interior angles between 0° and 180°. Similarity may also require a second triangle.
Focal example. The code above passed its displayed check in 1.01 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
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. One triangle with positive lengths; interior angles between 0° and 180°. Similarity may also require a second triangle.
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 12 / 40 · Similarity and trigonometry
Law of cosines
Direct calculation@ratmath/symbolic
Problem
Two sides of a triangle are 7 and 8, with an included angle of . Find the third side.
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.simplify("sqrt(7^2 + 8^2 - 2*7*8*cos(pi/3))")));
Checked output
sqrt(57)
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 triangle with positive lengths; interior angles between 0° and 180°. Similarity may also require a second triangle.
Focal example. The code above passed its displayed check in 3.26 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.evaluate(symbolic.parse("10*sin(65*pi/180)/sin(40*pi/180)")));
Checked output
14.0996461876204866[8525:9046]
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 triangle with positive lengths; interior angles between 0° and 180°. Similarity may also require a second triangle.
Focal example. The code above passed its displayed check in 19.27 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 14 / 40 · Similarity and trigonometry
Dilation
Direct calculation@ratmath/geo
Problem
Dilate by scale factor 3 about .
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 geo from "@ratmath/geo";
console.log(String(geo.dilation([1, 1], 3).apply([3, 2])));
Checked output
(7, 4)
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. One triangle with positive lengths; interior angles between 0° and 180°. Similarity may also require a second triangle.
Focal example. The code above passed its displayed check in 0.095 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.dilation · 1 passing test case, 2 distinct argument descriptions
On a floor plan 1 inch represents 12 feet. A room is 3.5 inches long on the plan. How long is the room?
Worked solution
feet.
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.5 * 12`));
Checked output
42
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 triangle with positive lengths; interior angles between 0° and 180°. Similarity may also require a second triangle.
Focal example. The code above passed its displayed check in 0.069 ms on Node.
Same arithmetic expression. Replaced its first numeral 3.5 with 0, 1, 2, 7, 12, 100, 1000, -3, 1/2. All 9 defined variants agreed exactly with Python’s rational arithmetic. This varies the arithmetic operation while holding the rest of the expression fixed.
Related workload in this unit.core.Rational.add · denominator. Baseline test points across courses 1, 2, 3, 12, 100, 1,000. Cross-multiply 1/n + 1/(n+1) against (2n+1)/(n(n+1)).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,007 (0.038 ms, 76.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Exact work depends on the bit lengths of both numerator and denominator. A long sum of relatively prime fractions can build a large common denominator.
Measured times, memory and outcomes
denominator · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.034
74.9
2
Baseline
Passed
0.036
75.6
3
Baseline
Passed
0.040
75.9
12
Baseline
Passed
0.039
75.2
100
Baseline
Passed
0.041
75
1,000
Baseline
Passed
0.035
75.8
1,000,003
Stretch
Passed
0.044
75
1,000,000,007
Stretch
Passed
0.038
76.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
Can two sides and a nonincluded angle determine two different triangles?
Worked solution
Yes. With A = 30°, a = 7 and b = 10, the altitude b sin A = 5 is below a, while a is below b. The opposite vertex can lie at either intersection with the ray.
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 triangle with positive lengths; interior angles between 0° and 180°. Similarity may also require a second triangle.
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 17 / 40 · Polygons and circles
Polygon angles
Direct calculation@ratmath/geo
Problem
Find the sum of the interior angles of an octagon, and each angle of a regular octagon.
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 geo from "@ratmath/geo";
console.log([geo.angleSum(8), geo.interiorAngle(8)]);
Checked output
[1080, 135]
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. Three to twelve polygon sides or one circle, with a few chords, arcs or angles in the diagram.
Focal example. The code above passed its displayed check in 0.096 ms on Node.
Related workload in this unit.geo.triangle · scale on a 3–4–5 triangle. Baseline test points across courses 1, 2, 5, 10. The unsigned area scales by k² from 6.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000 (0.273 ms, 75.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Rescaling preserves this triangle’s shape. Collinear and nearly collinear coordinates need separate checks for undefined angles and small signed area.
Measured times, memory and outcomes
scale on a 3–4–5 triangle · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.270
74.8
2
Baseline
Passed
0.388
74.9
5
Baseline
Passed
0.287
76.4
10
Baseline
Passed
0.264
75.6
100
Stretch
Passed
0.278
75.3
10,000
Stretch
Passed
0.268
76.8
1,000,000
Stretch
Passed
0.273
75.3
Each row measures the stated fixture. 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.angleSum · 2 passing test cases, 6 distinct argument descriptions
Write the equation of the circle with centre and radius 5. Is on it?
Worked solution
. Yes: .
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as geo from "@ratmath/geo";
const C = geo.circle([-2, 3], [3, 3]);
console.log([C, C.contains ? C.contains([1, 7]) : geo.distance([-2, 3], [1, 7])]);
Checked output
[circle, centre (-2, 3), radius 5, true]
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. Three to twelve polygon sides or one circle, with a few chords, arcs or angles in the diagram.
Focal example. The code above passed its displayed check in 0.273 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.circle · 8 passing test cases, 9 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. Three to twelve polygon sides or one circle, with a few chords, arcs or angles in the diagram.
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
A circle has radius 9. Find the length of an arc and the area of a sector with central angle .
Worked solution
Arc ; sector .
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("80/360*2*pi*9"), symbolic.simplify("80/360*pi*9^2")]);
Checked output
[4*pi, 18*pi]
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. Three to twelve polygon sides or one circle, with a few chords, arcs or angles in the diagram.
Focal example. The code above passed its displayed check in 1.16 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
An inscribed angle intercepts an arc of . What is the angle?
Worked solution
.
Using RatMath
Put the arithmetic inside the R tag so RatMath parses the literals. Keep fractions as ratios throughout the calculation and attach the units from the problem to the result.
JavaScript module
import { R } from "@ratmath/core";
console.log(String(R`110/2`));
Checked output
55
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. Three to twelve polygon sides or one circle, with a few chords, arcs or angles in the diagram.
Focal example. The code above passed its displayed check in 0.238 ms on Node.
Same arithmetic expression. Replaced its first numeral 110 with 0, 1, 2, 7, 12, 100, 1000, -3, 1/2. All 9 defined variants agreed exactly with Python’s rational arithmetic. This varies the arithmetic operation while holding the rest of the expression fixed.
Related workload in this unit.core.Rational.add · denominator. Baseline test points across courses 1, 2, 3, 12, 100, 1,000. Cross-multiply 1/n + 1/(n+1) against (2n+1)/(n(n+1)).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,007 (0.038 ms, 76.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Exact work depends on the bit lengths of both numerator and denominator. A long sum of relatively prime fractions can build a large common denominator.
Measured times, memory and outcomes
denominator · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.034
74.9
2
Baseline
Passed
0.036
75.6
3
Baseline
Passed
0.040
75.9
12
Baseline
Passed
0.039
75.2
100
Baseline
Passed
0.041
75
1,000
Baseline
Passed
0.035
75.8
1,000,003
Stretch
Passed
0.044
75
1,000,000,007
Stretch
Passed
0.038
76.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
A point is 13 units from the centre of a circle of radius 5. How long is a tangent segment from the point to the circle?
Worked solution
Radius ⟂ tangent: .
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as geo from "@ratmath/geo";
console.log(String(geo.tangentLength(geo.circle([0, 0], [5, 0]), [13, 0])));
Checked output
12
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Three to twelve polygon sides or one circle, with a few chords, arcs or angles in the diagram.
Focal example. The code above passed its displayed check in 0.129 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.tangentLength · 2 passing test cases, 2 distinct argument descriptions
Chord segments of lengths 3 and 8 meet segments of lengths 4 and x. Find x.
Worked solution
The products of segments on each chord agree.
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*8/4`));
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. Three to twelve polygon sides or one circle, with a few chords, arcs or angles in the diagram.
Focal example. The code above passed its displayed check in 0.085 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.Rational.add · denominator. Baseline test points across courses 1, 2, 3, 12, 100, 1,000. Cross-multiply 1/n + 1/(n+1) against (2n+1)/(n(n+1)).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,007 (0.038 ms, 76.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Exact work depends on the bit lengths of both numerator and denominator. A long sum of relatively prime fractions can build a large common denominator.
Measured times, memory and outcomes
denominator · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.034
74.9
2
Baseline
Passed
0.036
75.6
3
Baseline
Passed
0.040
75.9
12
Baseline
Passed
0.039
75.2
100
Baseline
Passed
0.041
75
1,000
Baseline
Passed
0.035
75.8
1,000,003
Stretch
Passed
0.044
75
1,000,000,007
Stretch
Passed
0.038
76.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
A convex polygon has five equal exterior turning angles. What is one turn?
Worked solution
A complete boundary traversal turns through 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`360/5`));
Checked output
72
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Three to twelve polygon sides or one circle, with a few chords, arcs or angles in the diagram.
Focal example. The code above passed its displayed check in 0.057 ms on Node.
Same arithmetic expression. Replaced its first numeral 360 with 0, 1, 2, 7, 12, 100, 1000, -3, 1/2. All 9 defined variants agreed exactly with Python’s rational arithmetic. This varies the arithmetic operation while holding the rest of the expression fixed.
Related workload in this unit.core.Rational.add · denominator. Baseline test points across courses 1, 2, 3, 12, 100, 1,000. Cross-multiply 1/n + 1/(n+1) against (2n+1)/(n(n+1)).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,007 (0.038 ms, 76.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Exact work depends on the bit lengths of both numerator and denominator. A long sum of relatively prime fractions can build a large common denominator.
Measured times, memory and outcomes
denominator · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.034
74.9
2
Baseline
Passed
0.036
75.6
3
Baseline
Passed
0.040
75.9
12
Baseline
Passed
0.039
75.2
100
Baseline
Passed
0.041
75
1,000
Baseline
Passed
0.035
75.8
1,000,003
Stretch
Passed
0.044
75
1,000,000,007
Stretch
Passed
0.038
76.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
Find the volume and surface area of a sphere of radius 6, in 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([symbolic.simplify("4/3*pi*6^3"), symbolic.simplify("4*pi*6^2")]);
Checked output
[288*pi, 144*pi]
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. Positive lengths commonly 1–50, one solid or a small composite, and exact π where an answer calls for it.
Focal example. The code above passed its displayed check in 3.27 ms on Node.
Related workload in this unit.symbolic.expand · degree. Baseline test points across courses 1, 2, 4, 8. Sum the expanded coefficients at x=1 by direct substitution; result 2^n. Also check at x=0 and 2.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 128 (47.68 ms, 96.3 MiB peak process RSS). The runs did not locate a ceiling for this family. A univariate binomial has n+1 terms. With several variables the number of monomials can grow combinatorially even at modest degree.
Measured times, memory and outcomes
degree · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
26.10
75.9
2
Baseline
Passed
3.05
75.5
4
Baseline
Passed
2.75
77.3
8
Baseline
Passed
4.23
79.5
16
Stretch
Passed
5.88
82.6
32
Stretch
Passed
6.12
87.9
64
Stretch
Passed
15.73
89.5
128
Stretch
Passed
47.68
96.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
symbolic.simplify · 2 passing test cases, 11 distinct argument descriptions
Enter the coordinates in vertex order. Read the requested centre, length or radius using the same coordinate system as the problem.
JavaScript module
import * as geo from "@ratmath/geo";
console.log(String(geo.triangle([0, 0], [6, 0], [3, 9]).centroid));
Checked output
(3, 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. Positive lengths commonly 1–50, one solid or a small composite, and exact π where an answer calls for it.
Focal example. The code above passed its displayed check in 0.198 ms on Node.
Same API, measured input family.geo.triangle · scale on a 3–4–5 triangle. Baseline test points across courses 1, 2, 5, 10. The unsigned area scales by k² from 6.
Practical limit. Largest passing sample 1,000,000 (0.273 ms, 75.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Rescaling preserves this triangle’s shape. Collinear and nearly collinear coordinates need separate checks for undefined angles and small signed area.
Measured times, memory and outcomes
scale on a 3–4–5 triangle · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.270
74.8
2
Baseline
Passed
0.388
74.9
5
Baseline
Passed
0.287
76.4
10
Baseline
Passed
0.264
75.6
100
Stretch
Passed
0.278
75.3
10,000
Stretch
Passed
0.268
76.8
1,000,000
Stretch
Passed
0.273
75.3
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
geo.triangle · 5 passing test cases, 4 distinct argument descriptions
Find the centre and radius of the circle through .
Worked solution
Right angle at the origin, so the centre is the midpoint of the hypotenuse, ; radius .
Using RatMath
Enter the coordinates in vertex order. Read the requested centre, length or radius using the same coordinate system as the problem.
JavaScript module
import * as geo from "@ratmath/geo";
const T = geo.triangle([0, 0], [4, 0], [0, 6]);
console.log([T.circumcenter, T.circumradius]);
Checked output
[(2, 3), 3.605551275463…]
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. Positive lengths commonly 1–50, one solid or a small composite, and exact π where an answer calls for it.
Focal example. The code above passed its displayed check in 0.854 ms on Node.
Same API, measured input family.geo.triangle · scale on a 3–4–5 triangle. Baseline test points across courses 1, 2, 5, 10. The unsigned area scales by k² from 6.
Practical limit. Largest passing sample 1,000,000 (0.273 ms, 75.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Rescaling preserves this triangle’s shape. Collinear and nearly collinear coordinates need separate checks for undefined angles and small signed area.
Measured times, memory and outcomes
scale on a 3–4–5 triangle · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.270
74.8
2
Baseline
Passed
0.388
74.9
5
Baseline
Passed
0.287
76.4
10
Baseline
Passed
0.264
75.6
100
Stretch
Passed
0.278
75.3
10,000
Stretch
Passed
0.268
76.8
1,000,000
Stretch
Passed
0.273
75.3
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
geo.triangle · 5 passing test cases, 4 distinct argument descriptions
Find the volume of a cylinder with radius 3 and height 10, in 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.simplify("pi*3^2*10")));
Checked output
90*pi
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. Positive lengths commonly 1–50, one solid or a small composite, and exact π where an answer calls for it.
Focal example. The code above passed its displayed check in 1.08 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 volume of a cone with radius 6 and height 4, and of a sphere with radius 3, in terms of .
Worked solution
Cone ; sphere .
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("1/3*pi*6^2*4"), symbolic.simplify("4/3*pi*3^3")]);
Checked output
[48*pi, 36*pi]
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. Positive lengths commonly 1–50, one solid or a small composite, and exact π where an answer calls for it.
Focal example. The code above passed its displayed check in 6.44 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 surface area of a rectangular prism 4 cm by 5 cm by 6 cm.
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 geo from "@ratmath/geo";
console.log(String(geo.box(4, 5, 6).surfaceArea));
Checked output
148
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. Positive lengths commonly 1–50, one solid or a small composite, and exact π where an answer calls for it.
Focal example. The code above passed its displayed check in 2.53 ms on Node.
Related workload in this unit.units.Q · length in metres. Baseline test points across courses 1, 10, 100, 1,000. After conversion to cm the numeric value is exactly 100n.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,000 (0.305 ms, 75.7 MiB peak process RSS). The runs did not locate a ceiling for this family. These tests convert lengths. Check units and dimensional compatibility, especially for areas, volumes, affine temperature scales and compound units.
Measured times, memory and outcomes
length in metres · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.514
76.1
10
Baseline
Passed
0.444
74.1
100
Baseline
Passed
0.442
75.3
1,000
Baseline
Passed
0.480
74.4
1,000,000
Stretch
Passed
0.710
75
1,000,000,000
Stretch
Passed
0.305
75.7
Each row measures the stated fixture. 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.box · 4 passing test cases, 5 distinct argument descriptions
A pyramid has volume 81. A similar cap has half its linear scale. What volume remains?
Worked solution
The cap occupies one eighth of the original 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`81*(1-1/8)`));
Checked output
567/8
Run this example locally
Use the integrated RatMath workspace with the subject packages linked. Save this example as lesson.mjs in its root and run node lesson.mjs. The guide formats library objects as mathematical values. Your console may also print their fields or JavaScript type suffixes.
Typical inputs for this unit. Positive lengths commonly 1–50, one solid or a small composite, and exact π where an answer calls for it.
Focal example. The code above passed its displayed check in 0.115 ms on Node.
Same arithmetic expression. Replaced its first numeral 81 with 0, 1, 2, 7, 12, 100, 1000, -3, 1/2. All 9 defined variants agreed exactly with Python’s rational arithmetic. This varies the arithmetic operation while holding the rest of the expression fixed.
Related workload in this unit.core.Rational.add · denominator. Baseline test points across courses 1, 2, 3, 12, 100, 1,000. Cross-multiply 1/n + 1/(n+1) against (2n+1)/(n(n+1)).
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000,007 (0.038 ms, 76.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Exact work depends on the bit lengths of both numerator and denominator. A long sum of relatively prime fractions can build a large common denominator.
Measured times, memory and outcomes
denominator · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.034
74.9
2
Baseline
Passed
0.036
75.6
3
Baseline
Passed
0.040
75.9
12
Baseline
Passed
0.039
75.2
100
Baseline
Passed
0.041
75
1,000
Baseline
Passed
0.035
75.8
1,000,003
Stretch
Passed
0.044
75
1,000,000,007
Stretch
Passed
0.038
76.3
Each row measures the stated fixture. This workload uses a different operation or expression from the focal example. Its thresholds apply only to the named fixture. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
core.R · 2 passing test cases, 10 distinct argument descriptions
How do two equal circles help bisect an angle with a compass?
Worked solution
Mark equally distant points on its rays, draw equal-radius arcs meeting inside the angle, and join their meeting point to the vertex. Congruent triangles certify the angles.
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. Positive lengths commonly 1–50, one solid or a small composite, and exact π where an answer calls for it.
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 33 / 40 · Proof and applications
Proof
Assisted@ratmath/geo
Problem
Prove that the diagonals of a parallelogram bisect each other.
Worked solution
With , , , : the midpoint of and of are both . (Or by congruent triangles ASA.)
Using RatMath
Identify the common midpoint in vector coordinates. The named theorem returns a success flag and statement; the argument in the solution explains the bisection.
JavaScript module
import * as geo from "@ratmath/geo";
const p = geo.proofs.parallelogram();
console.log([p.proved, p.statement]);
Checked output
[true, "the diagonals of a parallelogram bisect each other"]
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 diagram with three to eight named points and a short deduction. Noncollinearity or nonzero lengths are often essential.
For this problem type. This example selects a built-in theorem or solid. The input is a discrete choice from a finite catalog. The displayed call has no freely scalable numeric argument.
Focal example. The code above passed its displayed check in 9.95 ms on Node.
Same API, measured input family.geo.proofs.parallelogram · coordinate scale of a separate specialization. Baseline test points across courses 1, 2, 5, 10. Check the fixed symbolic result, then specialize A=(0,0), B=(2n,0), C=(3n,n), D=(n,n). Both diagonal midpoints equal (3n/2,n/2).
Practical limit. Largest passing sample 10,000 (15.36 ms, 79.4 MiB peak process RSS). The runs did not locate a ceiling for this family. The theorem entry has no numeric argument. These times include an additional coordinate check. The symbolic certificate, with its hypotheses, supplies the general argument.
Measured times, memory and outcomes
coordinate scale of a separate specialization · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
23.18
79.8
2
Baseline
Passed
13.29
80
5
Baseline
Passed
23.23
80.3
10
Baseline
Passed
16.81
80.3
100
Stretch
Passed
12.38
81.3
10,000
Stretch
Passed
15.36
79.4
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 34 / 40 · Proof and applications
Triangle centres
Direct calculation@ratmath/geo
Problem
For the triangle , , , find the circumcentre and circumradius, the incentre and inradius, the orthocentre and the centroid.
Worked solution
Right angle at : the circumcentre is the midpoint of the hypotenuse, , radius . Inradius , incentre . The orthocentre is the right-angle vertex . Centroid .
Using RatMath
Enter the coordinates in vertex order. Read the requested centre, length or radius using the same coordinate system as the problem.
JavaScript module
import * as geo from "@ratmath/geo";
const T = geo.triangle([0, 0], [4, 0], [0, 3]);
console.log(
[T.circumcenter, T.circumradius, T.incenter, T.inradius, T.orthocenter, T.centroid].map(String)
);
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 diagram with three to eight named points and a short deduction. Noncollinearity or nonzero lengths are often essential.
Focal example. The code above passed its displayed check in 1.47 ms on Node.
Same API, measured input family.geo.triangle · scale on a 3–4–5 triangle. Baseline test points across courses 1, 2, 5, 10. The unsigned area scales by k² from 6.
Practical limit. Largest passing sample 1,000,000 (0.273 ms, 75.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Rescaling preserves this triangle’s shape. Collinear and nearly collinear coordinates need separate checks for undefined angles and small signed area.
Measured times, memory and outcomes
scale on a 3–4–5 triangle · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.270
74.8
2
Baseline
Passed
0.388
74.9
5
Baseline
Passed
0.287
76.4
10
Baseline
Passed
0.264
75.6
100
Stretch
Passed
0.278
75.3
10,000
Stretch
Passed
0.268
76.8
1,000,000
Stretch
Passed
0.273
75.3
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
geo.triangle · 5 passing test cases, 4 distinct argument descriptions
For the triangle with vertices (0,0), (4,0) and (0,3), find the Euler line and verify that the centroid divides the orthocentre–circumcentre segment in ratio 2:1.
Worked solution
, , all lie on . , .
Using RatMath
Enter the coordinates in vertex order. Read the requested centre, length or radius using the same coordinate system as the problem.
JavaScript module
import * as geo from "@ratmath/geo";
const T = geo.triangle([0, 0], [4, 0], [0, 3]);
console.log(
[geo.collinear(T.circumcenter, T.centroid, T.orthocenter), geo.distance(T.orthocenter, T.centroid), geo.distance(T.centroid, T.circumcenter), String(T.eulerLine)]
);
Checked output
[true, 5/3, 5/6, "3·x - 4·y = 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. A diagram with three to eight named points and a short deduction. Noncollinearity or nonzero lengths are often essential.
Focal example. The code above passed its displayed check in 1.49 ms on Node.
Same API, measured input family.geo.triangle · scale on a 3–4–5 triangle. Baseline test points across courses 1, 2, 5, 10. The unsigned area scales by k² from 6.
Practical limit. Largest passing sample 1,000,000 (0.273 ms, 75.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Rescaling preserves this triangle’s shape. Collinear and nearly collinear coordinates need separate checks for undefined angles and small signed area.
Measured times, memory and outcomes
scale on a 3–4–5 triangle · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.270
74.8
2
Baseline
Passed
0.388
74.9
5
Baseline
Passed
0.287
76.4
10
Baseline
Passed
0.264
75.6
100
Stretch
Passed
0.278
75.3
10,000
Stretch
Passed
0.268
76.8
1,000,000
Stretch
Passed
0.273
75.3
Each row measures the stated fixture. Other inputs to this API can take different paths. Course intervals are estimates. Finite samples leave intermediate inputs and other problem families unverified.
Additional inputs from package tests
These arguments were observed in passing test cases. The linked assertions show what the tests actually checked. Structured inputs are abbreviated.
geo.triangle · 5 passing test cases, 4 distinct argument descriptions
The rectangle with vertices , , , has how many interior lattice points? Check Pick's theorem.
Worked solution
Boundary points , interior . , the area.
Using RatMath
Use the data and parameter order shown below. Compare the returned value with the intermediate quantities in the worked solution.
JavaScript module
import * as geo from "@ratmath/geo";
const p = geo.pick([[0, 0], [4, 0], [4, 3], [0, 3]]);
console.log([p.interior, p.boundary, p.area, p.holds]);
Checked output
[6, 14, 12, true]
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 diagram with three to eight named points and a short deduction. Noncollinearity or nonzero lengths are often essential.
Focal example. The code above passed its displayed check in 4.12 ms on Node.
Related workload in this unit.geo.triangle · scale on a 3–4–5 triangle. Baseline test points across courses 1, 2, 5, 10. The unsigned area scales by k² from 6.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000 (0.273 ms, 75.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Rescaling preserves this triangle’s shape. Collinear and nearly collinear coordinates need separate checks for undefined angles and small signed area.
Measured times, memory and outcomes
scale on a 3–4–5 triangle · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.270
74.8
2
Baseline
Passed
0.388
74.9
5
Baseline
Passed
0.287
76.4
10
Baseline
Passed
0.264
75.6
100
Stretch
Passed
0.278
75.3
10,000
Stretch
Passed
0.268
76.8
1,000,000
Stretch
Passed
0.273
75.3
Each row measures the stated fixture. 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.pick · 1 passing test case, 2 distinct argument descriptions
Find the interior angle of a regular 12-gon, as a fraction of a full turn and in degrees.
Worked solution
of a turn.
Using RatMath
Put the arithmetic inside the R tag so RatMath parses the literals. Keep fractions as ratios throughout the calculation and attach the units from the problem to the result.
JavaScript module
import * as geo from "@ratmath/geo";
import { R } from "@ratmath/core";
const a = geo.polygonAngle(12);
console.log([a, a.multiply(R`360`)]);
Checked output
[5/12, 150]
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 diagram with three to eight named points and a short deduction. Noncollinearity or nonzero lengths are often essential.
Focal example. The code above passed its displayed check in 0.185 ms on Node.
Related workload in this unit.geo.triangle · scale on a 3–4–5 triangle. Baseline test points across courses 1, 2, 5, 10. The unsigned area scales by k² from 6.
Practical limit. The cutoff for this lesson’s own code is unmeasured. Largest passing sample 1,000,000 (0.273 ms, 75.3 MiB peak process RSS). The runs did not locate a ceiling for this family. Rescaling preserves this triangle’s shape. Collinear and nearly collinear coordinates need separate checks for undefined angles and small signed area.
Measured times, memory and outcomes
scale on a 3–4–5 triangle · one run per input
Input
Sample
Result
Call (ms)
Peak RSS (MiB)
1
Baseline
Passed
0.270
74.8
2
Baseline
Passed
0.388
74.9
5
Baseline
Passed
0.287
76.4
10
Baseline
Passed
0.264
75.6
100
Stretch
Passed
0.278
75.3
10,000
Stretch
Passed
0.268
76.8
1,000,000
Stretch
Passed
0.273
75.3
Each row measures the stated fixture. 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.polygonAngle · 1 passing test case, 6 distinct argument descriptions
No. The 1×12 and 3×4 rectangles have equal area and different side lengths. A counterexample disproves the converse.
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 diagram with three to eight named points and a short deduction. Noncollinearity or nonzero lengths are often essential.
Scope of verification. This day asks for a hand argument, construction or interpretation. The worked instance gives the input. General claims need the reasoning shown above. A measured time, memory ceiling or finite input sweep would not verify that claim.
Day 39 / 40 · Proof and applications
Necessary hypotheses
Worked by hand
Problem
Why must a triangle inequality be strict in a construction from three side lengths?
Worked solution
For lengths 2, 3 and 5 the endpoints meet on one line. Equality gives zero area.
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 diagram with three to eight named points and a short deduction. Noncollinearity or nonzero lengths are often essential.
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 · Proof and applications
Coordinate proof
Worked by hand
Problem
Explain why the diagonals of a parallelogram bisect one another using positions 0, u, v and u+v.
Worked solution
Both diagonal midpoints have position (u+v)/2. This vector identity applies to all such parallelograms.
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 diagram with three to eight named points and a short deduction. Noncollinearity or nonzero lengths are often essential.
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.