Skip to content

ellisonbg/uhlenbeck

Repository files navigation

Uhlenbeck

A Rust + Python symbolic computer algebra system (CAS) purpose-built for quantum mechanics.

Named after George Uhlenbeck — co-discoverer of electron spin.

What is this?

Uhlenbeck provides programming abstractions that look, feel, and behave like the mathematical entities of physics. The postulates of quantum mechanics are built in at a fundamental level. It is designed to model a wide range of quantum systems — finite and infinite dimensional Hilbert spaces, non-relativistic and relativistic alike.

This project is the natural evolution of sympy.physics.quantum, built by its original creator. Where sympy.physics.quantum pushed SymPy's pure-Python, commutative-centric architecture as far as it could go, Uhlenbeck rebuilds the foundations in Rust with non-commutativity, performance, and algorithmic clarity as first principles.

Architecture

The system is a three-layer stack:

  • Pure Rust core — symbolic engine, expression representation, pattern matching, canonicalization, and mathematical operations. No Python dependencies.
  • PyO3 bindings — thin Rust crate wrapping core types into Python via PyO3/Maturin.
  • Python package — operator overloading, convenience wrappers, and interactive notebook experience.

Design Specification

See spec/design.md for the full design vision, motivation, scope, tenets, and methodology. The spec/ directory contains accepted and proposed specification documents for all subsystems.

Benchmarks

Benchmark | Input                                                 | uhlenbeck | symbolica  | symengine | Terms
----------|-------------------------------------------------------|-----------|------------|-----------|--------
add1      | x + sum_{i=0}^{2998} (-1)^i · x^i (built term-by-term)| 42.56 ms  | 42.91 ms   | 126 ms    | 2998
expand1   | expand((w + x + y + z)^31)                            | 4.04 ms   | 10.74 ms   | 3 ms      | 5984
expand2   | expand(e · (e + w)) where e = (w + x + y + z)^15      | 397.8 ms  | 1056.8 ms  | 350 ms    | 6272
expand3   | expand((x^y + y^x + z^x)^38)                          | 607 µs    | 1634 µs    | 699 µs    | 780
expand4   | expand(prod_{i=0}^{19} (a_i + b_i))                   | 994.5 ms  | 2682 ms    | —         | 1048576

About

Symbolic quantum mechanics for Rust and Python

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages