Celeritas
0.5.0-56+6b053cd
|
Perform Bisection iterations given a root function func and tolerance tol . More...
#include <BisectionRootFinder.hh>
Public Member Functions | |
CELER_FUNCTION | BisectionRootFinder (F &&func, real_type tol) |
Construct from function. | |
CELER_FUNCTION real_type | operator() (real_type left, real_type right) |
Solve for a root between the two points. | |
Perform Bisection iterations given a root function func and tolerance tol .
Using a left and right bound a Bisection approximates the root as:
\[ root = 0.5 * (left + right) \]
Then value of func at the root is calculated compared to values of func at the bounds. The root is then used update the bounds based on the sign of func(root) and whether it matches the sign of func(left) or func(right) . Performing this update of the bounds allows for the iteration on root, using the convergence criteria based on func(root) proximity to 0.