Installation

Install Symbolica for Python, Rust, or C++, try the live demo, and choose the best language binding for your workflow.

Use Symbolica from Python for a fast, notebook-friendly computer algebra system, or from Rust when you want maximum control and performance. The C/C++/Mathematica bindings currently expose fast multivariate polynomial arithmetic.

What language should I use?

Choose Python if you want the shortest path to symbolic manipulation, notebooks, and quick experiments. Choose Rust if you are building new features, tuning data structures, or pushing for the highest performance. Rust gives you the most flexibility, at the cost of more verbose code.

For interactive use through notebooks, the recommended setup is Visual Studio Code with the Jupyter extension, or Marimo with the ty language-server extension. With this setup you get inline documentation, auto-completion, and LaTeX/Typst rendering of output.

Live demo

Want to try Symbolica before installing it? Open the Google Colab notebook or Marimo notebook and run the examples in your browser.

You can edit the code and run it on Google Colab/Marimo without touching your local machine.

There is also a CERN video tutorial.

Installation

Already using Symbolica 1.5? See the migration guide for the 2.0 API changes.

Install Symbolica for Python with pip on all major 64-bit platforms:

pip install symbolica

Check that the import works:

from symbolica import *

If this returns without an import error, you are ready to go.

Use maturin if you want to build the Python package yourself:

git clone https://github.com/benruijl/symbolica.git
cd symbolica
maturin build --release

Then install the wheel with pip:

pip install target/wheels/symbolica-VERSION.whl
Windows source builds

On Windows, build from MSYS2. Install m4, git, gcc, rust, and maturin. When you call maturin, put a vanilla Windows Python installation at the start of your path:

PATH="C:\\Users\\benru\\AppData\\Local\\Programs\\Python\\Python311":$PATH maturin build --release

Add Symbolica to your Rust project:

cargo add symbolica

That is all you need on macOS or Linux. On Windows, use the setup below.

Symbolica uses native C/C++ dependencies. On Windows, pair the Rust GNU target with MSYS2 MinGW64.

1. Install the Rust GNU toolchain. Run in PowerShell:

rustup toolchain install stable-x86_64-pc-windows-gnu
rustup default stable-x86_64-pc-windows-gnu

2. Install MinGW64. Install MSYS2, then open the MSYS2 MinGW x64 terminal and run:

pacman -Syu
pacman -S --needed diffutils m4 make mingw-w64-x86_64-toolchain

3. Add MSYS2 to your user PATH. Run in PowerShell (adjusting the path when needed):

$add = @("C:\msys64\mingw64\bin", "C:\msys64\usr\bin")
$current = [Environment]::GetEnvironmentVariable("Path", "User")
$new = (($current -split ";" | Where-Object { $_ }) + $add | Select-Object -Unique) -join ";"
[Environment]::SetEnvironmentVariable("Path", $new, "User")

Then close and reopen PowerShell, VS Code, or any terminal.

Build the Symbolica library:

git clone https://github.com/benruijl/symbolica.git
cd symbolica
cargo rustc --release --crate-type=cdylib

This generates a dynamically linked library. Use --crate-type=staticlib to build a static library instead.

Now try the C interface:

test.c
#include <stdio.h>

typedef struct SYMBOLICA* Symbolica;

extern Symbolica *init();
extern void set_vars(Symbolica* symbolica, const char *vars);
extern void set_options(Symbolica *symbolica, const bool input_has_rational_numbers, bool exp_fits_in_u8);
extern char* simplify(Symbolica* symbolica, const char *input, unsigned long long prime, char explicit_rat);
extern void drop(Symbolica *symbolica);


int main() {
    char* in = "(x+5)/(x+6) + 35/y";
    char* in2 = "(x*y^2*5+5)^2/(2*x+5)+(x+4)/(6*x^2+1)";

    Symbolica* s = init();
    set_vars(s, "x,y,z");
    char* out = simplify(s, in, 0, 1);
    printf("%s\n", out);

    out = simplify(s, in2, 5, 1);
    printf("%s\n", out);

    drop(s);

    return 0;
}

