Class root_bkt (o2scl)

O2scl : Class List

template<class func_t = funct, class dfunc_t = func_t, class fp_t = double>
class root_bkt : public o2scl::root<funct, funct, double>

One-dimensional bracketing solver [abstract base].

Subclassed by o2scl::root_bkt_cern< o2scl::nstar_rot::polytrope_solve >, o2scl::root_brent_gsl< std::function< double(double)>, double >, o2scl::root_brent_gsl< funct, double >, o2scl::root_brent_gsl< std::function< cpp_dec_float_25(cpp_dec_float_25)>, cpp_dec_float_25 >, o2scl::root_brent_gsl< funct_cdf25, cpp_dec_float_25 >, o2scl::root_brent_gsl< std::function< long double(long double)>, long double >, o2scl::root_brent_gsl< funct_ld, long double >, o2scl::root_brent_gsl< std::function< cpp_dec_float_35(cpp_dec_float_35)>, cpp_dec_float_35 >, o2scl::root_brent_gsl< std::function< cpp_dec_float_50(cpp_dec_float_50)>, cpp_dec_float_50 >, o2scl::root_brent_gsl< std::function< cpp_dec_float_100(cpp_dec_float_100)>, cpp_dec_float_100 >, o2scl::root_bkt_cern< func_t >, o2scl::root_brent_gsl< func_t, fp_t >, o2scl::root_toms748< func_t, fp_t >

Public Functions

inline root_bkt()
inline virtual ~root_bkt()
inline virtual const char *type()

Return the type, "root_bkt".

virtual int solve_bkt(fp_t &x1, fp_t x2, func_t &func) = 0

Solve func in region \( x_1<x<x_2 \) returning \( x_1 \) .

inline virtual int solve(fp_t &x, func_t &func)

Solve func using x as an initial guess.

This has been updated to automatically bracket functions which are undefined away from the initial guess, but there are still various ways in which the bracketing algorithm can fail.

Todo

class root

Future: Return early if the bracketing procedure finds a root early?

inline virtual int solve_de(fp_t &x, func_t &func, dfunc_t &df)

Solve func using x as an initial guess using derivatives df.

Public Members

fp_t bracket_step

The relative stepsize for automatic bracketing (default value is zero)

If this is less than or equal to zero, then \( 10^{-4} \), will be used.

fp_t bracket_min

The minimum stepsize for automatic bracketing (default zero)

size_t bracket_iters

The number of iterations in attempt to bracket root (default 10)