bisec_method

paminco.utils.bisec.bisec_method(func, tol=0.01, lo=None, up=None, debug=False, flex_up=False, increasing=None)[source]

Execute the bisection method to find a root of func.

Parameters
func: function-handle

the function

tol: float or tuple

the error tolerance. Can be given as float, then return a solution x with -tol <= f(x) <= tol. Can also be specified as tuple tol = (tol[0], tol[1]). In this case, return x with tol[0] <= f(x) <= tol[1]

lo: float

lower bound on the root

up: float

upper bound on the root

debug: bool

If true, print debug information

flex_up: bool

Flexible upper bound flag: If True, the function checks if func(up) > 0 and increases up if this is not the case. If False, func(up) > 0 is assumed implicitely

If lo and up are not given, lo is assumed to be 0 and up is determined
automatically.