triqs.utility.bound_and_bisect.bound_and_bisect
- triqs.utility.bound_and_bisect.bound_and_bisect(f, x_0, y=0.0, dx=1.0, xtol=0.001, x_name='x', y_name='y', maxiter=1000, verbosity=1)[source]
Solve \(f(x) = y\) for a monotonic function
f.First brackets a sign change of \(F(x) \equiv f(x) - y\) via
determine_bounds(), then refines the root withscipy.optimize.bisect().- Parameters:
- fcallable
Real-valued, monotonic function of one real argument.
- x_0float
Initial guess used to start the outward bracketing search.
- yfloat, optional
Target value. Default 0.
- dxfloat, optional
Step size used by
determine_bounds(). Default 1.0.- xtolfloat, optional
Absolute tolerance on
xpassed toscipy.optimize.bisect(). Default 1e-3.- x_namestr, optional
Display name for the unknown
x, used in the textual report. Default'x'.- y_namestr, optional
Display name for the function value
y, used in the textual report. Default'y'.- maxiterint, optional
Maximum number of iterations both for the bracketing search and for the bisection step. Default 1000.
- verbosityint, optional
Verbosity level.
0suppresses output;>= 1prints the bracketing bounds and the final solution tostdout. Default 1.
- Returns:
- xfloat
Solution of \(f(x) = y\).
- fxfloat
Function value \(f(x)\) at the returned solution (should be close to
ywithin the tolerance imposed byxtol).
- Raises:
- ValueError
Propagated from
determine_bounds()if a bracketing interval cannot be found withinmaxitersteps.