| Crates.io | mathhook |
| lib.rs | mathhook |
| version | 0.2.0 |
| created_at | 2025-12-15 17:22:34.848406+00 |
| updated_at | 2025-12-29 02:55:20.252651+00 |
| description | High-performance educational computer algebra system with ergonomic Rust macros |
| homepage | https://github.com/AhmedMashour/mathhook |
| repository | https://github.com/AhmedMashour/mathhook |
| max_upload_size | |
| id | 1986425 |
| size | 57,818 |
High-performance educational computer algebra system for Rust.
symbol!, symbols!, expr!, function![dependencies]
mathhook = "0.2.0"
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(())
}
For the complete API documentation, see docs.rs/mathhook.
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 |
use mathhook::prelude::*;
assert!(std::mem::size_of::<Expression>() <= 32);
MathHook is dual-licensed under MIT OR Apache-2.0. See LICENSE.