Celeritas 0.7.0-dev.127+develop.e63889793
|
Find a local root using the bisection algorithm. 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. | |
Find a local root using the bisection algorithm.
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.