use-numerical 0.0.6

Utility-first approximate numerical helpers for RustUse
Documentation
  • Coverage
  • 100%
    49 out of 49 items documented1 out of 31 items with examples
  • Size
  • Source code size: 29.1 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 672.98 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 15s Average build duration of successful builds.
  • all releases: 15s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • RustUse/use-math
    1 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • CloudBranch

use-numerical

Install

[dependencies]
use-numerical = "0.0.6"

Optional bounded-interval bridge support:

[dependencies]
use-numerical = { version = "0.0.6", features = ["interval"] }

What belongs here

use-numerical owns small, explicit helpers for approximate numerical work over f64. It provides:

  • tolerance-based floating-point comparison
  • first-derivative finite difference helpers
  • deterministic numerical integration rules
  • iterative root-finding helpers and error types

This crate is intentionally about approximation-oriented methods only. It does not add exact algebraic solvers, symbolic differentiation, symbolic integration, polynomial-specific APIs, matrix solving, or optimization workflows.

Neighboring crates

Crate Responsibility
use-numerical Approximate numerical methods, tolerances, and iterative solvers
use-equation Exact small equation helpers such as linear and quadratic formulas
use-polynomial Polynomial structs, evaluation, derivatives, and direct operations
use-calculus Calculus concepts and higher-level derivative or integral workflows
use-optimization Optimization algorithms and optimization workflows
use-real Real-number abstractions and validation policy
use-linear Matrix and vector driven linear-system solving

Examples

Compare floating-point values with an epsilon

use use_numerical::approx_eq;

assert!(approx_eq(0.1 + 0.2, 0.3, 1e-12));

Approximate a derivative with a central difference

use use_numerical::central_difference;

let derivative = central_difference(|x| x * x, 3.0, 1e-6);

assert!((derivative - 6.0).abs() < 1e-5);

Integrate numerically with the trapezoidal rule

use use_numerical::trapezoidal_rule;

let area = trapezoidal_rule(|x| x * x, 0.0, 1.0, 1_000).unwrap();

assert!((area - 1.0 / 3.0).abs() < 1e-3);

Find a root with bisection

use use_numerical::{RootOptions, bisection};

let root = bisection(
    |x| x * x - 2.0,
    1.0,
    2.0,
    RootOptions::default(),
)
.unwrap();

assert!((root - 2.0_f64.sqrt()).abs() < 1e-8);

Find a root with Newton-Raphson

use use_numerical::{RootOptions, newton_raphson};

let root = newton_raphson(
    |x| x * x - 2.0,
    |x| 2.0 * x,
    1.0,
    RootOptions::default(),
)
.unwrap();

assert!((root - 2.0_f64.sqrt()).abs() < 1e-8);

Status

use-numerical is a concrete pre-1.0 crate in the RustUse math workspace. It keeps approximation helpers explicit and reusable so neighboring calculus, equation, polynomial, simulation, control, signal, optimization, and physics crates can build on one small numerical surface.