Module poly

Source
Expand description

Real polynomials in the power basis and all their real roots in an interval.

§Method

Roots of p are isolated by the roots of p', recursively (the approach of OCCT math_DirectPolynomialRoots generalised, and of Collins and Loos’ derivative sequence): between consecutive critical points p is monotone, so a sign change there is exactly one root, found by find_root.

Every evaluation carries a rigorous bound on its own rounding error (Horner with gamma(2n) * sum |a_i| |x|^i, Higham, Accuracy and Stability of Numerical Algorithms, 5.1). A sign is trusted only where |p(x)| exceeds that bound. Where it does not – at a multiple root, a cluster closer than f64 can separate, or a near-touch of the axis – the answer is RootKind::Unresolved with the region and the most roots it can hold, rather than a guessed count.

The roots are those of the polynomial whose coefficients are the given f64 values. Monotonicity between critical points holds to working precision: the critical points come from the rounded derivative.

Structs§

Polynomial
A real polynomial a[0] + a[1] x + ... + a[n] x^n with finite coefficients.
PolynomialRoot
A real root, or an unresolved root region, of a polynomial.

Enums§

RootKind
How certain a reported root is.