triqs.experimental.utility.utility.find_bounds

triqs.experimental.utility.utility.find_bounds()

Dispatched C++ function(s).

[1] (f: (float) -> float,
     x_init: float,
     y_value: float,
     delta_x: float,
     precision: float,
     max_loops: int = 1000)
  -> tuple[float, float]

Find a lower and an upper bound that bracket the solution of \(f(x) = y\).

Starting from an initial guess, this function steps along \(x\) in increments of delta_x until the target value \(y\) is bracketed by the function values at the two most recent points (or until the maximum number of steps is reached). The returned bounds are ordered such that the first is smaller than the second.

Parameters:
f(float) -> float

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

x_initfloat

Initial guess for \(x\).

y_valuefloat

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

delta_xfloat

Step size by which \(x\) is incremented.

precisionfloat

Absolute precision \(|f(x) - y|\) used to stop the search early.

max_loopsint

Maximum number of steps.

Returns:
tuple[float, float]

Pair \((x_1, x_2)\) with \(x_1 \leq x_2\) whose function values bracket \(y\).