pub fn polynomial_roots(coeffs: &[f64]) -> Vec<f64>Expand description
Returns the real roots of a polynomial in ascending order.
coeffs are ordered from the highest degree to the constant term, e.g. [1, 0, -2] is
x^2 - 2. The roots are the real eigenvalues of the companion matrix (see
polynomial_roots_complex), each polished by Newton’s method; an eigenvalue with an imaginary
part below 10⁻³ |z| counts as real when the polynomial vanishes at its real part to within
rounding error. A repeated root, which appears as a cluster of nearby eigenvalues, is reported once, at
the cluster’s mean (accurate to about ε^(1/m) for multiplicity m, often much better).
Distinct roots closer together than the rounding error of the polynomial can resolve are merged.