One-dimensional root-finding routine (CERNLIB) More...
#include <root_bkt_cern.h>
This class attempts to find and
in
such that:
The function solve_bkt() requires inputs x1
and x2
such that the first condition, , already holds.
The variable root::tol_abs defaults to and root::ntrial defaults to 200.
The function solve_bkt() will call the error handler if the root is not initially bracketed. If root::err_nonconv is true (as it is by default), then the error handler will also be called if the number function evaluations is greater than root::ntrial.
After a call to solve_bkt(), root::last_ntrial contains the total number of iterations which were used
See the One-dimensional solvers section of the User's guide for general information about O2scl solvers.
Based on the CERNLIB routines RZEROX and DZEROX, which was based on Bus75 and is documented at http://wwwasdoc.web.cern.ch/wwwasdoc/shortwrupsdir/c200/top.html
Definition at line 73 of file root_bkt_cern.h.
Public Member Functions | |
int | set_mode (int m) |
Set mode of solution (1 or 2) More... | |
virtual const char * | type () |
Return the type, "root_bkt_cern" . | |
virtual int | solve_bkt (double &x1, double x2, func_t &func) |
Solve func in region ![]() ![]() | |
![]() | |
virtual int | solve (double &x, func_t &func) |
Solve func using x as an initial guess. More... | |
virtual int | solve_de (double &x, func_t &func, func_t &df) |
Solve func using x as an initial guess using derivatives df . | |
![]() | |
virtual int | print_iter (double x, double y, int iter, double value=0.0, double limit=0.0, std::string comment="") |
Print out iteration information. More... | |
Protected Member Functions | |
double | sign (double a, double b) |
FORTRAN-like function for sign. | |
Protected Attributes | |
int | mode |
Internal storage for the mode. More... | |
Additional Inherited Members | |
![]() | |
double | bracket_step |
The relative stepsize for automatic bracketing (default value is zero) More... | |
double | 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) | |
![]() | |
double | tol_rel |
The maximum value of the functions for success (default ![]() | |
double | tol_abs |
The minimum allowable stepsize (default ![]() | |
int | verbose |
Output control (default 0) | |
int | ntrial |
Maximum number of iterations (default 100) | |
bool | err_nonconv |
If true, call the error handler if the solver does not converge (default true) | |
int | last_ntrial |
The number of iterations used in the most recent solve. | |
|
inline |
1
should be used for simple functions where the cost is inexpensive in comparison to one iteration of solve_bkt(), or functions which have a pole near the root (this is the default).2
should be used for more time-consuming functions.If an integer other than 1
or 2
is specified, the error handler is called.
Definition at line 116 of file root_bkt_cern.h.
|
protected |
This internal variable is actually defined to be smaller by 1 than the "mode" as it is defined in the CERNLIB documentation in order to avoid needless subtraction in solve_bkt().
Definition at line 87 of file root_bkt_cern.h.
Documentation generated with Doxygen. Provided under the
GNU Free Documentation License (see License Information).