Skip to main content

sagebrush

Fast, certified engines for research mathematics, in Rust, for Python. Permissively licensed (MIT OR Apache-2.0): use them anywhere, in anything, from agents and notebooks to products. No C libraries; one abi3 wheel per platform covers Python 3.9 and later.

This is an early release of Sagebrush, which also runs in the browser at sagebrush.space.

>>> from sagebrush import nf, mf, ap, poly

>>> nf.bnf([-11, 0, 0, 1])              # Q[x]/(x^3 - 11): class group, regulator
{'cyc': [2], 'degree': 3, 'disc': -3267, 'h': 2, 'r1': 1, 'r2': 1, 'regulator': '5.5872066260609077619', 'w': 2}

>>> nf.factor_integer(2**128 + 1)       # ECM
[(59649589127497217, 1), (5704689200685129054721, 1)]

>>> nf.primes_above([-11, 0, 0, 1], 5)  # 5 = P_1 P_2 with residue degrees 1, 2
[{'e': 1, 'f': 1, 'p': 5, 'pi': [-1, 1, 0], 'pi_den': 1}, {'e': 1, 'f': 2, 'p': 5, 'pi': [1, 1, 1], 'pi_den': 1}]

>>> nf.lll([[1, 1, 1], [-1, 0, 2], [3, 5, 6]])
[[0, 1, 0], [1, 0, 1], [-1, 0, 2]]

>>> poly.factor([5, -1, -1, 1])         # x^3 - x^2 - x + 5 over Z
(1, [([5, -1, -1, 1], 1)])

>>> d = mf.newforms(389, 2, bound=6)    # newform orbits of S_2(Gamma0(389))
>>> d["status"], [(o["letter"], o["dim"]) for o in d["newforms"]]
('proven', [('a', 1), ('b', 2), ('c', 3), ('d', 6), ('e', 20)])

Polynomials are coefficient lists, constant term first.

Sage-compatible: sagebrush.sage

For Sage users, sagebrush.sage is a namespace with Sage's names, behaviour and printing, for what Sagebrush implements: number fields, polynomials, matrices, modular forms and symbols, elliptic curves, Dirichlet characters, integers, plotting.

>>> from sagebrush.sage import *
>>> factor(2026)
2 * 1013
>>> x = PolynomialRing(QQ, 'x').gen()
>>> K = NumberField(x**3 + 17*x + 1, 'a')
>>> K.class_group()
Class group of order 3 with structure C3 of Number Field in a with defining polynomial x^3 + 17*x + 1
>>> K.regulator()
2.83341678218613
>>> K.factor(11)
(Fractional ideal (11, a + 3))^2 * (Fractional ideal (11, a + 5))
>>> Integer(2026).is_prime(), Integer(2026) / 4
(False, 1013/2)
>>> EllipticCurve('389a1').rank()
2

This is plain Python, without Sage's preparser: write x**3 (x^3 is xor in Python, and raises an error here as in Sage), Integer(2)/3 for a rational (2/3 is a float), and K = NumberField(f, 'a'); a = K.gen() for K.<a> = NumberField(f). Integers from Integer(n) or ZZ(n) have Sage's methods. The output is checked line by line against Sage itself: Sage's own preparser turns Sagebrush's Sage test files into plain Python, and their output under sagebrush.sage must equal Sage's.

Engines

  • sagebrush.nf: number fields: maximal orders, prime ideals, class groups, units and regulators (assuming GRH, with a field-specific bound for the generators), quadratic class groups to |D| ~ 10^60; integer factoring (ECM); Hermite and Smith forms, LLL; complex roots to any precision.
  • sagebrush.mf: modular forms of weight k >= 2 with character: dimensions, exact Hecke characteristic polynomials, newform orbits, trace forms.
  • sagebrush.modsym: weight-2 modular symbols for Gamma0(N).
  • sagebrush.ap: traces of Frobenius a_p of elliptic curves over Q.
  • sagebrush.poly: factoring in Z[x] and F_p[x].

Results are checked against independent systems: PARI for class groups, Sage and Magma for the rest, and LMFDB for modular forms.

License

Copyright (c) 2026 SageMath, Inc. Licensed under either of the Apache License, Version 2.0 or the MIT license, at your option.

Metadata

Release files for sagebrush 0.3.0

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

Source distribution (sdist)

Source distribution for sagebrush 0.3.0
File Size Uploaded
sagebrush-0.3.0.tar.gz 480.4 kB Details

Built distributions (wheels)

