Sagebrush · Math ecosystems, rewritten to run anywhere

loading…

Sagebrush · Math ecosystems, rewritten to run anywhere

A lightweight, open-source rewrite of the most-used parts of Python, LaTeX, Magma, MATLAB, R and Mathematica-style symbolic math, with research mathematics at its core. Built for AI agents and the people they work with, on Mac, Windows, Linux, in the browser and on your phone.

How it is built

Articles, algorithm by algorithm: what worked, what did not, and why.

Independent and open

MIT or Apache-2.0, written from papers and books. No code from Magma, PARI, Sage, Singular, FLINT or GMP, so when Sagebrush agrees with them, that is independent confirmation.

Use it anywhere

  • Here, in your browser
  • Python: pip install sagebrush
  • Command line: npx sagebrush
  • Agents: llms.txt and an MCP server
Notebook tips
  • The keys are Jupyter's: Shift+Enter runs a cell and moves on, Ctrl/Cmd+Enter runs it in place; Esc is command mode (A/B insert, DD deletes, M/Y switch to Markdown or code, H lists them all); Ctrl+; splits a cell. Drag a cell by its prompt to move it; hover between cells to add one.
  • + Text adds a Markdown cell (headings, lists, tables, links, $math$): Shift+Enter shows it, double-click edits it.
  • Tab after a name completes it (e.Tab lists what e can do); otherwise it indents: press Esc first to Tab out of the cell. File → Print saves the notebook, outputs and all, as a PDF. Variables persist between cells; the Console (in the ⋯ menu) is a scratchpad with its own interpreter.
  • Sage mode: ^ is a power (^^ is xor), 2/3 is an exact rational; factor, is_prime, ModularSymbols, EllipticCurve, polynomial rings, Gröbner bases and symbolic calculus (diff, integrate, solve, desolve) run on Sagebrush's Rust engines.
  • Magma mode: Magma programs are translated to Python in this page and print what Magma prints.
  • MATLAB mode: MATLAB programs are translated to Python in this page, run on Sagebrush's numpy, and print what MATLAB prints; plots and 3-D surfaces too.
  • Python: CPython 3.14's own grammar, with numpy (checked against NumPy itself), matplotlib.pyplot, Sage-style plot, @interact and animate; pure-Python packages such as mpmath pass their own test suites.
  • Notebooks and files are saved in this browser as you work: File opens, downloads and uploads .ipynb; Files lists what Python's open() sees. Your code runs in a Web Worker on this page; your code is not sent to a server.

Examples

Each opens as a new notebook; yours stays saved.

Permissions

File writes

Kept in this browser, for you: never in the notebook, so anyone you send it to starts with nothing allowed.

Sagebrush notebooks are reactive

When you run a cell, the cells that use what it defines run again by themselves, so every result on the page agrees with the code above it. You don't have to remember what to rerun.

Auto sets how long those automatic reruns may take: cells that would take longer wait, marked stale, and Run stale runs them when you're ready. Always reruns everything that depends on a change; Never reruns nothing by itself.

How cells run

Share

Your shares

Download with its files

This notebook and the files you check, as one .zip.


  
In a cell, name? shows this, name?? the source.
Notebooks in this browser