Public Member Functions | List of all members
o2scl::poly_real_coeff Class Referenceabstract

Solve a general polynomial with real coefficients and complex roots [abstract base]. More...

#include <poly.h>

Inheritance diagram for o2scl::poly_real_coeff:
o2scl::quadratic_real_coeff o2scl::cubic_real_coeff o2scl::quartic_real_coeff o2scl::quadratic_real o2scl::cubic_real o2scl::quartic_real o2scl::poly_real_coeff_gsl

Public Member Functions

virtual int solve_rc (int n, const double co[], std::complex< double > ro[])=0
 Solve the n-th order polynomial. More...
 
const char * type ()
 Return a string denoting the type ("poly_real_coeff")
 
- Public Member Functions inherited from o2scl::quadratic_real_coeff
virtual int solve_r (const double a2, const double b2, const double c2, double &x1, double &x2)
 Solves the polynomial $ a_2 x^2 + b_2 x + c_2 = 0 $ giving the two solutions $ x=x_1 $ and $ x=x_2 $ .
 
virtual int solve_rc (const double a2, const double b2, const double c2, std::complex< double > &x1, std::complex< double > &x2)=0
 Solves the polynomial $ a_2 x^2 + b_2 x + c_2 = 0 $ giving the two complex solutions $ x=x_1 $ and $ x=x_2 $.
 
const char * type ()
 Return a string denoting the type ("quadratic_real_coeff")
 
- Public Member Functions inherited from o2scl::quadratic_real
const char * type ()
 Return a string denoting the type ("quadratic_real")
 
- Public Member Functions inherited from o2scl::cubic_real_coeff
virtual int solve_r (const double a3, const double b3, const double c3, const double d3, double &x1, double &x2, double &x3)
 Solves the polynomial $ a_3 x^3 + b_3 x^2 + c_3 x + d_3= 0 $ giving the three solutions $ x=x_1 $ , $ x=x_2 $ , and $ x=x_3 $ .
 
virtual int solve_rc (const double a3, const double b3, const double c3, const double d3, double &x1, std::complex< double > &x2, std::complex< double > &x3)=0
 Solves the polynomial $ a_3 x^3 + b_3 x^2 + c_3 x + d_3= 0 $ giving the real solution $ x=x_1 $ and two complex solutions $ x=x_2 $ and $ x=x_3 $ .
 
const char * type ()
 Return a string denoting the type ("cubic_real_coeff")
 
- Public Member Functions inherited from o2scl::cubic_real
const char * type ()
 Return a string denoting the type ("cubic_real")
 
- Public Member Functions inherited from o2scl::quartic_real_coeff
virtual int solve_r (const double a4, const double b4, const double c4, const double d4, const double e4, double &x1, double &x2, double &x3, double &x4)
 Solves the polynomial $ a_4 x^4 + b_4 x^3 + c_4 x^2 + d_4 x + e_4 = 0 $ giving the four solutions $ x=x_1 $ , $ x=x_2 $ , $ x=x_3 $ , and $ x=x_4 $ .
 
virtual int solve_rc (const double a4, const double b4, const double c4, const double d4, const double e4, std::complex< double > &x1, std::complex< double > &x2, std::complex< double > &x3, std::complex< double > &x4)=0
 Solves the polynomial $ a_4 x^4 + b_4 x^3 + c_4 x^2 + d_4 x + e_4 = 0 $ giving the four complex solutions $ x=x_1 $ , $ x=x_2 $ , $ x=x_3 $ , and $ x=x_4 $ .
 
const char * type ()
 Return a string denoting the type ("quartic_real_coeff")
 
- Public Member Functions inherited from o2scl::quartic_real
const char * type ()
 Return a string denoting the type ("quartic_real")
 

Detailed Description

Definition at line 325 of file poly.h.

Member Function Documentation

◆ solve_rc()

virtual int o2scl::poly_real_coeff::solve_rc ( int  n,
const double  co[],
std::complex< double >  ro[] 
)
pure virtual

The coefficients are stored in co[], with the leading coefficient as co[0] and the constant term as co[n]. The roots are returned in ro[0],...,ro[n-1].

Implemented in o2scl::poly_real_coeff_gsl.


The documentation for this class was generated from the following file:

Documentation generated with Doxygen. Provided under the GNU Free Documentation License (see License Information).