The Bisection Method
We're getting into root finding now: the problem is one that you're very familiar with: find x such that
We're going to start finding roots with the simplest, most obvious method: trap one! In order to trap one, we pinch it with the Intermediate Value Theorem. So we'll require continuity of f.
This is an iterative scheme, which means that we'll be doing the same thing over and over, until satisfied. Since it's iterative, we could implement it in several ways, including having the algorithm call itself. This is called recursion. It's the most fun, but possibly quite dangerous (since one could spiral down forever and ever if not careful).
The name ``bisection'' suggests the scheme: we're going to cut an interval in half each time. So we need an interval to start, and since we're planning on using the IVT to search for a root, we need one [a,b] such that .
So the idea is this:
else
Here it is in lisp:
Theorem 2.1: Suppose that and f(a)*f(b)<0. The bisection method generates a sequence approximating a root r of f with
when .
Notice the calculation of the mean of a and b as
This is better conditioned than
in some cases: for example, with two-digit numbers chopped, and a=98 and b=99, then a+b=190; so ! That's a funny average.... But
(still bad, but at least we're still in the interval [a,b]!). On the other hand, if we don't include a stopping criterion based on a maximum number of iterations, we're in danger of looping forever....