GEOMLIB contains a general polynomial solver which is used in most of curves computations (see Rational Bezier curves).
The power form of the general polynomial P(t) is
where:
Each nonzero polynomial of degree n has at most n real roots (). The following function finds all these roots in the increasing order:
int geom_polynomial_solve(uns degree, double *coef, uns flags, double *result);
To achieve a good numerical stability, all computations work in the double precision. Possible options
to the algorithm can be passed in flags
parameter as an OR combination of the following bits:
GEOM_SOLVE_LEFT_ONLY
GEOM_SOLVE_UNIT_INTERVAL
GEOM_SOLVE_MULTIPLICITY
We have implemented closed form solvers up to degree 4 (including), because they are faster then the general iterative solver designed for higher degrees. Mathematical basis of these algorithms can be found at http://mathworld.wolfram.com/ (Cubic Equation, Quartic Equation).
Roots of the degree 5 or higher polynomials can be found with Jenkins-Traub iterative algorithm. We have translated the C++ implementation from http://www.crbond.com/ to C99 standard. Detailed description of the algorithm is beyound the scope of this documentation, but some brief comments can be found in the source file geomlib/polynomial.c.