How to use it
- Type f(x), for example x^2 - 2.
- Enter a and b with a sign change between them.
- Set a tolerance, and read the root and the step table.
How it works
At each step the midpoint c = (a + b) / 2 is tested. If f(c) is 0 the search stops. Otherwise the half with the sign change is kept. The search stops when (b − a) / 2 is at most the tolerance, so the true root lies within that distance of the last midpoint.
Worked example
For f(x) = x² − 2 on [1, 2], the first midpoint is 1.5 and f(1.5) = 0.25 is positive, so the root is in [1, 1.5]. Next c = 1.25 and f is negative, so the root is in [1.25, 1.5]. After 20 steps the half-width is below 1e-6 and the result is about 1.414214, close to √2.
Tips
- If the function touches zero without crossing (like x²), there is no sign change and the method cannot start.
- If the interval holds several roots, the method finds one of them.