Skip to main content

algroots

algroots provides exact algebraic computation for polynomial systems, rational functions, finite quotient algebras, function fields, functional decomposition, and algebraic curves. Its polysolve and algsolve interfaces find the roots of exact systems with finitely many complex solutions (zero-dimensional systems). These solvers combine Gröbner and quotient-algebra methods with arbitrary-precision FLINT/Arb root extraction, exact rational univariate representations (RURs) and isolated-root certificates.

Public API

Use groebner_basis, QuotientAlgebra, polysolve, or algsolve from the package root. Certificate constructors and coefficient fields are also available from the package root. Isolated-root certification, direct RUR construction, border bases and continuation tools use their public submodules. See the namespace map for the full API.

Use polysolve for polynomials and algsolve for rational functions, principal rational powers and nested radicals. Solver coefficients must be exact: use sp.Rational(1, 10), instead of 0.1. polysolve and algsolve do not enumerate positive-dimensional solution sets, and inequalities, noisy coefficients, and generic transcendental equations are outside their scope. See the capability matrix and limitations for the distinct contracts of the algebraic interfaces.

Install and run

Python 3.11 or newer is required. The dependencies include SymPy, mpmath, python-flint and algrecognize.

python -m pip install algroots

Native wheels use CPython’s Python 3.11 Stable ABI (cp311-abi3) for GIL-enabled CPython 3.11 and later Python 3.x releases. Wheels remain specific to an operating system and architecture. See native wheels and Python compatibility for supported platforms, source builds and artifact checks.

Solve a polynomial system

import sympy as sp
from algroots import polysolve

x, y = sp.symbols("x y")
result = polysolve((x**2 + y**2 - 3, x * y - 1), (x, y), digits=40, recognize=False)
assert len(result.roots) == result.geometric_solution_count == 4
print(result.roots)
print(result.completeness)

In the result each tuple follows the supplied variable order. .roots stores distinct geometric points with aligned per-root metadata. Use root_mode="with_multiplicity" for repeated-root iteration and .output_roots; .multiplicities reports established local multiplicities. Results use canonical coordinate ordering, with .ordering distinguishing exact ordering from numerical fallback. root_order="required" requires exact ordering within the proof budgets. digits specifies the requested output precision; working precision may increase, and verification_digits controls the numerical residual standard. A small residual by itself is not an exact root or completeness proof.

The automatic dispatch applies guarded exact presolve, deterministic ordering and a grevlex (graded reverse lexicographic) Gröbner basis. Action and RUR share quotient work, and conversion to lexicographic with FGLM occurs only when needed. Cost hints preserve exact fallback checks. See Choosing a Backend.

Preserve branches and poles

import sympy as sp
from algroots import algsolve

x = sp.Symbol("x")
result = algsolve((sp.sqrt(x) - (x - 2),), (x,), digits=40, recognize=False)
assert len(result.roots) == 1
assert abs(result.roots[0][0] - 4) < sp.Rational(1, 10**30)

Squaring also produces x=1, which fails the original principal-square-root equation. algsolve filters such candidates and retains denominator restrictions. Obviously, it cannot recover domain information already removed by SymPy before the input is supplied.

Certify roots and inspect multiplicities

import sympy as sp
from algroots import polysolve

x = sp.Symbol("x")
result = polysolve((x**2,), (x,), recognize=False, certify="required")
assert len(result.roots) == 1
assert result.total_multiplicity == 2 and not result.is_radical
certificate = result.root_certifications[0].certificate
assert certificate.multiplicity == 2 and certificate.verify()

certify="auto" records best-effort proof attempts, while certify="required" raises when a proof cannot be established. Automatic boxes currently require rational coefficients and a globally finite ideal. Exact-point certification also supports algebraic coefficients. Dimension, refinement and box-attempt budgets are explicit.

Recognition is a different operation. By default, solvers attempt exact coordinate recognition through algrecognize, and successful jointly certified tuples appear in recognized_roots. recognize=False disables that post-processing. See Certification Workflow and Reading Results.

Evidence What it establishes
Residual diagnostics Numerical consistency at the verification standard
completeness.status == "conditional" Exact finite count/structure, with numerical extraction assumptions
Exact isolated-root certificate The point satisfies the original equations, is isolated, and has the reported rank/multiplicity
Certified bounded recovery Distinct exact endpoint proofs account for the exact finite-root count
Numerical paths / monodromy stopping Numerical or statistical evidence, but no certified path or infinity accounting

Exact algebra and advanced solving

Task API Guide
Quotient basis, normal forms, matrices, traces QuotientAlgebra Quotient tools
Exact RUR and exact algebraic points compute_rational_univariate_representation, solve_rur_representation RUR
Exact rational border bases compute_border_basis, compute_border_basis_linear Border bases
Singular-root proof and exact local deflation certify_isolated_root, deflate_isolated_root Singular certification
Bounded endgame/deflation/chart recovery polysolve(method="homotopy", homotopy_recovery=True) Recovery
Numerical projective tracking projective_homotopy, track_projective_path Chart switching
Seeded numerical monodromy discover_monodromy_orbit Monodromy

