Polynomial algebra in Mojo¶
Poly Mojo brings exact algebra and arbitrary-precision numerical computation together in one pure Mojo library. It includes polynomial arithmetic, calculus, interpolation, factorization, Gröbner bases, real and complex roots, exact algebraic numbers, and cylindrical algebraic decomposition. Build polynomials from coefficient sequences or sparse power tuples, and use certificates and interval enclosures to check the claims your calculation depends on.
The library is pure Mojo and builds on apn_mojo, with no foreign algebra library. Start with an exact calculation, then add numerical precision or certificate checking where your application needs it.
Start with a calculation¶
The array tutorial constructs polynomials from coefficients, evaluates them, and differentiates sparse terms. It introduces inferred domains and optional work limits through a complete, checked program.
| What you want to do | Where to go |
|---|---|
| Choose exact, rounded, or interval coefficients | Coefficient domains |
| Choose storage and understand coefficient order | Polynomial arrays |
| Divide and find common factors | Exact algebra |
| Simplify fractions or find residues | Rational functions |
| Factor a polynomial | Factorization |
| Differentiate, integrate, and substitute | Calculus, substitution |
| Reconstruct a polynomial from samples | Interpolation |
| Use Newton, Chebyshev, or Bernstein coefficients | Alternative bases |
| Compute a truncated expansion | Formal power series |
| Find exact real and complex roots | Roots |
| Evaluate with arbitrary precision and interval bounds | Numerical coefficients |
| Apply a function across polynomial batches | Maps and broadcasting |
| Save and restore coefficients | Canonical serialization |
| Find and refine validated real or complex roots | Numerical root covers |
| Reduce polynomial systems | Gröbner bases and membership |
| Compute with algebraic values or decompose real space | Algebraic coefficients, CAD |
Understand the result¶
An exact polynomial represents a single mathematical polynomial. A numerical point polynomial uses rounded coefficients; a ball polynomial represents a family of possible coefficients. These choices affect which algorithms apply and what an answer means. The domain guide helps you choose.
A certificate contains evidence for a particular claim. For example, a factorization product checker verifies that the proposed factors multiply back to the input; it does not prove their irreducibility. The certificate guide explains these boundaries and the separate guarantees of numerical enclosures and root covers.
Computational operations take a shared Budget. Numerical searches also
accept accuracy and subdivision settings. See budgets and errors
for handling work exhaustion and inconclusive numerical outcomes.
Learn how it works¶
The architecture overview explains the package's layers and data flow. The mathematical chapters give algorithms, proofs, and certificate relations. The core API documents mutable polynomial values and the underlying algebra operations.
See the example gallery for complete programs and support and limitations for the current scope.
Continue with numerical arrays, batch maps and broadcasting, or saving coefficient data.