Module bisection

Module bisection 

Source
Expand description

Bisection method for root finding

Implements the bisection method which guarantees convergence for continuous functions with a sign change in the interval. Uses interval halving to iteratively narrow down the root location.

§Algorithm

Given f(a) and f(b) with opposite signs:

  1. Compute midpoint: c = (a + b) / 2
  2. If f(c) has same sign as f(a), replace a with c
  3. Otherwise, replace b with c
  4. Repeat until |b - a| < tolerance

§Convergence

  • Guaranteed convergence if f is continuous and f(a)*f(b) < 0
  • Linear convergence rate: error halves each iteration
  • Requires O(log2((b-a)/tolerance)) iterations

§Tolerance Semantics

The algorithm stops when EITHER:

  • |f(c)| < tolerance (function value criterion)
  • |b - a| / 2 < tolerance (bracket width criterion)

The bracket width criterion guarantees the root is within tolerance distance of the returned value.

Structs§

BisectionMethod
Bisection method root finder