Table of built distributions (wheels) for sagebrush 0.3.0
File
sagebrush-0.3.0-cp39-abi3-win_amd64.whl CPython 3.9 abi3 Windows x86-64 Details
sagebrush-0.3.0-cp39-abi3-manylinux_2_28_x86_64.whl CPython 3.9 abi3 Linux glibc 2.28+ x86-64 Details
sagebrush-0.3.0-cp39-abi3-manylinux_2_28_aarch64.whl CPython 3.9 abi3 Linux glibc 2.28+ ARM64 Details
sagebrush-0.3.0-cp39-abi3-macosx_11_0_arm64.whl CPython 3.9 abi3 macOS 11.0+ ARM64 Details
sagebrush-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl CPython 3.9 abi3 macOS 10.12+ x86-64 Details

Total release size: 7.4 MB

Release files / sagebrush-0.3.0.tar.gz

Download URL sagebrush-0.3.0.tar.gz
Size 480.4 kB
Tags Source
SHA-256 checksum
How to use checksums
1f93abbd88db5f830438ea1f529adcfa2269bc5d45feb85aabd57c12c01597a6
BLAKE2b-256 checksum
How to use checksums
af532837a66fcaffadfda9393bc441f25bd945eb2a717afb280ad1695992f281
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 6, 2026.

Transparency log

Release files / sagebrush-0.3.0-cp39-abi3-win_amd64.whl

Download URL sagebrush-0.3.0-cp39-abi3-win_amd64.whl
Size 1.4 MB
Tags CPython 3.9 Windows x86-64 abi3
SHA-256 checksum
How to use checksums
8621175aa1c2a30a4e088101ee926eb3ac711086c57c0b2ec25fd039fed754bf
BLAKE2b-256 checksum
How to use checksums
887750b24b39e7ce88310ad419d45ec90c719ddc6b13186f749e83e6b233b739
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 6, 2026.

Transparency log

Release files / sagebrush-0.3.0-cp39-abi3-manylinux_2_28_x86_64.whl

Download URL sagebrush-0.3.0-cp39-abi3-manylinux_2_28_x86_64.whl
Size 1.5 MB
Tags CPython 3.9 Linux glibc 2.28+ x86-64 abi3
SHA-256 checksum
How to use checksums
ac2b7d8f6a5098c4712835f5999aba336594d8eadf033f6a7e5f9110e6228734
BLAKE2b-256 checksum
How to use checksums
fb6b1244d89cb8fd0899174e21dd285f260821991121e9e6415b432f0b4d0861
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 6, 2026.

Transparency log

Release files / sagebrush-0.3.0-cp39-abi3-manylinux_2_28_aarch64.whl

Download URL sagebrush-0.3.0-cp39-abi3-manylinux_2_28_aarch64.whl
Size 1.3 MB
Tags CPython 3.9 Linux glibc 2.28+ ARM64 abi3
SHA-256 checksum
How to use checksums
b8d5a23d7c52e36e2c66e06bc10c4fb052c04ebd86531958f2c5a07fd0bf6d60
BLAKE2b-256 checksum
How to use checksums
d7a8df37f503467dc6567d0a6bf929a4b432d02c6b1a66e99509c7d341e03783
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 6, 2026.

Transparency log

Release files / sagebrush-0.3.0-cp39-abi3-macosx_11_0_arm64.whl

Download URL sagebrush-0.3.0-cp39-abi3-macosx_11_0_arm64.whl
Size 1.3 MB
Tags CPython 3.9 abi3 macOS 11.0+ ARM64
SHA-256 checksum
How to use checksums
0b064889f0b6ad27bde33621959d8e3e8efa1ce8f6bb1496412e8781b16bb797
BLAKE2b-256 checksum
How to use checksums
aca14c89b9f4d799f2ecbb38f6cbcd6a2827b838e9e5553f8a3e786c0b5ba680
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 6, 2026.

Transparency log

Release files / sagebrush-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl

Download URL sagebrush-0.3.0-cp39-abi3-macosx_10_12_x86_64.whl
Size 1.4 MB
Tags CPython 3.9 abi3 macOS 10.12+ x86-64
SHA-256 checksum
How to use checksums
0bd0dc7c46e5685e8913b28fb7da35732780f8f635a701c84e5ad27a008f28d9
BLAKE2b-256 checksum
How to use checksums
54a0f5b151a30f814801142baffe661a341eaeb686c4b0adc439abc0816af863
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

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 Oct 6, 2026.

Transparency log

Release history Release notifications | RSS feed

0.7.2

6 release files

0.7.1

6 release files

0.7.0

6 release files

0.6.0

6 release files

0.5.1

6 release files

0.5.0

6 release files

0.4.0

6 release files

This release

0.3.0 This release

6 release files

0.2.2

6 release files

0.2.1

6 release files

0.2.0

6 release files

0.1.0

6 release files

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