MathCore is written as aDocumentation 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.
#![no_std] library at its core — the crate itself carries that attribute in src/lib.rs. The standard library is available as an opt-in std feature (enabled by default), meaning you can drop MathCore into embedded targets, WASM modules, or any environment without an operating system simply by disabling the default feature set.
Cargo.toml Configuration
[dependencies]
# Disable all default features for no_std
mathcore = { version = "0.3.1", default-features = false }
This gives you the
alloc-only build: no standard library, no rayon parallelism, no FFT. Core symbolic math is fully available.[dependencies]
# Or enable specific subsets
mathcore = { version = "0.3.1", default-features = false, features = ["std"] }
Feature Breakdown
MathCore’sCargo.toml defines the following features:
| Feature | Requires | What it adds |
|---|---|---|
| (none) | alloc | Core symbolic math over alloc — parsing, evaluation, calculus, solver, matrix ops |
std | std | Standard library; full HashMap, richer error formatting via thiserror/std |
parallel | std | Rayon-based parallel operations (batch evaluation, parallel matrix ops) |
fft | std | FFT and signal processing via rustfft |
full | std | Alias that enables std, parallel, and fft together |
["std", "parallel", "fft"], so a plain mathcore = "0.3.1" entry in Cargo.toml pulls everything in.
Both
parallel and fft implicitly require std — they are declared with std as a dependency in the feature graph. You cannot enable either of them without std.What Is Available in no_std
All of MathCore’s symbolic math capabilities are available in no_std mode, backed byalloc and carefully chosen default-features = false dependencies throughout:
| Capability | Available in no_std? |
|---|---|
| Expression parsing and evaluation | ✓ |
| Symbolic differentiation | ✓ |
| Symbolic integration | ✓ |
| Numerical integration | ✓ |
| Equation solving | ✓ |
Complex numbers (num-complex with libm) | ✓ |
Matrix operations (nalgebra with alloc + libm) | ✓ |
Arbitrary precision arithmetic (num-bigint, num-rational) | ✓ |
| Parallel operations (rayon) | ✗ requires std |
| FFT and signal processing (rustfft) | ✗ requires std |
Full thiserror error formatting | ✗ requires std |
nom, num-complex, num-traits, num-bigint, num-rational, and nalgebra — are all configured with default-features = false and use libm for floating-point math where needed, so they work correctly without the standard library.
Setting Up Your no_std Crate
#![no_std]
extern crate alloc;
use mathcore::MathCore;
use mathcore::prelude::*; // re-exports String, Vec, Box, format!, HashMap, etc.
fn compute_distance() -> f64 {
let math = MathCore::new();
let mut vars = HashMap::new();
vars.insert("x".to_string(), 3.0);
vars.insert("y".to_string(), 4.0);
math.evaluate_with_vars("sqrt(x^2 + y^2)", &vars).unwrap()
}
HashMap in no_std Mode
Instd builds, mathcore::HashMap<K, V> is a type alias for std::collections::HashMap<K, V>. In no_std builds, it becomes alloc::collections::BTreeMap<K, V>:
prelude module re-exports this alias, so your code that imports use mathcore::prelude::* compiles and runs correctly in both environments without any #[cfg] guards on your side.
The prelude Module
The mathcore::prelude module is designed specifically to smooth over std/no_std differences. It re-exports the types you most commonly need from alloc and core, so you rarely have to write feature-gated imports yourself:
use mathcore::prelude::*; at the top of your file gives you String, Vec, Box, format!, HashMap, FromStr, fmt, and the Float trait — everything you need for typical MathCore usage, in both std and no_std contexts.