Functional decomposition, fields, and curves

Algebraic methods also address structural questions for which enumerating roots is not the goal:

Question Expert API Guide
Can a rational function be written as a composition of simpler rational functions? algroots.functional_decomposition.rational_decompose, rational_decomposition_chain Functional decomposition
Does an algebraic relation admit a compositional factorization, possibly over a coefficient extension? algroots.functional_decomposition.algebraic_decompose, discover_algebraic_factors Functional decomposition
What subfield is generated by a collection of algebraic or rational elements? QuotientAlgebra.subfield, algroots.function_fields.coefficient_field, luroth_generator Generated subfields
What is the geometric genus of a plane curve, and does it have a rational parametrization? algroots.curves.PlaneCurve Curve geometry
How can a finite quotient algebra be decomposed into local factors or reduced? algroots.finite_decomposition.primary_decomposition, reduced_algebra, nilradical_basis Finite algebras
How can one construct a finite coefficient field and factor polynomials over it? algroots.finite_fields.finite_field, factor_univariate Finite algebras

These specialized APIs use exact coefficients and explicit search limits. Successful decompositions carry identities that can be checked. Plane-curve operations are distinct from solving a positive-dimensional system by listing all its points.

Ordinary method="homotopy" targets regular square systems whose required Bézout paths reach finite nonsingular endpoints. Recovery is opt-in, sequential, rational-coefficient and bounded. It adds a finite quotient for proof accounting, preserves successful endpoint proofs across retries, and reports unresolved paths. Homotopy is not selected by auto.

Numerical precision and stopping

Numerical precision and integer budgets follow a common contract: nonzero coordinate components are preserved, root comparisons are relative to coordinate scale, and univariate Arb retries respect the working precision ceiling. Monodromy curvature stopping is a heuristic and gives no completeness evidence. See precision and conditioning and continuation and monodromy.

Choose a task

Task Guide
Solve exact equations Quick start
Reduce polynomials, eliminate variables, or change order Gröbner bases
Construct a finite quotient Quotient tools
Configure precision, budgets, and recovery Solver settings
Set a complete calculation deadline Supervised execution

Gröbner bases

algroots.groebner_basis(polynomials, variables, *, domain=None, order="grevlex", backend="native", limits=None, execution=None, certificate=None, verification="reference", proof_limits=None) returns a SymPy GroebnerBasis. The default backend="native" uses the compiled modular F4 algorithm over the field of rational numbers ℚ, prime fields, and supported number/parameter fields. Algebraic components require the FLINT native extension. Use backend="sympy" for portable computation without a compiled extension. Native results pass independent exact verification before use. Solvers, quotient and RUR construction, supporting border bases, parameter families and certificate constructors also default to native. Solver and quotient interfaces accept groebner_backend="sympy" for portable construction and groebner_limits for native budgets. Keep in mind that installing the pure Python wheel does not change these defaults.

See coefficient fields and specialization for native reconstruction, FLINT installation, and verified exceptional-fiber conditions.

groebner_backends() reports engine availability, supported domains, accepted limit classes, and installation instructions. SolverOptions groups precision and resource settings; ExecutionLimits can supervise the complete calculation, including verification.

See the Gröbner guide for examples, a backend capability matrix, verification costs, and limits. The support matrix covers the wider package.

Examples and documentation

The examples catalog contains 27 scripts covering solving, branch filtering, recognition, quotient caches, RUR, algebraic fields, multiplicities, clusters, diagnostics, border bases, deflation, recovery, charts, monodromy and failures.

python examples/run_all.py
python examples/run_all.py multiplicity_and_boxes.py limits_and_failures.py

Start with Quick Start, Supported Problems, Support Matrix and Reading Results.

The documentation index links every topic, including the API reference, limitations and troubleshooting.

For optional explicit FLINT Gröbner backend over the field of rationals ℚ, with domain guards and performance data, see Gröbner backend. Automatic backend dispatch is unchanged.

Development

python -m pytest
python -m ruff check .
python -m ruff format --check .

Tests execute marked documentation and every catalog example, check navigation and API defaults, compare exact algebra against independent oracles, and exercise adversarial/resource limits. Benchmarks retain exact correctness checks but do not enforce wall-clock thresholds. See Testing and Validation.

License

The package is distributed under the GPL-3.0 license.

Metadata

