pub fn roots(coefficients: &[f64], tolerance: f64) -> OgeomResult<Vec<f64>>Expand description
The real roots of a polynomial, in increasing order.
coefficients are in ascending power order: c[0] + c[1] x + c[2] x^2 ....
Degrees up to three are solved in closed form. Above that each root is
bracketed between the derivative’s roots, as real_roots does.
Repeated roots are returned once each, since a geometry caller wants the
distinct parameter values, and a double root (a tangency) is found
although rounding leaves the polynomial a hair either side of zero there.
The same slack merges two simple roots that stand close: where the
polynomial’s value between them is within 32 n ε of its terms’ size,
they come back as one root between them. For a quartic with roots near
one that is a pair a few times 1e-7 apart.
§Errors
OgeomError::Construction if every
coefficient is zero, where every value is a root.