3 unstable releases
| 0.2.0 | Dec 29, 2025 |
|---|---|
| 0.1.2 | Dec 15, 2025 |
| 0.1.0 | Dec 15, 2025 |
#845 in Math
6MB
94K
SLoC
MathHook
High-performance educational computer algebra system for Rust.
Features
- Memory-optimized: 32-byte Expression enum for cache performance
- Hybrid API: Expression methods + separate solver objects
- Multi-format parsing: LaTeX, Wolfram Language, standard notation
- Educational focus: Step-by-step explanations
- Comprehensive macros:
symbol!,symbols!,expr!,function!
Installation
[dependencies]
mathhook = "0.2.0"
Quick Start
use mathhook::prelude::*;
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Create symbols using macros
let x = symbol!(x);
// Build expressions using expr! macro
let quadratic = expr!(x^2 + 2*x + 1);
// Simplify
let simplified = quadratic.simplify();
// Calculus
let derivative = quadratic.derivative(x.clone());
// Parse from string
let parser = Parser::new(&ParserConfig::default());
let parsed = parser.parse("sin(x)^2 + cos(x)^2")?;
Ok(())
}
Actual API Reference
For the complete API documentation, see docs.rs/mathhook.
Quick Reference
The prelude (use mathhook::prelude::*) provides:
| Export | Purpose |
|---|---|
Expression |
Core 32-byte symbolic expression type |
Symbol |
Symbolic variables |
Number |
Integer, Rational, Float, Complex |
MathSolver |
Equation solving |
Parser |
Multi-format expression parsing |
symbol!, expr! |
Expression construction macros |
Memory Guarantee
use mathhook::prelude::*;
assert!(std::mem::size_of::<Expression>() <= 32);
Documentation
- docs.rs/mathhook - Full API reference
- mdbook Documentation - Guides and tutorials
- Architecture - System design
License
MathHook is dual-licensed under MIT OR Apache-2.0. See LICENSE.
Dependencies
~7–16MB
~319K SLoC