pub enum RootMethod {
Bisection,
Brent,
}Expand description
Which derivative-free bracketed method solve_bracketed_batch should run.
Both methods keep a bracket [a, b] across which the residual changes sign
and shrink it until it meets the tolerance, so both are guaranteed to
converge on a continuous residual that is genuinely bracketed. They differ
only in how fast.
§Units
Dimensionless — a mode selector, not a quantity.
Variants§
Bisection
Repeated bisection of the bracket.
One residual evaluation per iteration, and the bracket width halves
every time, so reaching a relative tolerance of 1e-12 from an
order-unity bracket costs about 40 evaluations regardless of the
function. Slow but utterly unshakeable: it cannot be defeated by a kink,
a plateau, or a badly conditioned derivative.
Brent
Brent’s method — inverse quadratic interpolation and the secant rule, falling back to bisection whenever the interpolated step misbehaves.
The default, and the right choice unless you have a specific reason to
want bisection’s fixed cost. Superlinear on a smooth residual: the same
1e-12 tolerance typically costs 6-12 evaluations instead of 40, while
retaining bisection’s guarantee because every step that would leave the
bracket or shrink it too slowly is replaced by a bisection step.
Implemented from the published description of the algorithm (R. P. Brent, Algorithms for Minimization without Derivatives, Prentice-Hall 1973, chapter 4), not transcribed from any existing implementation.