bracket_root#
- agabpylib.numerical.optimize.utils.bracket_root(func, xa=0.0, xb=1.0, args=(), grow_factor=1.6, maxiter=50)#
Bracket the root of a function.
This is done by considering increasingly large intervals within which the root might lie. Implicitly assumes a monotonic function.
- Parameters:
func (Callable f(x,*args)) – Objective function to minimize.
xa (float, optional) – Bracketing interval. Defaults xa to 0.0, and xb to 1.0.
xb (float, optional) – Bracketing interval. Defaults xa to 0.0, and xb to 1.0.
args (tuple, optional) – Additional arguments (if present), passed to func.
grow_factor (float, optional) – Factor by which to increase search interval, defaults to 1.6.
maxiter (int, optional) – Maximum number of tries to bracket the root, defaults to 50
- Returns:
x1, x1 (float) – The interval brackteing the root.
converged (Boolean) – If false the bracketing of the root failed.