Release files for algroots 0.4.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for algroots 0.4.1
File Size Uploaded Provenance Actions
algroots-0.4.1.tar.gz 596.5 kB With provenance Details for algroots-0.4.1.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for algroots 0.4.1
File Actions
algroots-0.4.1-py3-none-any.whl Python 3 none any Details for algroots-0.4.1-py3-none-any.whl
algroots-0.4.1-cp311-abi3-win_amd64.whl CPython 3.11 abi3 Windows x86-64 Details for algroots-0.4.1-cp311-abi3-win_amd64.whl
algroots-0.4.1-cp311-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl CPython 3.11 abi3 Linux glibc 2.27+ x86-64, Linux glibc 2.28+ x86-64 Details for algroots-0.4.1-cp311-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
algroots-0.4.1-cp311-abi3-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl CPython 3.11 abi3 Linux glibc 2.28+ ARM64, Linux glibc 2.27+ ARM64 Details for algroots-0.4.1-cp311-abi3-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
algroots-0.4.1-cp311-abi3-macosx_14_0_x86_64.whl CPython 3.11 abi3 macOS 14.0+ x86-64 Details for algroots-0.4.1-cp311-abi3-macosx_14_0_x86_64.whl
algroots-0.4.1-cp311-abi3-macosx_14_0_arm64.whl CPython 3.11 abi3 macOS 14.0+ ARM64 Details for algroots-0.4.1-cp311-abi3-macosx_14_0_arm64.whl

Total release size: 76.3 MB

Release files / algroots-0.4.1.tar.gz

Download URL algroots-0.4.1.tar.gz
Size 596.5 kB
Tags Source
SHA-256 checksum
How to use checksums
1c564ff767fb94cd8e9645aec333c86498fbfaaf0ca4095543fc1ecae45f8044
BLAKE2b-256 checksum
How to use checksums
89ca861879e2d67e5ffcb123fba27f5d9bd58de6e6fcd5682bbd4f6da8a20b4e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Release files / algroots-0.4.1-py3-none-any.whl

Download URL algroots-0.4.1-py3-none-any.whl
Size 498.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d8d1ad69b9be66b39ab743e808d4118bb8cde39931d04e451d9c8a32dcdd2407
BLAKE2b-256 checksum
How to use checksums
28c6ee974eb694f1ec009f714c00314457b4a2eae54988c17eebbeff4cc3e211
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Release files / algroots-0.4.1-cp311-abi3-win_amd64.whl

Download URL algroots-0.4.1-cp311-abi3-win_amd64.whl
Size 6.3 MB
Tags CPython 3.11 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
9e296443788922974c5ed857262d22621500f46f05953bc93253d2a7ee940f87
BLAKE2b-256 checksum
How to use checksums
04e3973389d69af0393e30831e5014c74dcc3ff4648ae701a8f8fa0a113d3306
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Release files / algroots-0.4.1-cp311-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

Download URL algroots-0.4.1-cp311-abi3-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl
Size 27.7 MB
Tags CPython 3.11 Linux glibc 2.27+ x86-64 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
ef469b555cfca4a295205cc5e9a7f9ae68b7b68ff14584dc7971d855e45d1173
BLAKE2b-256 checksum
How to use checksums
03f81f9230aa469f74a493e685fe9696302706aa0a04a31ffad73c4c6b8e98f2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Release files / algroots-0.4.1-cp311-abi3-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl

Download URL algroots-0.4.1-cp311-abi3-manylinux_2_27_aarch64.manylinux_2_28_aarch64.whl
Size 28.2 MB
Tags CPython 3.11 Linux glibc 2.27+ ARM64 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
74a5763c067d293614854fc6cb902c09e28c0f18b3d5a70b77db1b5bbb1fe3f5
BLAKE2b-256 checksum
How to use checksums
175e49b6f81eb10d702ccbf02c5dbe2ea92cd6b27daf77091cf19ef4a76b74e7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Release files / algroots-0.4.1-cp311-abi3-macosx_14_0_x86_64.whl

Download URL algroots-0.4.1-cp311-abi3-macosx_14_0_x86_64.whl
Size 6.9 MB
Tags CPython 3.11 abi3 macOS 14.0+ x86-64
SHA-256 checksum
How to use checksums
288729e78f9ad6bc8802fd5f1c881ecec5214cd7a2f4ef8e01828c63ef06af2c
BLAKE2b-256 checksum
How to use checksums
0c8dda0b90eaf8bccaee07cdf163145951148e818578fafcd9cfad8078e4052a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Release files / algroots-0.4.1-cp311-abi3-macosx_14_0_arm64.whl

Download URL algroots-0.4.1-cp311-abi3-macosx_14_0_arm64.whl
Size 6.1 MB
Tags CPython 3.11 abi3 macOS 14.0+ ARM64
SHA-256 checksum
How to use checksums
375375cae2c1c4321de3ca36b31ee9b37252b482f282f71d98a125990232d43a
BLAKE2b-256 checksum
How to use checksums
4ede1f5a80824c9a6a963db82d1d309a3c1d16e4e348798a0552778e562f61a9
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

Security for algroots 0.4.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

Full provenance

All 7 files in this release have been uploaded with provenance metadata.

Select from 7 files

Attestation for algroots-0.4.1.tar.gz

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 12, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page