Sciencev3.0

rssn

Scientific computing for Rust

Apache-2.0Rust · C · C++Linux · macOS · Windows · wgpu
1
Entry point
Session::compute
6
Output formats
text · LaTeX · Typst · plots
3
Execution backends
tape · Cranelift · GPU
C/C++
FFI
rssn.h · rssn.hpp

Overview

rssn is a scientific computing library for Rust built around one idea: every symbolic operation is an identity transformation. Differentiating, integrating, solving and simplifying are all requests — diff(f, x), solve(eq, x) — rewritten by rule sets on a hash-consed e-graph until an equal closed form, or a number, is found.

That engine carries the rest of the crate. Calculus, algebra, differential equations, analysis and physics rule sets all lower to the same representation, and every scalar term carries an inferred dimension, so an answer reports its units as well as its value.

The same closed forms can then be compiled: to an SSA tape with reverse gradients and interval enclosures, or through Cranelift to machine code, or across rows on a CPU pool or a wgpu device. Symbolic and numeric paths share the operator registry rather than living in separate worlds.

Capabilities

what it does

E-graph algebra

Every operation is an identity transformation on a hash-consed DAG: differentiate, integrate, solve and simplify rewrite to an equal closed form.

Dimensions in the terms

Each scalar carries an inferred dimension, and operators declare how dimensions combine — SI and affine units, symbolic exponents, strict or advisory.

Calculus and algebra

Definite and improper integrals, Meijer G, Gröbner bases (Buchberger, F4, F5), CAD quantifier elimination, and ODE/PDE solution families.

Numeric kernels

Adaptive quadrature, stiff ODE solvers, Krylov methods, Chebyshev and AAA approximation, FFT, sparse linear algebra and statistics.

Compiled expressions

Closed forms compile to an SSA tape with reverse gradients and interval enclosures, or to Cranelift machine code with the jit feature.

Physics and simulation

Rule sets for classical mechanics through QFT, plus FDM, FEM, FVM, BEM, CFD, molecular dynamics and spectral solvers.

How it works

design notes
01

Rule scheduling

Rewriting runs in tiers — reduce, normalise, explore — so cheap identities settle before expensive searches start, and the fixpoint terminates without unbounded exploration.

02

Extraction by target

The engine keeps every equivalent form and picks one at the end: the most compact closed form for symbolic work, or the numerically stable variant for a requested tolerance.

03

Kernel manifest

Every operator has a deterministic, self-describing manifest entry — signature, unit, constants — which is what plugins, the C ABI and the bincode-next wire format are built on.

04

Compilation backends

Closed forms lower to an SSA tape (gradients, Hessian-vector products, interval enclosures) or to Cranelift machine code with caching and tiered compilation.

05

Host callbacks

Checked callback signatures for quadrature, Brent, non-linear least squares and four ODE integrators, including dimensions and error propagation across the ABI.

06

Simulation layer

Time-stepping and discretised fields live outside the identity engine: FDM, FEM, FVM, BEM, CFD, molecular dynamics, SPH, spectral and multigrid solvers with ready-made scenarios.

Coverage at a glance

from docs/MATH_COVERAGE.md
A summary of the domains the rule sets and kernels cover. The full operator list, including boundary behaviour, is in the documentation.
DomainRepresentative capabilityNotes
Calculusderivatives, definite and improper integrals, limits, seriesHermite reduction for algebraic integrands
Algebrafactorisation, Gröbner bases, CAD quantifier eliminationBuchberger, F4 and F5
Differential equationsODE classification and solution, PDE on boxes and shellsDirichlet, Neumann, Robin, periodic
Numericsquadrature, stiff ODE solvers, Krylov, FFT, statisticsDormand–Prince, Radau IIA, BDF
Physicsclassical, EM, relativity, QM, QFT, solid stateplus FDM, FEM, FVM, BEM, CFD, MD, SPH
Outputtext, LaTeX, Typst, Unicode, plots, .npyround-trippable

Install

cargo
shell — cargo
# the library
cargo add rssn

# optional: JIT compilation of closed forms
cargo add rssn --features jit

A C and C++ interface is generated with cbindgen (rssn.h, rssn.hpp) and built with scripts/build_ffi.sh. GPU execution is available behind the gpu-wgpu feature.