Fast symbolic differentiation library - Rust-powered Python bindings
Project description
SymbAnaFis
High-performance symbolic mathematics library written in Rust with Python bindings.
SymbAnaFis provides a robust engine for symbolic differentiation, simplification, and evaluation, designed for performance-critical applications in physics, engineering, and machine learning.
Key Capabilities
- ⚡ High-Performance Architecture: Built on Rust for speed and memory safety, with interned strings and optimized memory layout.
- ∂ Symbolic Differentiation: Supports product, chain, and quotient rules for a vast array of mathematical functions.
- ✨ Algebraic Simplification: Intelligent simplification engine covering trigonometric identities, constant folding, and algebraic expansion.
- 📊 Uncertainty Propagation: Comprehensive support for calculating uncertainty propagation with full covariance matrix integration.
- ∇ Vector Calculus: Native symbolic computation of Gradients, Hessians, and Jacobian matrices.
- 🚀 Parallel Processing: Optional parallel evaluation engine using Rayon for massive batch operations.
- 📦 Python Bindings: Seamless Python integration via
maturin, offering the speed of Rust with the ease of Python.
Installation
# Python
pip install symb-anafis
# Rust
cargo add symb_anafis
Quick Start
Python
import symb_anafis
# Differentiate complex expressions
result = symb_anafis.diff("x^3 + sin(x)", "x")
# → "3*x^2 + cos(x)"
# Algebraic Simplification
result = symb_anafis.simplify("sin(x)^2 + cos(x)^2")
# → "1"
# Handle constants automatically
result = symb_anafis.diff("a*x^2", "x", fixed_vars=["a"])
# → "2*a*x"
Rust
use symb_anafis::{diff, simplify, symb};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// String API for ease of use
let result = diff("sin(x) * x", "x", None, None)?;
println!("{result}"); // cos(x)*x + sin(x)
// Type-safe API (Symbol is Copy - no clone needed!)
let x = symb("x");
let expr = x.pow(2.0) + x.sin(); // x² + sin(x)
// Export to LaTeX
println!("{}", expr.to_latex()); // x^{2} + \sin(x)
Ok(())
}
Advanced Features
🔍 Fine-Grained Control
Use the Builder pattern to configure safety limits and behavior.
use symb_anafis::{Diff, Simplify};
Diff::new()
.domain_safe(true) // Prevent unsafe simplifications (e.g., x/x != 1 if x=0)
.max_depth(200) // Prevent stack overflows on massive expressions
.diff_str("sqrt(x^2)", "x")?; // Result: abs(x)/x
📉 Uncertainty Propagation
Calculate error propagation symbolically, supporting correlated variables.
use symb_anafis::uncertainty_propagation;
// Calculate uncertainty formula for f = x + y with full covariance support
let sigma = uncertainty_propagation(&expr, &["x", "y"], None)?;
// → sqrt(sigma_x^2 + 2*sigma_x*sigma_y*rho_xy + sigma_y^2)
⚡ Parallel Evaluation
Evaluate expressions over large datasets in parallel (requires parallel feature).
// Evaluate symbolic expressions across thousands of data points efficiently
let results = evaluate_parallel(&inputs, &data);
🛠️ Custom Functions
Register custom functions with their own derivative rules.
use symb_anafis::{Diff, UserFunction};
Diff::new()
.user_fn("f", UserFunction::new(1..=1).partial(0, |args| {
// Define ∂f/∂u = 2u for f(u)
2.0 * args[0].clone()
}))
.diff_str("f(x^2)", "x")?; // → 4*x^3
Supported Functions
SymbAnaFis supports over 50 built-in mathematical functions:
| Category | Typical Functions |
|---|---|
| Trigonometric | sin, cos, tan, cot, sec, csc, asin, acos, ... |
| Hyperbolic | sinh, cosh, tanh, coth, asinh, acosh, ... |
| Exponential | exp, ln, log10, log2, pow |
| Special | gamma, beta, erf, besselj, zeta, LambertW |
| Utility | sqrt, cbrt, abs, sign, floor, ceil |
Documentation
- API Reference - Detailed guide to all functions and modules.
- docs.rs - Full Rust crate documentation.
License
MIT License - see LICENSE
Built with ❤️ in Rust 🚀
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file symb_anafis-0.4.0-cp314-cp314-win_amd64.whl.
File metadata
- Download URL: symb_anafis-0.4.0-cp314-cp314-win_amd64.whl
- Upload date:
- Size: 874.6 kB
- Tags: CPython 3.14, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
db92d0c6c42350e2c1a03b6108564935c74e200c1a1c5a35c1ea6a060d0e4bff
|
|
| MD5 |
8e943b37943c128fe291901ed026e04a
|
|
| BLAKE2b-256 |
5a49d1dd395a765bcae0fff247dff8da0badd8acc8d48bfee79d77d71552868a
|
File details
Details for the file symb_anafis-0.4.0-cp314-cp314-manylinux_2_35_x86_64.whl.
File metadata
- Download URL: symb_anafis-0.4.0-cp314-cp314-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.14, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a5475a772b87901d97e1ac9fb90fbbefa32ba1a21b17cb85af94e0adc02e3a3f
|
|
| MD5 |
a0a506c05a9f90e21caf4c209e2bc8b9
|
|
| BLAKE2b-256 |
c29302a13402a4076ce4ffd02bb59c009be17c52f976b9ac2e534cfa5a13a53f
|
File details
Details for the file symb_anafis-0.4.0-cp314-cp314-macosx_11_0_arm64.whl.
File metadata
- Download URL: symb_anafis-0.4.0-cp314-cp314-macosx_11_0_arm64.whl
- Upload date:
- Size: 960.2 kB
- Tags: CPython 3.14, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3d44b0705b35c1c251b658febf693fa21e712b5297fc5a513d0735a344128c72
|
|
| MD5 |
4e1da6dae72d899fd2916ecad88b6210
|
|
| BLAKE2b-256 |
43a2b3798f18df64316a9113d76458c438b24c46336101aa40617d0a613a957a
|
File details
Details for the file symb_anafis-0.4.0-cp313-cp313-win_amd64.whl.
File metadata
- Download URL: symb_anafis-0.4.0-cp313-cp313-win_amd64.whl
- Upload date:
- Size: 876.7 kB
- Tags: CPython 3.13, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
ad8408a6cd1369e8caf8264957d813640d0ec924aa9ff32f0e51203a5edf8793
|
|
| MD5 |
9b1b57da9e83b071e799823921abb6c1
|
|
| BLAKE2b-256 |
45f048f9bf4a1754f2be2810ccb0c24ca52d4e5363547517850489467a61e011
|
File details
Details for the file symb_anafis-0.4.0-cp313-cp313-manylinux_2_35_x86_64.whl.
File metadata
- Download URL: symb_anafis-0.4.0-cp313-cp313-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.13, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d5fe9c4cadae47e3bfa1bcc5222bf3b3f4b70e011dc4d7b9008b57c61a37ffdc
|
|
| MD5 |
0a6bb2f39db467608524ccaae02469f5
|
|
| BLAKE2b-256 |
6e3ba3b69fcbbbc5ade01a090f4b90c129b4c0b32f5d29a0102ff9be64bb2adc
|
File details
Details for the file symb_anafis-0.4.0-cp313-cp313-macosx_11_0_arm64.whl.
File metadata
- Download URL: symb_anafis-0.4.0-cp313-cp313-macosx_11_0_arm64.whl
- Upload date:
- Size: 964.5 kB
- Tags: CPython 3.13, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
befabb877e4e9ae8bbf3f6333d2751ee32e9023b3bbb6b8f6bc89d822dbefe44
|
|
| MD5 |
10ec8ba7f83f466de1617981e8a7010b
|
|
| BLAKE2b-256 |
907b0e5b94fbaec07c6aa422beb511f89b26ad5fcb7a9e32645139ef967d82ea
|
File details
Details for the file symb_anafis-0.4.0-cp312-cp312-win_amd64.whl.
File metadata
- Download URL: symb_anafis-0.4.0-cp312-cp312-win_amd64.whl
- Upload date:
- Size: 876.9 kB
- Tags: CPython 3.12, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5dbf34b58cb481f72533e048e24440bdc8d43867d814af86509400bc65d5fddf
|
|
| MD5 |
9887fc5634b1cb1ad8ae94c38a57ea45
|
|
| BLAKE2b-256 |
1bef73431996490e835b20166637459d7db98045c3806c69e927c556dfea7967
|
File details
Details for the file symb_anafis-0.4.0-cp312-cp312-manylinux_2_35_x86_64.whl.
File metadata
- Download URL: symb_anafis-0.4.0-cp312-cp312-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.12, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aee0834bf6428de803b3443bb642512fc2305ac40caaec0c7b8cf7d976812e69
|
|
| MD5 |
ef5bc55dea34112e351ebb2f9f516b9d
|
|
| BLAKE2b-256 |
aad32817466eeb95555901fbc6298530d30fe0deb980aefdf6ca15d44ca8450c
|
File details
Details for the file symb_anafis-0.4.0-cp312-cp312-macosx_11_0_arm64.whl.
File metadata
- Download URL: symb_anafis-0.4.0-cp312-cp312-macosx_11_0_arm64.whl
- Upload date:
- Size: 965.1 kB
- Tags: CPython 3.12, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b8365bc9755952505974712fcb26003c22a14330f4631af0a057a3ca9b3536fc
|
|
| MD5 |
ba85f5c0f82cee709422525fc17e265f
|
|
| BLAKE2b-256 |
cf55d962aa6adb849de1829ad1c951dda4f93ffbddce3859fac5b856fd5e6081
|
File details
Details for the file symb_anafis-0.4.0-cp311-cp311-win_amd64.whl.
File metadata
- Download URL: symb_anafis-0.4.0-cp311-cp311-win_amd64.whl
- Upload date:
- Size: 875.7 kB
- Tags: CPython 3.11, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
be85d9feb3ff0783c6b668aa4a5a1a61bae31371092995801bcf35237a6e3bf3
|
|
| MD5 |
68778549a1eb7225229a95d977f58910
|
|
| BLAKE2b-256 |
428bb6be3d1b26851bcdd067fdd356afd65e7f9a4a2bef6f0ca7d204fdf4b348
|
File details
Details for the file symb_anafis-0.4.0-cp311-cp311-manylinux_2_35_x86_64.whl.
File metadata
- Download URL: symb_anafis-0.4.0-cp311-cp311-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.11, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6cb3eab90ad10294e1b471c91098d1279fcadb0cdc8641597de1886ebc62d588
|
|
| MD5 |
050021b422ef10cf24aa57b8259405a5
|
|
| BLAKE2b-256 |
4d394bc233a6efac975b63c8b28d7b8ede484d5e2352254e9a65ee2b75eec3d7
|
File details
Details for the file symb_anafis-0.4.0-cp311-cp311-macosx_11_0_arm64.whl.
File metadata
- Download URL: symb_anafis-0.4.0-cp311-cp311-macosx_11_0_arm64.whl
- Upload date:
- Size: 965.5 kB
- Tags: CPython 3.11, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fc0ac24d4029e17449b63439246c47d6e128dd05e3785455f0c8d39877e13e08
|
|
| MD5 |
545878b5efeb96aa26135dda9841514a
|
|
| BLAKE2b-256 |
da1e94402d65be5b6f12a41ef13448b44ff7fb0778bd45a6377a2b778a65cf7b
|
File details
Details for the file symb_anafis-0.4.0-cp310-cp310-win_amd64.whl.
File metadata
- Download URL: symb_anafis-0.4.0-cp310-cp310-win_amd64.whl
- Upload date:
- Size: 875.7 kB
- Tags: CPython 3.10, Windows x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5bbbb402b070d265a211862a1929888e7991f9b5cf0cb41f4dcea515fb061257
|
|
| MD5 |
8fae5e8c09a97c4bf522c9c3d1518b7f
|
|
| BLAKE2b-256 |
714b244baa9f087c8ebb4e3c5304704225b6cde366dfa8ef5ec53a50e646e84b
|
File details
Details for the file symb_anafis-0.4.0-cp310-cp310-manylinux_2_35_x86_64.whl.
File metadata
- Download URL: symb_anafis-0.4.0-cp310-cp310-manylinux_2_35_x86_64.whl
- Upload date:
- Size: 1.1 MB
- Tags: CPython 3.10, manylinux: glibc 2.35+ x86-64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
713f9a8a43da2c48744ea2514951a2a75af4bdccae7902809a3d316bbf9945ed
|
|
| MD5 |
d99a76e06c1f0305111c8a2497f5a288
|
|
| BLAKE2b-256 |
9d36f4818013d5794736efcedad87c51d07534480f2a731964f144ade1d72e02
|
File details
Details for the file symb_anafis-0.4.0-cp310-cp310-macosx_11_0_arm64.whl.
File metadata
- Download URL: symb_anafis-0.4.0-cp310-cp310-macosx_11_0_arm64.whl
- Upload date:
- Size: 964.6 kB
- Tags: CPython 3.10, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? No
- Uploaded via: maturin/1.10.2
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
195565f213ce4da3b1b85e8608dd2b1fefc9d186dea04edae44c95d63a9c5f54
|
|
| MD5 |
062576489d4fb867eb90a22386a66f3e
|
|
| BLAKE2b-256 |
c5b0b0ff6aa5cfea7cbb50f813b902ae4633372972e942d96dc1273fd8afdeb6
|