RatMath Shelf

RatMath Shelf

A shelf of subject libraries, each built on exact numbers.

One library for each part of mathematics, for JavaScript. Each one gives a fast preview first and then an answer that is exact, or an interval proven to contain the truth. This page lists what is on the shelf today and what is planned. To have all of it in one import, use the ratmath package.

The foundation

Everything on the shelf stands on Core.

RatMath Core

@ratmath/core

Exact integers, fractions and rational intervals for JavaScript, with certified approximations, regions, number literals in any base and the R template for writing exact expressions. BigInt-based, with no dependencies.

R`1/3 + 1/6`        // 1/2, exactly
R`0.#3`             // 1/3
R`1.2[3:6]`         // 1.23 to 1.26

On the shelf

Built, tested and documented. Each topic links to its page, which ends with code you can run.

AnalyticAvailable

@ratmath/analytic

Calculus with proven error bounds: every value is an interval guaranteed to contain the true answer.

AlgebraicAvailable

@ratmath/algebraic

Exact algebraic numbers such as √2 + ∛5, and the polynomials, fields and groups around them.

Linear algebraAvailable

@ratmath/linalg

Exact linear algebra over the rationals and beyond, with float previews that sharpen to exact results.

GraphicsAvailable

@ratmath/graphics

Pictures that do not lie: graphs, regions and geometry whose features are proven before they are drawn, and the pictures for the rest of the shelf: statistics and finance charts, graphs and logic diagrams, dynamics, differential equations and numerical methods.

StructuresAvailable

@ratmath/structures

Abstract algebra. Built so far: finite groups (classes, subgroups, quotients, Sylow subgroups, homomorphisms, actions and counting), presentations, abelian groups and modules, character tables, large permutation groups, polynomials in several variables with exact coefficients and the fractions made from them, ideals and Gröbner bases, rings of numbers, and field extensions with Galois groups, radicals and constructions.

Symbolic algebraAvailable

@ratmath/symbolic

Algebra on expressions, with every step checked by the certified libraries. Expressions, assumptions, rewriting and equality; solving equations and inequalities, with every family of solutions of a trigonometric equation; systems of equations; antiderivatives, limits, expansions and sums in closed form; and the checked steps behind every answer.

  • ExpressionsThe shared tree: writing, substituting, differentiating, evaluating.
  • AssumptionsSay what the letters stand for, and prove signs from it.
  • Normal formsExpand, factor, collect; roots, logs and sines reduced exactly.
  • RulesRewriting rules that carry their conditions and are checked when used.
  • EqualityProven equal, proven different, or undecided.
  • Solving equationsEvery candidate checked in the original equation; failures reported.
  • Trigonometric equationsEvery family of solutions, letters with their conditions, families merged.
  • Systems of equationsElimination with letters, families of solutions, substitution and resultants.
  • InequalitiesCritical points, the sign on each piece, the set where it holds.
  • AntiderivativesThe methods of the course, each result differentiated before it is returned.
  • LimitsClosed forms, confirmed by certified enclosures.
  • ExpansionsTaylor and Laurent expansions with exact coefficients.
  • SumsSums of powers, geometric and telescoping sums, famous series, each proven.
  • Step recordsThe checked steps behind every answer, for an app to show.

ComplexAvailable

@ratmath/complex

Complex numbers that say which branch they took, complex analysis with proofs, and quaternions and octonions: exact complex numbers, certified functions with branch reporting, Möbius maps on the Riemann sphere, Taylor models on discs, contour integrals, zeros counted and found, residues, the gamma and zeta functions, and the Cayley–Dickson numbers.

Discrete mathematicsAvailable

@ratmath/discrete

