Nonlinear Equations
Methods for finding roots of equations f(x) = 0. Default function:
Bisection Method
Theory
The bisection method finds a root by repeatedly halving an interval where and have opposite signs.
If · < 0, then root is in ; otherwise in .
Convergence rate: — linear convergence
Interactive Visualizer
Custom function (press Enter or Apply)
f(x) =
Initial a
Initial b
Tolerance ε
Implementation
INPUT: f, a, b, TOL, max_iter
OUTPUT: approximate root c
for n = 1, 2, ..., max_iter:
c = (a + b) / 2
if f(b) * f(c) > 0:
b = c
else:
a = c
if |b - a| < TOL:
RETURN c
RETURN "Method failed"