0% found this document useful (0 votes)
27 views

Bisection Method

Numerical methods: Bisection Method Bisection Method The bisection method is a numerical technique used to find the roots of a continuous function. It is a simple and reliable method for solving nonlinear equations of the form f(x) = 0. The core idea of the bisection method is to iteratively narrow down an interval that contains the root of the function until the solution is approximated to a desired level of accuracy.

Uploaded by

JIB OYY
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
27 views

Bisection Method

Numerical methods: Bisection Method Bisection Method The bisection method is a numerical technique used to find the roots of a continuous function. It is a simple and reliable method for solving nonlinear equations of the form f(x) = 0. The core idea of the bisection method is to iteratively narrow down an interval that contains the root of the function until the solution is approximated to a desired level of accuracy.

Uploaded by

JIB OYY
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 45

Bisection Method

Prepared by: Engr. Marvin Y. Villorente

09/17/2024 1
Basis of Bisection Method
Theorem An equation f(x)=0, where f(x) is a real continuous
function, has at least one root between xl and xu if f(xl)
f(xu) < f(x)
0.

x
x
xu

Figure 1 At least one root exists between the two points if the
function is real, continuous, and changes sign.

2 http://numericalmethods.eng.usf.edu
Basis of Bisection Method
f(x)

x x
xu

Figure 2 If functionf x  does not change sign between two


points, roots of the equationf x  0 may still exist between
the two points.
3 http://numericalmethods.eng.usf.edu
Basis of Bisection Method
f(x)
f(x)

x xu
x x
x xu

f x 
Figure 3 If the function does not change sign between two
x  equation
points, there may not be any roots forf the 0
between the two points.

4 http://numericalmethods.eng.usf.edu
Basis of Bisection Method
f(x)

xu x
x

f x 
Figure 4 If the function changes sign between two points,
more than one root for thef x equation
0 may exist
between the two points.

5 http://numericalmethods.eng.usf.edu
Algorithm for Bisection
Method

6 http://numericalmethods.eng.usf.edu
Step 1
Choose xl and xu as two guesses for the root such
that f(xl) f(xu) < 0, or in other words, f(x) changes
sign between xl and xu. This was demonstrated in
Figure 1. f(x)

x
x
xu

Figure 1

7 http://numericalmethods.eng.usf.edu
Step 2
Estimate the root, xm of the equation f (x) = 0 as
the mid point between xl and xu as
f(x)

x  xu
xm =
2
x xm
x
xu

Figure 5 Estimate of xm
8 http://numericalmethods.eng.usf.edu
Step 3
Now check the following

a) If f xl  f xm   0 , then the root lies between x l


and xm; then xl = xl ; xu = xm.

b) If f xl  f xm   0 , then the root lies between x m


and xu; then xl = xm; xu = xu.
f xl  f xm  0
c) If ; then the root is xm. Stop the
algorithm if this is true.

9 http://numericalmethods.eng.usf.edu
Step 4
Find the new estimate of the root
x  xu
xm =
2
Find the absolute relative approximate error
x new  x old
m
a  m
new
100
x m

where
xmold previous estimate of root
xmnew current estimate of root

10 http://numericalmethods.eng.usf.edu
Step 5
Compare the absolute relative approximate error
a
with the pre-specified errortolerance
s .
Go to Step 2 using
Yes new upper and lower
Is a s ? guesses.

No Stop the algorithm

Note one should also check whether the number


of iterations is more than the maximum number of
iterations allowed. If so, one needs to terminate
the algorithm and notify the user about it.
11 http://numericalmethods.eng.usf.edu
Example 1
You are working for ‘DOWN THE TOILET COMPANY’
that makes floats for ABC commodes. The
floating ball has a specific gravity of 0.6 and has
a radius of 5.5 cm. You are asked to find the
depth to which the ball is submerged when
floating in water.

Figure 6 Diagram of the floating ball


12 http://numericalmethods.eng.usf.edu
Example 1 Cont.
The equation that gives the depth x to which the
ball is submerged under water is given by
x 3  0.165 x 2  3.993 10  4 0

a) Use the bisection method of finding roots of


equations to find the depth x to which the ball is
submerged under water. Conduct three iterations
to estimate the root of the above equation.
b) Find the absolute relative approximate error at
the end of each iteration, and the number of
significant digits at least correct at the end of
each iteration. Error must be less than 0.05%.

13 http://numericalmethods.eng.usf.edu
Example 1 Cont.
From the physics of the problem, the ball would be
submerged between x = 0 and x = 2R,
where R = radius of the ball,
that is
0  x 2 R
0  x 20.055
0  x 0.11

Figure 6 Diagram of the floating ball

14 http://numericalmethods.eng.usf.edu
Example 1 Cont.
Solution

To aid in the
understanding of how
this method works to find
the root of an equation,
the graph of f(x) is shown
to the right,
fwhere
x  x 3  0.165 x 2  3.993 10- 4

