triqs.experimental.utility.utility.dichotomy

triqs.experimental.utility.utility.dichotomy()

Dispatched C++ function(s).

[1] (f: (float) -> float,
     x_low: float,
     x_high: float,
     y_target: float,
     precision: float,
     max_loops: int,
     x_name: str,
     y_name: str,
     verbosity: bool)
  -> tuple[float, float]

Solve \(f(x) = y\) on a bracketing interval using the false-position (dichotomy) method.

Given an interval \([x_\mathrm{low}, x_\mathrm{high}]\) that brackets the target value, this method iteratively replaces one of the bounds with the linear (secant) estimate of the root until the residual drops below the requested precision.

It raises an error if convergence is not reached within max_loops iterations.

Parameters:
f(float) -> float

Function \(f(x) : \mathbb{R} \to \mathbb{R}\) whose root is sought.

x_lowfloat

Lower bound of the bracketing interval.

x_highfloat

Upper bound of the bracketing interval.

y_targetfloat

Target value \(y\) for \(f(x)\).

precisionfloat

Absolute precision \(|f(x) - y|\) at which the iteration stops.

max_loopsint

Maximum number of iterations.

x_namestr

Name of the \(x\) variable, used in the progress log.

y_namestr

Name of the \(y\) variable, used in the progress log.

verbositybool

Whether to print the convergence progress.

Returns:
tuple[float, float]

Pair \((x, f(x))\) with \(f(x) = y\) within the requested precision.