#science #simulation #numeric

root1d

One dimensional root finding algorithms

6 releases

0.3.2 Dec 23, 2023
0.3.1 Jun 2, 2023
0.2.1 May 8, 2023
0.2.0 May 6, 2022
0.1.0 Apr 15, 2022

#143 in Math

Download history 2/week @ 2024-01-13 16/week @ 2024-01-20 1/week @ 2024-01-27 20/week @ 2024-02-03 94/week @ 2024-02-10 57/week @ 2024-02-17 91/week @ 2024-02-24 98/week @ 2024-03-02 117/week @ 2024-03-09 63/week @ 2024-03-16 45/week @ 2024-03-23 86/week @ 2024-03-30

317 downloads per month

GPL-2.0-or-later

79KB
1.5K SLoC

Find roots of functions of one variable

This crate provides algorithms over a generic type T to find roots of functions TT. It is readily usable for T being f64 and f32. Activating the feature rug, one can also use it with rug::Float and rug::Rational.

Usage

use root1d::toms748;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let root = toms748(|x| x*x - 2., 0., 2.).rtol(1e-10).root()?;
    println!("root: {}", root);
}

For more information, consult the documentation of the latest release.

Highlights

  • Efficient & fully generic code.
  • Convenient interface with optional arguments and default termination criteria.
  • Support for non-copy types (for multi-precision numbers) minimizing the creation of temporary values.
  • State of the art root finding algorithm (Toms748) requiring only few evaluations of the function.

Dependencies

~0–4MB
~80K SLoC