rssn is an open-source scientific computing library for Rust, combining symbolic computation, numerical methods, and physics simulations in a single ecosystem.
It is designed to provide a foundation for building a next-generation CAS (Computer Algebra System) and numerical toolkit in Rust.
The library is organized into five major components:
Symbolic:
Computer algebra system foundations, differentiation & integration, group theory, Lie algebras, polynomial algebra, PDE/ODE solvers, Grobner bases, quantum mechanics operators, graph algorithms, and more.
Numerical:
Linear algebra, optimization (Rastrigin, Rosenbrock, Sphere, Linear Regression), numerical integration, probability distributions, FFT, combinatorics, special functions, PDE solvers (heat, wave, Schrödinger 1D–3D), root finding, and statistical analysis.
Physics:
Simulation modules covering FDM/FEM/FVM solvers, multigrid methods, molecular mechanics (SPH), electrodynamics (FDTD), Navier–Stokes fluid dynamics, relativity (geodesics, Schwarzschild), elasticity, quantum simulations, and more.
Output:
Pretty-printing, LaTeX/Typst export, NumPy-compatible I/O, and plotting utilities (2D/3D surfaces, vector fields, parametric curves).
Plugins:
Optional extensions (enabled with the full
feature).
Add rssn to your Rust project:
cargo add rssn
Then start exploring:
use num_bigint::BigInt;
use rssn::symbolic::calculus::differentiate;
use rssn::symbolic::core::Expr;
fn test_differentiate_x_squared_stack_overflow() {
let x = Expr::Variable("x".to_string());
let x2 = Expr::Mul(Box::new(x.clone()), Box::new(x.clone()));
let d = differentiate(&x2, "x");
// The derivative of x^2 is 2*x.
// The simplification process might result in Constant(2.0) or BigInt(2).
let two_const = Expr::Constant(2.0);
let expected_const = Expr::Mul(Box::new(two_const), Box::new(x.clone()));
let two_int = Expr::BigInt(BigInt::from(2));
let expected_int = Expr::Mul(Box::new(two_int), Box::new(x.clone()));
println!("Derivative: {:?}", d);
println!("Expected (const): {:?}", expected_const);
println!("Expected (int): {:?}", expected_int);
assert!(d == expected_const || d == expected_int);
}
For more examples, see the project repository.
We welcome contributions of all kinds — bug fixes, performance optimizations, new algorithms, and documentation improvements. See CONTRIBUTING.md for detailed guidelines.
Scientific computing requires heavy resources for CI/CD, benchmarking, and cloud testing. You can support development via GitHub Sponsors.
Enterprise sponsors will receive:
Excess donations will be redirected to upstream Rust ecosystem projects (e.g., rust-LLVM) or community initiatives.
Updates: Due to temporary issues, GitHub Sponsors is currently unavailable. If you would like to make a donation, please use PayPal to donate to @panayang338.
Consultants:
Licensed under the Apache 2.0. See LICENSE for details.