Compile it with dynamic linking:

gcc -O3 test.c -L target/release -lsymbolica -o test

or static linking:

gcc -O3 test.c -L target/release -l:libsymbolica.a -lm -o test
test.cpp
#include <iostream>

typedef struct SYMBOLICA *Symbolica;

extern "C"
{
    extern Symbolica *init();
    extern void set_vars(Symbolica *symbolica, const char *vars);
    extern void set_options(Symbolica *symbolica, char input_has_rational_numbers, char exp_fits_in_u8);
    extern const char *simplify(Symbolica *symbolica, const char *input, unsigned long long prime, char explicit_rat);
    extern void drop(Symbolica *symbolica);
}

int main()
{
    const char *in = "(x+5)/(x+6) + 35/y";
    const char *in2 = "(x*y^2*5+5)^2/(2*x+5)+(x+4)/(6*x^2+1)";

    Symbolica *s = init();
    set_vars(s, "x,y,z");
    const char *out = simplify(s, in, 0ull, 0);
    std::cout << out <<  std::endl;

    out = simplify(s, in2, 5ull, 0);
    std::cout << out <<  std::endl;

    drop(s);

    return 0;
}

Compile it with dynamic linking:

g++ -O3  test.cpp -L target/release -lsymbolica -o test

or static linking:

g++ -O3  test.cpp -L target/release -l:libsymbolica.a -lm -o test

Running ./test should print the following. For dynamic linking, use LD_LIBRARY_PATH=target/release ./test.

(210+5*y+35*x+x*y)/(6*y+x*y)
(-1+x)/(1+x^2)

License

Choose your license

Hobbyist or student

A free annual key for eligible users.

Get free key →

Professional trial

Unrestricted Symbolica, free for 30 days.

Start trial →

Organization member

Get a personal key under your organization's license.

Get personal key →
Restricted mode · No signup needed

Free for non-commercial work, with one instance and one core per device. Symbolica is optimized for strong single-core performance, so this is still useful for many academic and other non-commercial tasks.

Commercial work requires a professional license. Unsure whether you qualify? Contact us.

To hide the startup banner, set the environment variable:

SYMBOLICA_HIDE_BANNER=1

Activate your license

To use a license key, set the SYMBOLICA_LICENSE environment variable:

SYMBOLICA_LICENSE=abe2d4f1-3251-5377-b175-ca1912beb982

Alternatively, set it at the start of your program before calling any other Symbolica functions:

from symbolica import *
set_license_key("abe2c4f1-3351-5477-b075-cb1962beb982")

x = S('x')

Make sure to call set_license_key before importing any community modules:

from symbolica import *
set_license_key("abe2c4f1-3351-5477-b075-cb1962beb982")
from symbolica.community.spenso import * # noqa: E402
use symbolica::prelude::*;

fn main() {
    LicenseManager::set_license_key("abe2c4f1-3351-5477-b075-cb1962beb982").unwrap();
    let x = parse!("x");
}
extern int set_license_key(const char *key);

int main() {
    set_license_key("abe2c4f1-3351-5477-b075-cb1962beb982");
}

License keys also work offline.

Lost or renewed your key?

Resend it online →

Alternatively, resend your key using Python or Rust
from symbolica import *
get_license_key('YOUR_EMAIL')
use symbolica::prelude::*;

fn main() {
    LicenseManager::get_license_key("Email").unwrap();
}

Next, work through First steps for a compact tour of common Symbolica operations.

API reference

Use an IDE such as Visual Studio Code to get inline documentation and auto-completion:

A demo of Symbolica

The language-specific API references are here:

The full Python API reference is available here.

Read the Rust API on docs.rs and browse the examples.

Learn more

Good next steps:

  • Browse this guide for more Symbolica features.
  • Follow the project on GitHub to see what changed.
  • Read developer and Rust documentation on docs.rs.
  • Follow the development and discussions on Zulip and Discord.
  • Read the blog for computer algebra notes and deep dives into Symbolica internals.