use-math
use-math composes the focused RustUse math crates into one entry point while keeping their APIs direct and explicit. It re-exports the currently supported arithmetic, prime, polynomial, equation, interval, geometry, combinatorics, Catalan-family, Geode-array, progression, integer-helper, boolean-algebra, set-helper, trigonometry, descriptive statistics, compact linear algebra, finite algebra law, raw-number, complex-number, numerical-calculus, probability, real-number, and rational-number surfaces at the crate root, exposes nested modules for every focused crate in the workspace, surfaces vector primitives through use_math::vector, interval primitives through use_math::interval, prime utilities through use_math::prime, polynomial helpers through use_math::polynomial, equation helpers through use_math::equation, approximate numerical helpers through use_math::numerical, and keeps the shared prelude limited to the items that already have concrete ergonomic value.
What this crate provides
| Entry point | What it exposes | Best fit |
|---|---|---|
| Root re-exports | Direct access to enabled arithmetic, modular arithmetic, prime utilities, polynomial primitives, non-conflicting equation helpers, interval, geometry, combinatorics, Catalan-family, Geode-array, progression, integer-helper, boolean-algebra, set-helper, trigonometry, descriptive statistics, compact linear algebra, finite algebra law, raw-number, complex-number, numerical-calculus, probability, real-number, and rational-number items | Call sites that want short imports |
use_math::arithmetic |
The use-arithmetic crate as a nested module |
Code that prefers explicit arithmetic namespacing |
use_math::modular |
The use-modular crate as a nested module with normalized residues, congruence checks, inverses, exponentiation, and the Modular helper type |
Code that wants explicit modular arithmetic namespacing |
use_math::prime |
The use-prime crate as a nested module with primality checks, next and previous prime search, factorization helpers, and sieve utilities |
Code that wants explicit prime-utility namespacing |
use_math::polynomial |
The use-polynomial crate as a nested module with Polynomial, evaluation, derivatives, arithmetic, and low-degree real-root helpers |
Code that wants explicit polynomial namespacing |
use_math::equation |
The use-equation crate as a nested module with Roots, RootSolver, linear and quadratic equation helpers, small 2x2 systems, and the optional low-degree polynomial bridge when both equation and polynomial are enabled |
Code that wants explicit equation-solving namespacing |
use_math::numerical |
The use-numerical crate as a nested module with epsilon comparisons, finite differences, deterministic integration rules, iterative root finding, and the optional interval-based bisection bridge when both numerical and interval are enabled |
Code that wants explicit approximate numerical namespacing |
use_math::vector |
The use-vector crate as a nested module with Vector2, Vector3, Vector4, and vector operations |
Code that wants reusable vector math without root-name collisions |
use_math::interval |
The use-interval crate as a nested module with Bound, Interval, containment checks, overlap tests, and intersection operations |
Code that wants explicit interval namespacing |
use_math::matrix |
The use-matrix crate as a nested module with Matrix2, Matrix3, Matrix4, and direct matrix operations |
Code that wants explicit matrix namespacing |
use_math::geometry |
The use-geometry crate as a nested module |
Code that prefers explicit geometry namespacing |
use_math::combinatorics |
The use-combinatorics crate as a nested module |
Code that prefers explicit combinatorics namespacing |
use_math::geode |
The use-geode crate as a nested module |
Code that prefers explicit Geode-array namespacing |
use_math::algebra |
The use-algebra crate as a nested module |
Code that prefers explicit algebra namespacing |
use_math::prelude |
Common items from enabled concrete features | Small apps, examples, and quick starts |
| If you need to... | Start here |
|---|---|
| Add one dependency and opt into math surfaces with features | use-math |
| Keep arithmetic-helper code isolated | use-arithmetic directly |
| Keep modular arithmetic isolated | use-modular directly |
| Keep prime utilities isolated | use-prime directly |
| Keep polynomial helpers isolated | use-polynomial directly |
| Keep equation helpers isolated | use-equation directly |
| Keep approximation-oriented numerical helpers isolated | use-numerical directly |
| Keep reusable vector primitives isolated | use-vector directly |
| Keep interval and bound primitives isolated | use-interval directly |
| Keep matrix primitives isolated | use-matrix directly |
| Keep geometry-only code isolated | use-geometry directly |
| Keep counting-only code isolated | use-combinatorics directly |
| Keep Catalan-family sequence helpers isolated | use-catalan directly |
| Keep Geode-array helpers isolated | use-geode directly |
| Keep progression helpers isolated | use-series directly |
| Keep finite algebra law helpers isolated | use-algebra directly |
| Keep integer-helper code isolated | use-integer directly |
| Keep boolean algebra helpers isolated | use-logic directly |
| Keep set helpers isolated | use-set directly |
| Keep trigonometry helpers isolated | use-trigonometry directly |
| Keep descriptive statistics helpers isolated | use-statistics directly |
| Keep solver-style linear helpers isolated | use-linear directly |
| Keep raw-number helpers isolated | use-number directly |
| Keep complex-number primitives isolated | use-complex directly |
| Keep numerical-calculus helpers isolated | use-calculus directly |
| Keep explicit probability primitives isolated | use-probability directly |
| Keep validated real-number helpers isolated | use-real directly |
| Keep exact rational arithmetic isolated | use-rational directly |
| Minimize both dependency weight and API width | The focused crate directly |
When to choose the facade
Use the facade when consumer ergonomics matter more than squeezing the dependency graph to the smallest possible shape.
| Scenario | Choose use-math? |
Why |
|---|---|---|
| You want one dependency for arithmetic helpers, prime utilities, polynomial primitives, equation helpers, vector primitives, interval primitives, matrix primitives, geometry, counting, Catalan-family sequences, Geode-array primitives, progression helpers, integer helpers, boolean algebra helpers, set helpers, trigonometry helpers, descriptive statistics helpers, solver-style linear helpers, raw-number helpers, complex primitives, numerical calculus, probability, real-number helpers, and rational arithmetic | Yes | The facade keeps imports unified behind features |
| You are building a small app or example project | Yes | Root re-exports and the prelude reduce setup friction |
| You want namespace access to every focused crate | Usually yes | The facade exposes every focused crate name consistently today |
| You only need geometry | Usually no | use-geometry stays narrower and more explicit |
| You only need combinatorics | Usually no | use-combinatorics avoids unrelated modules |
| You only need Catalan-family sequence helpers | Usually no | use-catalan keeps that counting surface narrow and explicit |
| You only need Geode-array primitives | Usually no | use-geode keeps finite type vectors and small exact Geode recurrences narrow and explicit |
| You only need arithmetic helpers | Usually no | use-arithmetic keeps floor division and overflow-mode helpers explicit and local |
| You only need prime utilities | Usually no | use-prime keeps primality, sieves, and factorization explicit and local |
| You only need polynomial helpers | Usually no | use-polynomial keeps direct polynomial operations and low-degree roots explicit and local |
| You only need equation helpers | Usually no | use-equation keeps direct solving helpers, small systems, and reusable root types explicit and local |
| You only need approximation-oriented numerical helpers | Usually no | use-numerical keeps epsilon comparisons, deterministic integration rules, and iterative solvers explicit and local |
| You only need progression helpers | Usually no | use-series keeps nth-term and partial-sum helpers narrow and explicit |
| You only need finite algebra law helpers | Usually no | use-algebra keeps closure-based structure checks explicit and local |
| You only need integer helpers | Usually no | use-integer keeps parity, divisibility, and gcd/lcm logic local |
| You only need boolean algebra helpers | Usually no | use-logic keeps named truth-table helpers explicit and local |
| You only need set helpers | Usually no | use-set keeps membership and set-operation intent explicit and local |
| You only need trigonometry helpers | Usually no | use-trigonometry keeps degree/radian handling and trig evaluation explicit and local |
| You only need descriptive statistics helpers | Usually no | use-statistics keeps mean, median, and variance summaries explicit and local |
| You only need reusable vector primitives | Usually no | use-vector keeps base vector math explicit without geometry or matrix-specific APIs |
| You only need reusable interval or bound primitives | Usually no | use-interval keeps generic interval semantics explicit and local |
| You only need matrix primitives | Usually no | use-matrix keeps matrix construction and direct matrix operations explicit and local |
| You only need solver-style linear helpers | Usually no | use-linear keeps solve logic explicit while matrix and vector ownership stays focused |
| You only need raw-number helpers | Usually no | use-number keeps plain f64 classification and shared constants explicit and local |
| You only need numerical calculus | Usually no | use-calculus keeps the approximation policy local and direct |
| You only need probability primitives | Usually no | use-probability keeps event assumptions local and direct |
| You only need validated real-number helpers | Usually no | use-real keeps floating-point validation and real-specific policy local |
| You only need exact rational arithmetic | Usually no | use-rational keeps exact fraction normalization and arithmetic local |
[!TIP] The facade is intentionally thin. It is not a second abstraction layer over the focused crates.
Installation
Default features enable the current full surface:
[]
= "0.0.6"
Geometry only:
[]
= { = "0.0.6", = false, = ["geometry"] }
Combinatorics only:
[]
= { = "0.0.6", = false, = ["combinatorics"] }
Interval only:
[]
= { = "0.0.6", = false, = ["interval"] }
Modular only:
[]
= { = "0.0.6", = false, = ["modular"] }
Prime only:
[]
= { = "0.0.6", = false, = ["prime"] }
Polynomial only:
[]
= { = "0.0.6", = false, = ["polynomial"] }
Equation only:
[]
= { = "0.0.6", = false, = ["equation"] }
Numerical only:
[]
= { = "0.0.6", = false, = ["numerical"] }
Quick examples
Checked counting from the root
#
#
#
#
#
Catalan-family counting from the root
#
#
#
#
#
Geode-array helpers from the root
#
#
#
#
#
Progression helpers from the root
#
#
#
#
#
Boolean algebra helpers from the root
#
#
#
#
#
Set helpers from the root
#
#
#
#
#
Trigonometry helpers from the root
#
#
#
#
#
Descriptive statistics from the root
#
#
#
#
#
Linear algebra helpers from the root
#
#
#
#
#
Raw-number helpers from the root
#
#
#
#
#
Finite algebra law helpers from the root
#
#
#
#
#
Integer helpers from the root
#
#
#
#
#
Geometry from the root
#
#
#
#
#
Geometry extras behind the feature gate
#
#
#
#
#
Numerical calculus from the root
#
#
#
#
#
Approximate numerical helpers through the namespace
#
#
#
#
#
Probability from the root
#
#
#
#
#
Real-number helpers from the root
#
#
#
#
#
Rational arithmetic from the root
#
#
#
#
#
Feature model
| Feature | Enables | Default |
|---|---|---|
arithmetic |
Re-exports from use-arithmetic, including checked and overflow-mode arithmetic helpers, floor-division helpers, and the use_math::arithmetic namespace |
No |
geometry |
Re-exports from use-geometry, including Aabb2 and tolerance-aware orientation helpers |
No |
combinatorics |
Re-exports from use-combinatorics |
No |
catalan |
Re-exports from use-catalan, including catalan, fuss_catalan, and CatalanError |
No |
geode |
Re-exports from use-geode, including TypeVector, hyper_catalan, geode_memoized, and the use_math::geode namespace |
No |
algebra |
Re-exports from use-algebra, including finite algebra-law helpers such as identity_element, is_abelian_group, and is_ring |
No |
modular |
Re-exports from use-modular, including normalized residues, Modular, congruence checks, inverses, exponentiation, and the use_math::modular namespace |
No |
prime |
Re-exports from use-prime, including primality checks, next/previous prime search, factorization helpers, sieves, and the use_math::prime namespace |
No |
polynomial |
Re-exports from use-polynomial, including Polynomial, evaluation, derivatives, arithmetic, low-degree real-root helpers, and the use_math::polynomial namespace |
No |
equation |
Re-exports from use-equation, including Roots, RootSolver, LinearEquation, QuadraticEquation, LinearSystem2, solve_linear, solve_quadratic, and the use_math::equation namespace. The low-degree polynomial bridge is also available when polynomial is enabled. |
No |
numerical |
Re-exports the use-numerical crate as use_math::numerical, including epsilon comparison, finite-difference helpers, deterministic integration rules, iterative root finding, and the optional bisection_interval bridge when interval is also enabled |
No |
series |
Re-exports from use-series, including arithmetic and geometric progression helpers |
No |
integer |
Re-exports from use-integer, including IntegerSign, divisibility helpers, and gcd/lcm |
No |
interval |
Re-exports from use-interval, including Bound, Interval, containment checks, overlap tests, intersections, and the use_math::interval namespace. When numerical is also enabled, this feature also enables use_math::numerical::bisection_interval. |
No |
logic |
Re-exports from use-logic, including implication, equivalence, XOR, NAND, NOR, and majority helpers |
No |
set |
Re-exports from use-set, including membership predicates and order-preserving set operations |
No |
trigonometry |
Re-exports from use-trigonometry, including Angle, degree/radian conversion helpers, normalization helpers, and sin_deg/cos_deg/tan_deg |
No |
statistics |
Re-exports from use-statistics, including StatisticsError, mean/median, variance, and standard-deviation helpers |
No |
matrix |
Re-exports from use-matrix, including Matrix2, Matrix3, Matrix4, determinants, transpose helpers, and inverses for 2x2 and 3x3 matrices |
No |
linear |
Re-exports from use-linear, including solve_2x2 and LinearError; the linear feature also enables the matrix and vector facade surfaces |
No |
vector |
Re-exports the use-vector crate as use_math::vector, including Vector2, Vector3, Vector4, normalization, distance, interpolation, and Vector3::cross |
No |
number |
Re-exports from use-number, including floating-point classification helpers and shared numeric constants |
No |
complex |
Re-exports from use-complex, including Complex and Imaginary |
No |
calculus |
Re-exports from use-calculus, including Differentiator, Integrator, and limit helpers |
No |
probability |
Re-exports from use-probability, including Probability, Bernoulli, and independent-event helpers |
No |
rational |
Re-exports from use-rational, including Rational and RationalError |
No |
real |
Re-exports from use-real, including Real, RealInterval, and approx_eq |
No |
full |
Every focused crate feature in the workspace | Yes |
[!NOTE]
fullis the default today because the facade exists to smooth over multi-crate integration. Disable defaults when you need tighter control over compile surface. Every focused crate feature exposes a nested module, while only non-conflicting surfaces are also re-exported at the crate root.
Design constraints
- The facade stays close to the focused crates instead of inventing a separate object model.
- Small APIs are preferred over broad trait-heavy abstractions.
- Depend on the focused crates directly when the facade would be wider than you need.
- Facade-only wrapper types, macros, and a second abstraction layer are intentionally out of scope.
Status
use-math is a concrete pre-1.0 facade crate in the RustUse docs surface. The API remains intentionally thin while every focused crate in the workspace now exposes a concrete public surface.