generic-newton

Crates.iogeneric-newton
lib.rsgeneric-newton
version0.1.1
sourcesrc
created_at2020-08-09 11:00:52.815091
updated_at2020-10-08 13:43:17.069111
descriptionSimple generic Newton method.
homepagehttps://github.com/vigoux/newton
repositoryhttps://github.com/vigoux/newton
max_upload_size
id274606
size5,323
Thomas Vigouroux (vigoux)

documentation

README

newton

A dead-simple, dependency-free Rust crate for generic Newton method.

Usage

Everything is contained in the Newton iterator :

use newton::Newton;

fn main() {
     let mut n = Newton::<f64>::new(
         0.5, // Initial guess
         |x| x.cos() - x.powi(3), // The actual function
         |x| -(x.sin() + 3. * x.powi(2)), // Its derivative
     );

     assert!(n.nth(1000).unwrap() - 0.865474033102 < 1E-11)
}
Commit count: 15

cargo fmt