2.1 The Bisection Method
1
Basic Idea
โข Suppose function ๐(๐ฅ) is continuous on [๐, ๐], and ๐(๐), ๐(๐) have opposite signs.
โข By the Intermediate Value Theorem (IVT), there must exist an ๐ in (๐, ๐) with ๐ ๐ = 0.
โข Bisect (sub)intervals and apply IVT repeatedly.
2
โข The sequence of intervals {(๐๐ , ๐๐)}๐=1โ contains
the desired root. 3
โข Intervals containing the root: ๐1, ๐1 โ๐2, ๐2 โ ๐3, ๐3 โ ๐4, ๐4 โฆ
โข After ๐ steps, the interval ๐๐, ๐๐ has the length:
๐๐ โ ๐๐ = 12
๐โ1(๐ โ ๐)
โข Let ๐๐ =๐๐+๐๐
2 be the mid-point of ๐๐, ๐๐ . The
limit of sequence {๐๐}๐=1โ is the root.
4
The Algorithm
5
INPUT a,b; tolerance TOL; maximum number of iterations N0.
OUTPUT solution p or message of failure.
STEP1 Set i = 1;
FA = f(a);
STEP2 While i โค N0 do STEPs 3-6.
STEP3 Set p = a + (b-a)/2; // a good way of computing middle point
FP = f(p).
STEP4 IF FP = 0 or (b-a) < TOL then
OUTPUT (p);
STOP.
STEP5 Set i = i +1.
STEP6 If FPโFA > 0 then
Set a = p;
FA = FP.
else
set b = p;
STEP7 OUTPUT(โMethod failed after N0 iterationsโ);
STOP.
Matlab Code
function p=bisection(f,a,b,tol) while 1 p=(a+b)/2; if p-a<tol, break; end if f(a)*f(p)>0 a=p; else b=p; end end %while 1
6
Stopping Criteria
โข Method 1: ๐๐ โ ๐๐โ1 < ๐
โข Method 2:
|๐๐โ๐๐โ1|
|๐๐|< ๐, ๐๐ โ 0 or
๐ ๐๐ < ๐
โข None is perfect. Use a combination in real applications.
7
Convergence
โข Theorem
Suppose function ๐(๐ฅ) is continuous on [๐, ๐], and ๐ ๐ โ ๐ ๐ < 0. The Bisection method generates a sequence {๐๐}๐=1
โ approximating a zero ๐ of ๐(๐ฅ) with
๐๐ โ ๐ = 12
๐๐ โ ๐ , when ๐ โฅ 1
โข Convergence rate
The sequence {๐๐}๐=1โ converges to ๐ with the
rate of convergence ๐( 12
๐):
๐๐ = ๐ + ๐( 12
๐)
8