Class quadratic_real (o2scl)

O2scl : Class List

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

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

Subclassed by o2scl::quadratic_real_coeff< double, std::complex< double > >, o2scl::quadratic_real_coeff< fp_t, cx_t >, o2scl::quadratic_real_gsl

Public Functions

inline virtual ~quadratic_real()
virtual int solve_r(const fp_t a2, const fp_t b2, const fp_t c2, fp_t &x1, fp_t &x2) = 0

Solves the polynomial \( a_2 x^2 + b_2 x + c_2 = 0 \).

If two real solutions exist (i.e. if the discriminant is non-zero) then the real roots are placed in x1 and x2 and the number 2 is returned. Otherwise, 0 is returned and x1 and x2 are unmodified.

inline virtual fp_t disc2_r(fp_t a2, fp_t b2, fp_t c2)

Compute the quadratic discriminant, \( b^2-4ac \).

If the discriminant is positive, the quadratic has two real roots, if it is zero, it has a double real root, and if it is negative then the quadratic has complex conjugate roots.

inline const char *type()

Return a string denoting the type (“quadratic_real”)