This crate allows you to use Newton's method for rootfinding. It aims to implement several Newton based method (Broyden, ...), whereas the jacobian function is provided or not. It also aims to work on a complex model, limiting the number of model calls at a minimum. A minimal solver is also provided for basic usages and benchmarking purposes.
Model
trait. The struct UserModelWithFunc
is provided to easily adapt model defined with a function to the required trait.nalgebra
crate.```rust extern crate newton_rootfinder as nrf; use nrf::model::Model;
extern crate nalgebra;
/// Equation : x**2 - 2 = 0
fn square2(x: &nalgebra::DVector
fn main() { let problemsize = 1; let initguess = nalgebra::DVector::fromvec(vec![1.0]); let rf = nrf::solver::RootFinderFD::defaultwithguess(initguess); let mut usermodel = nrf::modelwithfunc::UserModelWithFunc::new(problemsize, square2);
rf.solve(&mut user_model);
println!("{}", usermodel.getiteratives()[0]); // print 1.4142135623747443 } ```
Crates may have evolved since this comparision was established
| crate | version | 1-dimension | n-dimension | Jacobian not required | Other algorithms¹ | |-----------------------|--------:|:------------:|:-----------:|----------------------:|------------------:| | newton_rootfinder | 0.1.0 | ✔️ | ✔️ | ✔️ | ❌ (not yet) | | newton-raphson | 0.1.0 | ✔️ | ❌ | ❌ | ❌ | | nrfind | 1.0.3 | ✔️ | ❌ | ❌ | ❌ | | rootfind | 0.7.0 | ✔️ | ❌ | ❌ | ✔️ | | roots | 0.6.0 | ✔️ | ❌ | ❌ | ✔️ | | peroxide | 0.21.7 | ✔️ | ✔️ | ❌ | ❌ |