triqs.experimental.utility.utility.root_finder
- triqs.experimental.utility.utility.root_finder()
Dispatched C++ function(s).
[1] (method: str, f: (float) -> float, x_init: float, y_value: float, precision: float, delta_x: float, max_loops: int = 1000, x_name: str = "", y_name: str = "", verbosity: bool = False) -> tuple[float, float]
Find the value \(x\) that solves \(f(x) = y\) using the requested root-finding method.
This is the main entry point of the root finder. It first brackets the solution and then refines it with either a dichotomy or a bisection step, depending on the chosen method.
It raises an error if the method name is not recognized.
- Parameters:
- methodstr
Root-finding method, either “dichotomy” or “bisection”.
- 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\) for \(f(x)\).
- precisionfloat
Absolute precision \(|f(x) - y|\) at which the iteration stops.
- delta_xfloat
Step size used when bracketing the solution.
- max_loopsint
Maximum number of iterations.
- x_namestr
Name of the \(x\) variable, used in the progress log.
- y_namestr
Name of the \(y = f(x)\) 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.