Skip to main content

polynomial_roots

Function polynomial_roots 

Source
pub fn polynomial_roots(coeffs: &[f64]) -> Result<Vec<Complex>, SolversError>
Expand description

Find all complex roots of a real polynomial (DESCENDING coefficients, coeffs[0]·x^n + … + coeffs[n]) via the Durand–Kerner iteration.

Dependency-free and finds all n roots simultaneously; suitable for moderate degree. Leading/trailing zeros are trimmed. Returns n roots (real roots have im ≈ 0). Returns SolversError::ComputationError for a zero or non-finite polynomial.