Combinatorics, graphs and games. Built so far: exact counting, families of objects you can list, rank and unrank, a seeded random generator, graphs with exact weights (connectivity, shortest paths, tours and trees), exact linear programming with matrix and bimatrix games, generating functions and recurrences with exact closed forms, matchings and flows, colouring, planarity, isomorphism and spectra, combinatorial and cooperative games and voting, relations, orders and Pólya counting, and error-correcting codes and designs, each answer with its certificate. Graphics draws the graphs.

  • CountingBinomials, Stirling and Bell numbers, partitions, Catalan numbers, all exact.
  • Inclusion and exclusionThe sieve formula with its terms shown, and the pigeonhole principle.
  • Enumeration and rankingPermutations, subsets, partitions and more: the object at any position, and the position of any object.
  • Seeded randomA generator that repeats exactly from its seed, with unbiased draws from any family.
  • GraphsGraphs written as text, exact weights, the standard families, products and line graphs.
  • ConnectivityComponents, bridges, strong components, topological order, two-colouring with an odd cycle as the reason.
  • Shortest pathsDijkstra, Bellman–Ford and Floyd–Warshall with exact distances; a negative cycle when there is one.
  • Euler and HamiltonEvery edge once by Hierholzer; every vertex once by exhaustive search.
  • TreesMinimum spanning trees, the matrix-tree theorem, Prüfer codes.
  • Linear programmingAn exact simplex method; every answer with its proof: dual prices, a Farkas vector or a ray.
  • Integer programsBranch and bound on exact relaxations.
  • Matrix gamesZero-sum games: optimal mixed strategies and the value as fractions.
  • Bimatrix gamesDominance, every Nash equilibrium, Lemke–Howson.
  • Generating functionsExact power series: products, reciprocals, composition, exp and log, EGFs.
  • RecurrencesClosed forms with exact algebraic roots, guessing a recurrence, closed sums, the master theorem.
  • Matchings and flowsBlossoms with a Tutte–Berge proof, König and Hall, assignment, stable matching, max flow and min cut.
  • Colouring and cliquesThe chromatic number with the reason no fewer colours work; the chromatic polynomial.
  • PlanarityFaces for a planar graph, a Kuratowski subdivision for one that is not.
  • Isomorphism and spectraColour refinement, automorphism groups, exact eigenvalues, walks and spanning trees.
  • Combinatorial gamesSprague–Grundy, nim, Conway's numbers, nimbers and up, backward induction.
  • Cooperative games and votingShapley values, the core or a proof it is empty, voting power, voting methods, apportionment.
  • Relations and ordersProperties with counterexamples, Dilworth, linear extensions, Möbius functions, lattices.
  • Pólya countingColourings up to symmetry: Burnside's lemma and the cycle index.
  • Error-correcting codesLinear codes with syndrome decoding in steps, Hamming codes, bounds, Reed–Solomon.
  • Latin squares and designsOrthogonal Latin squares, block designs, finite planes, Steiner triple systems.

Number theoryAvailable

@ratmath/numtheory

Number theory with proofs attached: primes with certificates checked by an independent verifier, factoring, congruences, reciprocity, sums of squares, Diophantine and Pell equations, continued fractions, quadratic forms and p-adic numbers; elliptic curves, with the elliptic curve method and curve-based primality certificates; rings of integers, prime ideals, class groups and units of number fields; and prime counting, Dirichlet characters, and zeta and L values.

  • Primes and certificatesProven below 2⁶⁴, certified above, refused when no proof is found.
  • FactoringTrial division, Pollard rho and p − 1, with proven prime factors.
  • Arithmetic functionsσ, φ, μ and friends; perfect and amicable numbers; Möbius inversion.
  • CongruencesThe Chinese remainder theorem for any moduli, Hensel lifting, primitive roots.
  • Quadratic reciprocityLegendre, Jacobi and Kronecker symbols, with the steps written out.
  • Sums of squaresTwo, three and four squares, Jacobi's counts, Pythagorean triples.
  • Linear equationsEvery integer solution as a lattice, Frobenius numbers, Egyptian fractions.
  • Continued fractionsExact expansions, periodic quadratic irrationals, fundamental units.
  • Pell equationsx² − Dy² = N: every class of solutions.
  • Quadratic formsReduction with proof, composition, class groups and their structure.
  • p-adic numbersLazy exact digits, square and Hensel roots, exp and log.
  • Elliptic curvesThe group law over Q, torsion, minimal models, reduction, and proven height bounds.
  • Counting pointsCurves over F_p: Hasse’s bound, baby steps and giant steps, Schoof’s algorithm.
  • The elliptic curve methodLenstra’s method: many groups instead of one, and the factors of F₇.
  • Elliptic curve certificatesAtkin–Morain proofs for primes that n − 1 cannot certify, checked independently.
  • Rings of integersIntegral bases by the Round 2 algorithm, discriminants, the index.
  • Prime idealsHow primes split, ramify or stay inert; unique factorisation of ideals.
  • Class groupsClass numbers and group structure, proven without the Riemann hypothesis.
  • UnitsDirichlet’s theorem, roots of unity, fundamental units and the regulator.
  • Counting primesπ(10¹²) in a second: Legendre’s φ and Meissel’s formula.
  • Dirichlet charactersConrey’s numbering, exact values, conductors, Gauss sums, orthogonality.
  • Zeta and L valuesExact values from Bernoulli numbers, proven enclosures in the whole plane.