Figure 7 Graph of the function f(x)


15 http://numericalmethods.eng.usf.edu
Example 1 Cont.
Let us assume
x 0.00 f x   x 3  0.165 x 2  3.993 10- 4
xu 0.11
Check if the function changes sign between xl
and xu .
f xl   f 0  0   0.1650   3.993 10 3.993 10 4
3 2 4

f xu   f 0.11 0.11  0.1650.11  3.993 10 4  2.662 10 4


3 2

Hence
  
f xl  f xu   f 0  f 0.11  3.993 10 4  2.662 10 4  0

So there is at least on root between xl and xu, that is between 0


and 0.11
16 http://numericalmethods.eng.usf.edu
Example 1 Cont.

Figure 8 Graph demonstrating sign change between


17
initial limits http://numericalmethods.eng.usf.edu
Example 1 Cont.
f x   x 3  0.165 x 2  3.993 10- 4
Iteration 1 x  xu 0  0.11
x
The estimate of the root is m   0.055
2 2

f xm   f 0.055 0.055  0.1650.055  3.993 10  4 6.655 10  5


3 2

  
f xl  f xm   f 0  f 0.055  3.993 10  4 6.655 10  5  0

Hence the root is bracketed between xm and xu, that is,


between 0.055 and 0.11. So, the lower and upper limits of the
new bracket are , x 0.11
x 0.055
l u

a
At this point, the absolute relative approximate error
cannot be calculated as we do not have a previous
approximation.
18 http://numericalmethods.eng.usf.edu
Example 1 Cont.

Figure 9 Estimate of the root for Iteration 1


19 http://numericalmethods.eng.usf.edu
Example 1 Cont.
Iteration 2 x  xu 0.055  0.11
xm
The estimate of the root is   0.0825
2 2
f xm   f 0.0825 0.0825  0.1650.0825  3.993 10 4  1.622 10 4
3 2

f xl  f xm   f 0.055 f 0.0825 6.655 10 5  1.622 10 4  0

Hence the root is bracketed between xl and xm, that is,


between 0.055 and 0.0825. So, the lower and upper limits of
the new
x bracket
0.055, are
x 0.0825
l u

20 http://numericalmethods.eng.usf.edu
Example 1 Cont.

Figure 10 Estimate of the root for Iteration 2


21 http://numericalmethods.eng.usf.edu
Example 1 Cont.
a
The absolute relative approximate error at the end of
Iteration 2 is
xmnew  xmold
a  new
100
xm
0.0825  0.055
 100
0.0825
33.333%
None of the significant digits are at least correct in the estimate
root of xm = 0.0825 because the absolute relative approximate
error is greater than 0.05%.

22 http://numericalmethods.eng.usf.edu
Example 1 Cont.
Iteration 3 x  xu 0.055  0.0825
The estimate of the root xism   0.06875
2 2
f xm   f 0.06875 0.06875  0.1650.06875  3.993 10  4  5.563 10  5
3 2

f xl  f xm   f 0.055 f 0.06875 6.655 10  5  5.563 10  5  0

Hence the root is bracketed between xl and xm, that is,


between 0.055 and 0.06875. So, the lower and upper limits of
the new
x bracket
0.055, xare0.06875
l u

23 http://numericalmethods.eng.usf.edu
Example 1 Cont.

Figure 11 Estimate of the root for Iteration 3


24 http://numericalmethods.eng.usf.edu
Example 1 Cont.
a
The absolute relative approximate error at the end of
Iteration 3 is
xmnew  xmold
a  new
100
xm
0.06875  0.0825
 100
0.06875
20%
Still none of the significant digits are at least correct in the
estimated root of the equation as the absolute relative
approximate error is greater than 0.05%.
Seven more iterations were conducted and these iterations are
shown in Table 1.
25 http://numericalmethods.eng.usf.edu
Table 1 Cont.
Table 1 Root of f(x)=0 as function of number of iterations for
bisection method.
Iteration x xu xm a % f(xm)

1 0.00000 0.11 0.055 ---------- 6.655×10−5


2 0.055 0.11 0.0825 33.33 −1.622×10−4
3 0.055 0.0825 0.06875 20.00 −5.563×10−5
4 0.055 0.06875 0.06188 11.11 4.484×10−6
5 0.06188 0.06875 0.06531 5.263 −2.593×10−5
6 0.06188 0.06531 0.06359 2.702 −1.0804×10−5
7 0.06188 0.06359 0.06273 1.370 −3.176×10−6
8 0.06188 0.06273 0.0623 0.6897 6.497×10−7
9 0.0623 0.06273 0.06252 0.3436 −1.265×10−6
10 0.0623 0.06252 0.06241 0.1721 −3.0768×10−7

