Class cubic_real (o2scl)

O2scl : Class List

template<class fp_t = double>
class cubic_real : public o2scl::poly_real_base<double>

Solve a cubic polynomial with real coefficients and real roots [abstract base].

Subclassed by o2scl::cubic_real_coeff< double, std::complex< double > >, o2scl::cubic_real_coeff< double >, o2scl::cubic_real_coeff< cpp_dec_float_25, std::complex< cpp_dec_float_25 > >, o2scl::cubic_real_coeff< long double, std::complex< long double > >, o2scl::cubic_real_coeff< cpp_dec_float_35, std::complex< cpp_dec_float_35 > >, o2scl::cubic_real_coeff< cpp_dec_float_50, std::complex< cpp_dec_float_50 > >, o2scl::cubic_real_coeff< cpp_dec_float_100, std::complex< cpp_dec_float_100 > >, o2scl::cubic_real_coeff< fp_t, cx_t >

Public Functions

inline virtual ~cubic_real()
virtual int solve_r(const fp_t a3, const fp_t b3, const fp_t c3, const fp_t d3, fp_t &x1, fp_t &x2, fp_t &x3) = 0

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 \) .

inline virtual fp_t disc3_r(const fp_t a3, const fp_t b3, const fp_t c3, const fp_t d3)

Compute the cubic discriminant, \( b^2 c^2 - 4 a c^3 - 4 b^3 d - 27 a^2 d^2 + 18 a b c d \).

If the discriminant is zero, then all roots qre real and
at least two are equal (possibly all three are identical).
If the discriminant is positive, then there are 
three distinct real roots, and if the discriminant is negative
then there is one real root and two complex conjugate
roots.
inline const char *type()

Return a string denoting the type (“cubic_real”)