This guide walks you through adding MathCore to a Rust project and running your first symbolic math operations — arithmetic evaluation, symbolic differentiation, and equation solving — using real code straight from the library. By the end you will have a working program that demonstrates MathCore’s core capabilities.Documentation Index
Fetch the complete documentation index at: https://mintlify.com/Nonanti/mathcore/llms.txt
Use this file to discover all available pages before exploring further.
Add MathCore to your project
Inside your project’s root directory, run:Or add the dependency manually to
Cargo.toml:Import MathCore
At the top of your Rust source file, bring the main struct and the prelude into scope:The
prelude module re-exports commonly needed types (String, Vec, HashMap, fmt, and numeric traits) in a way that works in both std and no_std environments.Evaluate a basic arithmetic expression
Create a
MathCore instance and call calculate to evaluate an expression string. Operator precedence is handled automatically:calculate returns Result<f64, MathError>, so .unwrap() is fine for quick scripts — use proper error handling in production code.Differentiate an expression symbolically
MathCore::differentiate is a static method that parses an expression string and returns its derivative as a symbolic Expr, which implements Display:The second argument to
differentiate is the variable to differentiate with respect to. You can use any single-character or multi-character symbol that appears in the expression.Putting it all together
Here is the completemain.rs combining all five steps:
Next Steps
Calculus & Differentiation
Symbolic and numerical differentiation, limits, Taylor series, and integration by parts.
Algebra & Equation Solving
Solve linear, quadratic, and higher-degree equations; factor and simplify expressions.
Matrix Operations
Symbolic matrices, determinants, eigenvalues, decompositions, and linear-system solvers.
API Reference
Full API documentation for all public types, methods, and modules in MathCore.