26 http://numericalmethods.eng.usf.edu
27 http://numericalmethods.eng.usf.edu
28 http://numericalmethods.eng.usf.edu
29 http://numericalmethods.eng.usf.edu
30 http://numericalmethods.eng.usf.edu
Table 1 Cont.
Hence the number of significant digits at least correct is given
by the largest value or m for which
a 0.5 10 2 m
0.1721 0.5 10 2 m
0.3442 10 2 m
log0.3442  2  m
m 2  log0.3442  2.463
So
m 2
The number of significant digits at least correct in the
estimated root of 0.06241 at the end of the 10th iteration is
2.
31 http://numericalmethods.eng.usf.edu
Advantages
 Always convergent
 The root bracket gets halved with
each iteration - guaranteed.

32 http://numericalmethods.eng.usf.edu
Drawbacks
 Slow convergence
 If one of the initial guesses is close
to the root, the convergence is
slower

33 http://numericalmethods.eng.usf.edu
Drawbacks (continued)
 If a function f(x) is such that it just
touches the x-axis it will be unable
to find the lower and upper guesses.
f(x)

f x   x 2

34 http://numericalmethods.eng.usf.edu
Drawbacks (continued)
 Function changes sign but root does
not exist

1
f(x)
f x  
x
x

35 http://numericalmethods.eng.usf.edu
Example 2
2. Find the root of f(x) = x2-3. Let the
accuracy/error of 0.002/0.2% and start
with the interval of [1,2].
f(a)=(1)2 – 3 = -2
f(b)=22 – 3 = 1
f(a).f(b)=(-2)(1) <0
Therefore, the root is lie between the
given interval.

36 http://numericalmethods.eng.usf.edu
1st iterartion:
c=(1+2)/2 =1.5
f(c)=1.52 – 3 = -0.75
f(a).f(c)=(-2)(-0.75) = 1.5>0
New int. [1.5,2]

2nd iteration:
c=(1.5+2)/2 = 1.75
f(c)=1.752 – 3 =0.0625
f(a).f(c)=(-0.75)(0.0625) = -0.0468<0
37
New int. [1.5,1.75] http://numericalmethods.eng.usf.edu
e=(cnew – cold)/cnew x100
e = (1.75-1.5)/1.75 x100=14.29%
3rd iteration:
c=(1.5+1.75)/2 = 1.625
f(c)=1.6252 – 3 =-0.3594
f(a)f(c)= (-0.75)(-0.3594) = 0.2695>0
NEW INT.[1.625,1.75]
e=(1.625-1.75)/1.625 x 100 = 7.69%

38 http://numericalmethods.eng.usf.edu
4th iteration:
c=(1.625+1.75)/2 =1.6875
f(c)=1.68752 – 3 = -0.1523
f(a)f(c)=(-0.3594)(-0.1523)=0.0547>0
New int.[1.6875,1.75]
e=(1.6875-1.625)/1.6875 x
100=3.704%
5th iteration:
c=(1.6875+1.75)/2 = 1.71875
f(c)=1.718752 – 3 =-0.0459
39 http://numericalmethods.eng.usf.edu
f(a)f(c) =(-0.1523)(-0.0459)=0.00699>0
New int.[1.71875, 1.75]
e=(1.71875-1.6875)/1.71875 x100 =
1.82%
6th iteration:
c=(1.71875+1.75)/2 = 1.7344
f(c)=1.73442 – 3 =0.0081
f(a)f(c)=(-0.0459)(0.0081)=-0.00037 <0
New int.[1.71875,1.7344]
e=(1.7344-1.71875)/1.7344
40 http://numericalmethods.eng.usf.edu
7th iteration:
c=(1.71875+1.7344)/2 = 1.7266
f(c) = 1.72662-3=-0.01894
f(a)f(c)=(-0.0459)(-
0.01894)=0.00087>0
New int.[1.7266,1.7344]
e=(1.7266-1.71875)/1.7266
x100=0.455%
8th iteration:
c=(1.7266+1.7344)/2 = 1.7305
41 2 http://numericalmethods.eng.usf.edu
f(a)f(c)=(-0.01894)(-0.00537) =
1.017x10-4>0
New int. [1.7305,1.7344
e=(1.7305-1.7266)/1.7305 x100 =
0.2254%

9th iteration:
c=(1.7305+1.7344)/2 = 1.73245
f(c) = 0.001383
f(a)f(c)=-0.00537(0.001383) =-
42 0.00023<0 http://numericalmethods.eng.usf.edu
e=l(1.73245-1.7305)l/1.73245 x 100
=0.1126%
ABSOLUTE ERROR<PRESCRIBED
ERROR

Therefore, the root is 1.73245 ans.

43 http://numericalmethods.eng.usf.edu
THE END
Exercise 1
1. Find the root of
f(x)=e-x(3.2sinx – 0.5 cosx) on the
interval [3,4] and absolute error
must be less than 0.1%.

2. Find the root of f(x) = x2-3. Let


the accuracy/error of 0.002/0.2%
and start with the interval of
[1,2].
45 http://numericalmethods.eng.usf.edu

You might also like