[−][src]Function roots::find_roots_sturm
pub fn find_roots_sturm<F>(
a: &[F],
convergency: &mut dyn Convergency<F>
) -> Vec<Result<F, SearchError>> where
F: FloatType,
Find all roots of the normalized polynomial x^n + a[0]*x^(n-1) + a[1]*x^(n-2) + ... + a[n-1] = 0 using the Sturm's theorem recursively.
Examples
use roots::find_roots_sturm; let polynom = &[1f64,1f64,1f64,1f64,1f64,1f64]; let roots_or_errors = find_roots_sturm(polynom, &mut 1e-6); // Returns vector of roots or search errors; let roots: Vec<_> = find_roots_sturm(polynom, &mut 1e-8f64) .iter() .filter_map(|s| match s { &Ok(ref x) => Some(*x), &Err(_) => None, }) .collect(); // Returns vector of roots filterin out all search errors;