Simbody
3.7

This class provides static methods for finding the roots of polynomials. More...
Classes  
class  ZeroLeadingCoefficient 
This is an exception which is thrown by all of the PolynomialRootFinder::findRoots() methods. More...  
Static Public Member Functions  
template<class T >  
static void  findRoots (const Vec< 3, T > &coefficients, Vec< 2, complex< T > > &roots) 
Find the roots of a quadratic polynomial with real coefficients. More...  
template<class T >  
static void  findRoots (const Vec< 3, complex< T > > &coefficients, Vec< 2, complex< T > > &roots) 
Find the roots of a quadratic polynomial with complex coefficients. More...  
template<class T >  
static void  findRoots (const Vec< 4, T > &coefficients, Vec< 3, complex< T > > &roots) 
Find the roots of a cubic polynomial with real coefficients. More...  
template<class T >  
static void  findRoots (const Vec< 4, complex< T > > &coefficients, Vec< 3, complex< T > > &roots) 
Find the roots of a cubic polynomial with complex coefficients. More...  
template<class T >  
static void  findRoots (const Vector_< T > &coefficients, Vector_< complex< T > > &roots) 
Find the roots of a polynomial of arbitrary degree with real coefficients. More...  
template<class T >  
static void  findRoots (const Vector_< complex< T > > &coefficients, Vector_< complex< T > > &roots) 
Find the roots of a polynomial of arbitrary degree with complex coefficients. More...  
This class provides static methods for finding the roots of polynomials.
There are specialized methods for quadratic and cubic polynomials, as well as general methods for polynomials of arbitrary degree. In each case, there are methods for polynomials with both real and complex coefficients.
There are two different algorithms used by this class. The specialized methods for quadratic polynomials calculate the roots by explicit evaluation of the quadratic formula. They use the evaluation method described in section 5.6 of "Numerical Recipes in C++, Second Edition", by Press, Teukolsky, Vetterling, and Flannery. In addition, the method for quadratic polynomials with real coefficients performs an extra check to detect when the discriminant is zero to within machine precision. This helps to prevent roundoff error from producing a tiny imaginary part in a multiple root.
The methods for cubic and arbitrary degree polynomials use the JenkinsTraub method, as implemented in the classic RPOLY and CPOLY functions:
Jenkins, M. A. and Traub, J. F. (1972), Algorithm 419: Zeros of a Complex Polynomial, Comm. ACM, 15, 9799.
Jenkins, M. A. (1975), Algorithm 493: Zeros of a Real Polynomial, ACM TOMS, 1, 178189.
This is an iterative method that provides rapid convergence and high accuracy in most cases.

static 
Find the roots of a quadratic polynomial with real coefficients.
coefficients  The polynomial coefficients in order of decreasing powers 
roots  On exit, the roots of the polynomial are stored in this 

static 
Find the roots of a quadratic polynomial with complex coefficients.
coefficients  The polynomial coefficients in order of decreasing powers 
roots  On exit, the roots of the polynomial are stored in this 

static 
Find the roots of a cubic polynomial with real coefficients.
coefficients  The polynomial coefficients in order of decreasing powers 
roots  On exit, the roots of the polynomial are stored in this 

static 
Find the roots of a cubic polynomial with complex coefficients.
coefficients  The polynomial coefficients in order of decreasing powers 
roots  On exit, the roots of the polynomial are stored in this 

static 
Find the roots of a polynomial of arbitrary degree with real coefficients.
coefficients  The polynomial coefficients in order of decreasing powers 
roots  On exit, the roots of the polynomial are stored in this 

static 
Find the roots of a polynomial of arbitrary degree with complex coefficients.
coefficients  The polynomial coefficients in order of decreasing powers 
roots  On exit, the roots of the polynomial are stored in this 