You are on page 1of 8

MBE2036 Engineering Computing, part 5, version 2.

0 28

Example 1 - Bisection Method


Step 1: Check the sign: xU
xL

xL=12, xU=16 f(c)


f(12)= 6.0669 > 0
f (16)= -2.2688 < 0
c

So, we have: f (xL)f(xU)<0

It mean the root is between xL (12) and xu (16)

Department of Mechanical and Biomedical Engineering City University of Hong Kong


MBE2036 Engineering Computing, part 5, version 2.0 29

Example 1 - Bisection Method


Step 2: Calculate xr :
xL xr xU

x L xU
xr Eq 5.6
=14 f(c)
2
Step 3: Check the root:
We check whether the root is actually in the
middle, upper subinterval or lower subinterval:
c
1st Iteration f(xr)=f(14)= 1.5687 > 0 f(12)f(14) > 0

It indicates that there is no sign change between xL and the midpoint xr


Therefore, the root must lies in the upper subinterval, i.e between 14 (xr) and 16 (xu)

Department of Mechanical and Biomedical Engineering City University of Hong Kong


MBE2036 Engineering Computing, part 5, version 2.0 30

Example 1 - Bisection Method (cont)


Repeat Step 2 to calculate new xr, but with xL=old
xr (14): xL= 14 and xU=16
xL x
Old U
2nd Iteration
xr =(14+16)/2=15
New
15 - 14 f(c)
a 100 6.6667%
15

a > s therefore we continue Step 3:


f(14)f(15) = 1.5687*(-0.4248)< 0
Therefore, the root lies between 14 and 15 c
Repeat Step 2 with xU=xr xL= 14 and
xU=15
14.5 - 15
xr =(14+15)/2=14.5 a 100 3.4483%
3rd Iteration 14.5
Department of Mechanical and Biomedical Engineering City University of Hong Kong
MBE2036 Engineering Computing, part 5, version 2.0 31

Example 1 - Bisection Method (cont)

a > s therefore we continue Step 3:


f(14)f(14.5) =1.5687*0.5523=0.8664 >0
Repeat Step 2 with xL=xr xL= 14.5 and xU=15
4th Iteration xr =(14.5+15)/2=14.75

14.75 - 14.5
a 100 1.6949%
14.75

a > s therefore we continue Step 3.

Department of Mechanical and Biomedical Engineering City University of Hong Kong


MBE2036 Engineering Computing, part 5, version 2.0 32

Example 1 - Bisection Method (cont)


xL=12, xU=16
1st Iteration
12 14 16 xr=14

f (xL)f(xr)>0

xL=14, xU=16
2nd Iteration
12 14 16 xr=15
f (xL)f(xr)<0

xL=14, xU=15
3rd Iteration
12 14 16 xr=14.5
f (xL)f(xr)>0

xL=14.5, xU=15
4th Iteration
12 14 16 xr=14.75

Department of Mechanical and Biomedical Engineering City University of Hong Kong


MBE2036 Engineering Computing, part 5, version 2.0 33

Example 1 - Bisection Method (cont)

The result is as Iteration xL xU xr a (%)


shown in the 1 12 16 14
table on the
right 2 14 16 15 6.667

3 14 15 14.5 3.448

4 14.5 15 14.75 1.695

5 14.75 15 14.875 0.840

a < s so it stops 6 14.75 14.875 14.8125 0.422

The true root is 14.7802085

Department of Mechanical and Biomedical Engineering City University of Hong Kong


MBE2036 Engineering Computing, part 5, version 2.0 37

Error Analysis for Bisection Method (cont)


xrnew xrold
a 100% Eq 5.7 and a s
xrnew

xU xL
2 x xL
a 100% U 100% Eq 5.10
xU xL xU xL
2

Equation 5.10 produce the same result as Eq


5.7 for bisection method
Unlike Eq 5.7, Eq 5.10 can be used to calculate
a for the initial guesses

Department of Mechanical and Biomedical Engineering City University of Hong Kong


MBE2036 Engineering Computing, part 5, version 2.0 38

Error Analysis for Bisection Method (cont)

Besides the ability to analysis the exact upper bound of the true error
The bisection method also allows us to calculate the number of iterations
required to obtain an absolute error before starting the iterations
Before starting the technique, the absolute error is:
EA0=xU0 xL0 = x0
After the first iteration, the error becomes:
EA1 = x0/2
Because each succeeding iteration halves the error, a general formula
relating the error and the number of iterations, n, is:
x 0 This is the maximum error
E An Eq 5.11
2n
If EA,d is the desired error, the above equation can be written as:
x 0
log

x 0 x 0
E A,d
2n n log 2n log n
EA E A,d log 2
x 0
n log 2
Eq 5.12
E A,d
Department of Mechanical and Biomedical Engineering City University of Hong Kong

You might also like