Class quartic_real (o2scl)¶
-
template<class fp_t = double>
class quartic_real : public o2scl::poly_real_base<double>¶ Solve a quartic polynomial with real coefficients and real roots [abstract base].
Subclassed by o2scl::quartic_real_coeff< double, std::complex< double > >, o2scl::quartic_real_coeff< fp_t, cx_t >, o2scl::quartic_real_std< fp_t >
Public Functions
-
inline virtual ~quartic_real()¶
-
virtual int solve_r(const fp_t a4, const fp_t b4, const fp_t c4, const fp_t d4, const fp_t e4, fp_t &x1, fp_t &x2, fp_t &x3, fp_t &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 solutions \( x=x_1 \) , \( x=x_2 \) , \( x=x_3 \) , and \( x=x_4 \) .
-
inline virtual fp_t disc4_r(const fp_t a, const fp_t b, const fp_t c, const fp_t d, const fp_t e)¶
Compute the quartic discriminant.
The discriminant is zero if and only if at least two roots are equal. If the discriminant is non-zero, the discriminant is negative if there are two real roots and two complex conjugate roots, and it is positive if the roots are either all real or all non-real.
-
inline virtual void diag_r(const fp_t a, const fp_t b, const fp_t c, const fp_t d, const fp_t e, fp_t &disc, fp_t &P, fp_t &R, fp_t &disc_0, fp_t &D, size_t &n_real, size_t &root_type)¶
Evaluate diagnostic quantities for a quartic.
If disc is negative, then the quartic has two distinct real roots and two complex conjugate roots. If disc is positive and P and D are both negative, then all four roots are real and distinct. If disc is positive and either P or D are positive, then there are two pairs of complex conjugate roots. If disc is zero, then the polynomial has a multiple root, and the following cases hold
P<0 and D<0 and disc_0 non-zero: one real double root and two real roots
D>0 or (P>0 and (D nonzero or R nonzero)) real double root and two complex conjugate roots
disc_0=0 and D non-zero: triple real root and a real root
D=0 and P<0: two real double roots
D=0 and P>0 and R=0: two complex conjugate double roots
D=0 and disc_0=0, all four roots are equal to -b/4/a. These possibilities correspond to different values of
n_real
andreal_type
root_type=0 (n_real=0, n_real=2 or n_real=4) : all real roots are distinct
root_type=1 (n_real=2 or n_real4): one double root
root_type=2 : two double roots
root_type=3 (n_real=4): one triple root and one fourth distinct real root
root_type=4 (n_real=4): all real roots equal to -b/4/a
root_type=5 (n_real=0): two complex conjugate double roots
Following https://en.wikipedia.org/wiki/Quartic_function .
-
inline size_t test_real_roots(fp_t alpha, fp_t &s1, fp_t &m1, size_t n = 9)¶
Test \( n^4 \) quartics with real roots.
-
inline const char *type()¶
Return a string denoting the type (“quartic_real”)
-
inline virtual ~quartic_real()¶