Bisection stopping criterion
ID: bisection-stopping-criterion
For a requested absolute tolerance , stop when the retained root bracket has width at most , and report its midpoint. The bisection error bound then guarantees in exact arithmetic. Using the ceiling function and the base-two logarithm, the required number of halvings isThe zero allows stopping before any update when the initial root bracket is already sufficiently narrow. For the polynomial on with , . After nine halvings,Thus the reported midpoint meets the tolerance; its actual error from the square root is approximately . After eight halvings the bound is , so eight do not give this worst-case guarantee.
Cache the endpoint values. Each update of the bisection method needs just one new function evaluation, at the old midpoint. With no early zero of a function, updates therefore cost function evaluations, including the two initial endpoints. Returning the new midpoint requires no additional function evaluation; requesting its value would add one. The nine-update example needs eleven evaluations for the guarantee.
A small function value alone does not guarantee a small position error: rescaling changes those values without changing its zeros of a function. In a practical implementation, use an explicit width test and an iteration limit. With floating-point arithmetic, also stop if the computed midpoint equals either endpoint: the root bracket can no longer shrink, so repeating the update would loop forever. Report this precision limit separately if the requested tolerance remains unmet. Reliable sign evaluations are needed to preserve the root bracket; compare signs directly rather than multiplying endpoint values, which can suffer overflow or underflow in floating-point arithmetic.
For a rounded midpoint still inside a valid root bracket, the geometric error bound is ; it need not equal because of roundoff error. A rigorous computed enclosure also needs conservative arithmetic for that bound and reliable endpoint signs. The exact-arithmetic bisection error bound should not be claimed unchanged after precision prevents further halving.
For practical tolerance conventions, SciPy's
bisect combines absolute and relative tolerances through , and provides a maximum iteration count and convergence status. These differ from the purely absolute width test above.[ref]https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.bisect.html. SciPy, scipy.optimize.bisect documentation
New to topics? Read the docs here!