Download as pdf or txt
Download as pdf or txt
You are on page 1of 1

1.3.

THE BISECTION METHOD

y y = f (x) (a n , f (an ))

bn 0 an x n+1 p x (b n , f (bn ))
Figure 1.1. The nth step of the bisection method. or between

a+b 2

and b,

if f

a+b 2

f (b) < 0,

or exactly at a+b a+b = 0. , if f 2 2 The nth step of the bisection method is shown in Fig. 1.1. The algorithm of the bisection method is as follows. Algorithm 1.1 (Bisection Method). Given that f (x) is continuous on [a, b] and f (a) f (b) < 0: (1) Choose a0 = a, b0 = b; tolerance N ; maximum number of iteration N0 . (2) For n = 0, 1, 2, . . . , N0 , compute an + b n . 2 If f (xn+1 ) = 0 or (bn an )/2 < T OL, then output p (= xn+1 ) and stop. Else if f (xn+1 ) and f (an ) have opposite signs, set an+1 = an and bn+1 = xn+1 . Else set an+1 = xn+1 and bn+1 = bn . Repeat (2), (3), (4) and (5). Ouput Method failed after N0 iterations and stop. xn+1 =

(3) (4) (5) (6) (7)

Other stopping criteria are described in Subsection 1.4.1. The rate of convergence of the bisection method is low but the method always converges. The bisection method is programmed in the following Matlab function M-le which is found in ftp://ftp.cs.cornell.edu/pub/cv. function root = Bisection(fname,a,b,delta) % % Pre: % fname string that names a continuous function f(x) of % a single variable. % % a,b define an interval [a,b] % f is continuous, f(a)f(b) < 0 %

You might also like