Class root_bkt (o2scl)

O2scl : Class List

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

One-dimensional bracketing solver [abstract base].

Public Functions

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

Return the type, "root_bkt".

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

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.

Idea for Future:

Return early if the bracketing procedure finds a root early?

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)