Struct peroxide::numerical::root::RootFinder
source · pub struct RootFinder<F: Fn(AD) -> AD> { /* private fields */ }
Expand description
Structure for Root finding
Implementations§
source§impl<F: Fn(AD) -> AD> RootFinder<F>
impl<F: Fn(AD) -> AD> RootFinder<F>
sourcepub fn new(init: RootState, method: RootFind, f: F) -> Result<Self, RootError>
pub fn new(init: RootState, method: RootFind, f: F) -> Result<Self, RootError>
Create RootFinder
§Default Options
- Times: 100
- Tolerance: 1e-10
§Usage
extern crate peroxide;
use peroxide::fuga::*;
fn main() -> Result<(), RootError> {
let init = RootState::I(1f64, 3f64);
let mut a = RootFinder::new(init, Bisection, f)?;
let x = a.find_root()?;
x.print();
Ok(())
}
fn f(x: AD) -> AD {
x.powi(2) - 4f64
}
pub fn f(&self, x: AD) -> AD
sourcepub fn condition_number(&self) -> f64
pub fn condition_number(&self) -> f64
Condition number
sourcepub fn get_method(&self) -> RootFind
pub fn get_method(&self) -> RootFind
Get method
sourcepub fn check_find(&self) -> RootBool
pub fn check_find(&self) -> RootBool
Check if find root
Trait Implementations§
Auto Trait Implementations§
impl<F> RefUnwindSafe for RootFinder<F>where
F: RefUnwindSafe,
impl<F> Send for RootFinder<F>where
F: Send,
impl<F> Sync for RootFinder<F>where
F: Sync,
impl<F> Unpin for RootFinder<F>
impl<F> UnwindSafe for RootFinder<F>where
F: UnwindSafe,
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more