Class cubic_real_coeff_multip (o2scl)

O2scl : Class List

class cubic_real_coeff_multip

Use multiprecision to automatically solve a cubic to a specified level of precision.

This class will fail to evalate a function with the requested precision if:

  • The user-specified input and result data type does not have enough precision to compute or store the result

  • The requested precision is near to or smaller than 1.0e-50

  • The function is noisy, non-deterministic, or is not continuous in the local neighborhood

Note

The algorithm attempts not to be wasteful, but is not necessarily optimized for speed.

Solvers

cubic_real_coeff_cern<double, std::complex<double>> q_d
cubic_real_coeff_cern<long double, std::complex<long double>> q_ld
cubic_real_coeff_cern<cpp_dec_float_25, std::complex<cpp_dec_float_25>> q_cdf25
cubic_real_coeff_cern<cpp_dec_float_35, std::complex<cpp_dec_float_35>> q_cdf35
cubic_real_coeff_cern<cpp_dec_float_50, std::complex<cpp_dec_float_50>> q_cdf50
cubic_real_coeff_cern<cpp_dec_float_100, std::complex<cpp_dec_float_100>> q_cdf100
int verbose

Verbosity parameter.

double tol_rel

Relative tolerance.

bool err_nonconv

If true, call the error handler if the function evaluation fails.

inline cubic_real_coeff_multip()
template<class fp_t, class cx_t>
inline int solve_rc_tol_err(const fp_t &a, const fp_t &b, const fp_t &c, const fp_t &d, fp_t &x1, cx_t &x2, cx_t &x3, fp_t &err, double tol_loc = -1)

Evaluate the function and return the error estimate with the specified tolerance.

template<class fp_t, class cx_t>
inline int solve_rc_err(const fp_t &a, const fp_t &b, const fp_t &c, const fp_t &d, fp_t &x1, cx_t &x2, cx_t &x3, fp_t &err)

Evaluate the function and return the error estimate with the default tolerance for the specified type.

template<class fp_t, class cx_t>
inline int solve_rc(const fp_t &a, const fp_t &b, const fp_t &c, const fp_t &d, fp_t &x1, cx_t &x2, cx_t &x3)

Evalulate the function without an error estimate.

template<class fp_t>
inline 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.