LogicFirst parts available

@ratmath/logic

Formal logic you can compute with: valid with a proof, invalid with a countermodel, or unresolved. Built so far: propositional logic and four proof systems with checkers, proof search and hints; predicate logic with finite models and quantifier proofs; circuits, syllogisms and modal logic; automata, grammars and machines. Ordinals, cardinals and Peano arithmetic are planned.

  • FormulasA parser for what people type; printing in Unicode, ASCII and TeX.
  • Truth tablesFull tables with a column for each part, and model counts.
  • Normal formsNegation, conjunctive and disjunctive forms, and the Tseitin form.
  • Satisfiability and validityEach answer comes with a model or a refutation that is checked.
  • SimplificationShortest two-level forms by the Quine–McCluskey method.
  • Natural deductionA proof checker that names the line, the rule and what was missing.
  • Sequent calculusClassical and intuitionistic derivations, with Kripke countermodels.
  • Truth treesTrees that close to prove validity or stay open with a countermodel.
  • ResolutionThe evidence the solver gives, and a checker for refutations by hand.
  • Proof search and hintsProofs written for you, and hints that give the next line only.
  • Predicate logicQuantifiers, function symbols and identity; substitution without capture; prenex and Skolem forms.
  • Finite modelsTruth in a structure with witnesses, and model search that checks what it finds.
  • First-order proofs and treesQuantifier rules with their conditions on names, and trees that close or give a countermodel.
  • Circuits and Karnaugh mapsAdders, NAND-only circuits, equivalence with a witness, maps grouped into shortest forms.
  • SyllogismsAll 256 moods and figures decided on the Venn diagram, with names and counterexamples.
  • Modal logicKripke models, and validity in K, D, T, B, S4 and S5 with checked countermodels.
  • Automata and regular expressionsMinimal DFAs, equivalence with a shortest distinguishing word, regexes both ways.
  • Grammars and machinesCYK parse trees, pushdown automata, Turing machines, recursive functions.

StatisticsAvailable

@ratmath/stats

Probability and statistics with every answer labelled exact, certified or simulated. Built so far: finite probability, distributions, descriptive statistics, exact tests, data generated from a known model with noise to test what a procedure recovers, the standard tests and intervals, and regression and analysis of variance with exact coefficients, rank tests with exact null laws, the Kolmogorov–Smirnov test, the bootstrap, Markov chains and conjugate Bayesian updating. Graphics draws the charts.

  • Finite probabilitySample spaces, conditioning, expectation and Bayes' rule, in fractions.
  • Discrete distributionsBinomial, hypergeometric and geometric exactly; Poisson certified.
  • Descriptive statisticsExact means and variances, quantiles by named rules, least squares.
  • Exact testsBinomial, Fisher and permutation tests with p-values as fractions.
  • Continuous distributionsNormal, t, chi-square, F, gamma and beta to any precision.
  • Certified answersEnclosures, and comparisons that can be too close to call.
  • Seeded samplingA seeded generator with named streams, and exact rational draws.
  • Models with noiseA known truth disturbed by noise, contamination, censoring and more.
  • ExperimentsCoverage, size, power and bias, each with its own sampling error.
  • Tests for meansz and t tests, paired, Welch and pooled, with exact t² and certified p-values.
  • Variances and proportionsChi-square and F tests for spread; z tests and Wilson intervals for proportions.
  • Chi-square testsGoodness of fit and independence, with Yates' correction and Fisher's test.
  • Fitting distributionsMaximum likelihood and the method of moments for ten families.
  • Testing the testsSeeded experiments check that intervals cover and tests keep their size.
  • Linear regressionExact least squares, prediction intervals, leverage and nested models.
  • Analysis of varianceExact sums of squares, as a regression on indicators, and two factors.
  • Rank testsSign, Wilcoxon, Mann–Whitney, Kruskal–Wallis, Spearman and Kendall, with exact null laws.
  • Kolmogorov–SmirnovOne and two samples, with certified p-values from the exact law.
  • The bootstrapEvery resample enumerated exactly when small, seeded otherwise.
  • Markov chainsClasses, stationary laws, absorption and hitting times, all as fractions.
  • Bayesian updatingBeta, gamma, normal and Dirichlet priors updated exactly.

ChaosAvailable

@ratmath/chaos

Dynamical systems, where exact arithmetic shows the true orbit: maps of the line, with orbits, periodic points, Lyapunov exponents, proven bifurcations and symbolic dynamics; fractals, from iterated function systems and Cantor sets to L-systems; cellular automata; and Mandelbrot, Julia and Newton pictures with every pixel proved or marked undecided. Maps of the plane and flows come with proofs too: periodic points and closed orbits proven to exist, the cat map and the horseshoe done exactly, and equilibria classified with their bifurcations bracketed.

GeometryAvailable

@ratmath/geo

Geometry with exact coordinates, so that collinear, concyclic and tangent are decided: the Euclidean plane with constructions and checked theorems, exact computational and lattice geometry, taxicab geometry, spherical and hyperbolic geometry, the projective plane and finite geometries, and polyhedra, symmetry groups and tilings. Theorems are also proved in general, by algebra, with a certificate.

  • ConstructionsPoints, lines and circles; ruler-and-compass constructions recorded step by step.
  • Triangle centresCentres, circles and lines of a triangle, exactly.
  • TransformationsIsometries, similarities and inversion, classified.
  • Checked theoremsFifteen classical theorems tested exactly on your figure.
  • Proofs of theoremsTwenty-one classical theorems proved for every figure, by Wu's method and Gröbner bases.
  • Computational geometryHulls, polygons, Delaunay and Voronoi with exact predicates.
  • Lattice geometryPick's theorem and points visible from the origin.
  • Taxicab geometrySquare circles, bent bisectors, and where congruence fails.
  • Spherical geometryGreat circles, triangles and their excess, exact trigonometry, rotations.
  • The hyperbolic planeFour models of one plane; exact distance, parallels, circles.
  • Hyperbolic triangles, motions, tilingsDefect as area, isometries classified, the tilings {p, q}.
  • The parallel postulateOne parallel, none, or infinitely many: counted in five geometries.
  • The projective planeDuality, the cross-ratio, projective maps and conics; Desargues, Pappus, Pascal and Brianchon checked exactly.
  • Finite geometriesThe Fano plane, PG(2, q) and AG(2, q) over finite fields, and their collineation groups.
  • PolyhedraPlatonic and Archimedean solids with exact coordinates, volumes, dihedral angles, duals and symmetry groups.
  • Symmetry groupsRosettes, the 7 frieze groups and the 17 wallpaper groups, identified exactly.
  • TilingsThe 21 vertex types of regular polygons, and why only 11 tile uniformly.
  • Pictures of geometryTilings grown from their vertex type, solids, step-by-step constructions, wallpaper and Levi graphs, drawn exactly.

FinanceAvailable

@ratmath/finance

The mathematics of finance with exact money: rounding only by a named rule, rates proven, scenarios projected exactly. Time value, loans, cash flows, bonds, scenarios and seeded repeated runs with uncertain inputs, portfolios, options and life contingencies. Graphics draws the charts.

  • Money and roundingExact amounts, named rounding rules, splits that add up.
  • Dates and day countsCalendar dates and the conventions for a fraction of a year.
  • Time value of moneyInterest, equivalent rates, annuities, solving for what is missing.
  • LoansSchedules to the cent, extra payments, refinancing, revolving credit.
  • Cash flowsNet present value and every internal rate of return, with proof of how many.
  • BondsPrice, yield, accrued interest, duration and convexity.
  • Yield curvesSpot and forward rates from bond prices; immunisation.
  • ScenariosExact projection, what-if comparison and exact sensitivities.
  • Uncertain inputs and repeated runsRandom returns, inflation and events; the chance of running out with an exact interval.
  • PortfoliosThe efficient frontier exactly; long-only portfolios proven optimal; CAPM.
  • OptionsExact break-evens and binomial trees; certified Black–Scholes and implied volatility.
  • Life contingenciesLife tables, annuities, insurances, premiums and reserves, all exact.

Planned

Not built yet. The full plan, with scope and order, is in the library roadmap.

Logic, continuedPlanned

@ratmath/logic

More on top of the logic already built.

  • Ordinals and cardinals
  • Peano arithmetic and Gödel numbering

How the shelf is kept

Every library has the same shape: an overview, a page to explore it without writing code, a detailed reference, and a page for each topic that explains the usage and the mathematics and ends with a runnable code box.

A topic appears under “On the shelf” only when it is built and its page exists. Until then it stays under “Planned” and in the roadmap.

The course guide organizes school and university mathematics into 40-day courses with worked problems, package examples and teaching notes.

The Course Test checks the shelf against school and university mathematics: a twenty-question test for each course, answered by hand and again with the libraries alone, with every disagreement and gap listed.