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

1

Chapter 2
Roots of Equations
- Bisection Method

6/10/2019
2 Roots of Equations

 The two major classes of methods available to find


roots of equations. These methods can be
distinguished by the type of initial guess. They are
1. Bracketing Methods
2. Open Methods
f (x)

x=?

root
6/10/2019
3 Bracketing Methods

 This method is based on two initial guesses that


“bracket” the root, that is, the two initial guesses are
on either side of the root. The bracketing methods
always work but slowly converges to the root. The two
main bracketing methods are
1. Bisection Method
2. False Position Method

6/10/2019
4 Bisection Method

 If f (x) is real and continuous in the interval from xl to xu


and f ( xl ) and f ( xu ) have opposite signs, that is f ( x ) f ( x )  0
l u

Then there is at least one real root between xl and xu.

f (x)
f ( xu )

xl xu
f ( xl )
root

6/10/2019
5 Bisection Method
f ( xu )
f (x)

xl xu
f ( xl )
root
 The bisection method is one type of incremental search
method in which the interval is divided in half. If a function
changes sign over an interval, the function value at the
midpoint is evaluated. The location of the root is then
determined as lying at the midpoint of the subinterval within
which the sign change occurs. The process is repeated to
obtain refined estimates.

6/10/2019
6 Bisection Method

Algorithm for the Bisection Method:


Step 1: Choose lower xl and upper xu guesses for the root
such that the function changes sign over the interval.
This can be checked by ensuring the
f ( xl ) f ( xu )  0
Step 2: An estimate of the root xr is determined by

xl  xu
xr 
2

6/10/2019
7 Bisection Method

Step 3: Make the following evaluations to determine in


which subinterval the root lies:
a) If f ( xl ) f ( xr )  0, the root lies in the lower subinterval,
therefore, set xu  xr and return to step 2.

f (x)
f ( xu )  ve
f ( xr )  ve

xl xr xu
f ( xl )  ve
root

6/10/2019
8 Bisection Method

b) If f ( xl ) f ( xr )  0 , the root lies in the upper


subinterval. Therefore, set xl  xr and return to step
2.

f (x)

f ( xu )   ve

f ( xr )  ve
xl xr xu

root
f ( xl )  ve

6/10/2019
9 Bisection Method

c) If f ( xl ) f ( xr )  0 , the root equals xr , terminate the


computation.

f (x)
f ( xu )   ve

f ( xr )  0
xl xr xu
f ( xl )  ve root

6/10/2019
10 Termination Criteria and
Error Estimates

 An approximate percent relative error can be calculated as


 xr
new old
xr
a  new
100%
xr
new
where xr is the root for the current iteration and
old
xr is the root from the previous iteration. The absolute value
is used because we are usually concerned with the
magnitude of  a rather than with its sign. When  a becomes
less than the pre specified stopping criterion  s , the
computation is terminated.

6/10/2019
11 Example 1

 Determine the real root of f ( x)  5 x  5 x  6 x  2


3 2

using bisection method. Employ initial guesses of xl  0


and xu  1, iterate until the estimate error  a falls
below a level of  s  10%

6/10/2019
12 Solution

 The pre specified error criterion  s  10%


 The initial guesses are xl  0 and xu  1.
 First iteration:
xl  xu 0  1
xr    0.5
2 2
f ( xl ) f ( xr )  f (0) f (0.5)  2(0.375)  0.75  0

The new bracket is xl  0 and xu  0.5

6/10/2019
13 Solution

 Second iteration:
xl  xu 0  0.5
xr    0.25
2 2
0.25  0.5
a  100%  100%   s
0.25
f ( xl ) f ( xr )  f (0) f (0.25)  2(0.734375)  1.46875  0

The new bracket is xl  0.25 and xu  0.5

6/10/2019
14 Solution

 Third iteration:
0.25  0.5
xr   0.375
2
0.375  0.25
a  100%  33.33%   s
0.375
f ( xl ) f ( xr )  f (0.25) f (0.375)  (0.734375)(0.189453125)
 0.139129638  0
The new bracket is xl  0.375 and xu  0.5

6/10/2019
15 Solution

 Fourth iteration:

0.375  0.5
xr   0.4375
2
0.4375  0.375
a   100%  14.29%   s
0.4375
f ( xl ) f ( xr )  f (0.375) f (0.4375)  (0.189453125)(0.086669921)
 0.016419887  0

The new bracket is xl  0.375 and xu  0.4375

6/10/2019
16 Solution
 Fifth iteration:

0.375  0.4375
xr   0.40625
2
0.40625  0.4375
a  100%  7.6923%   s
0.40625

Since  a   s , the computation is terminated. After 5 iterations


and estimate of the root is 0.40625.

6/10/2019
17 Example 2

 Locate the first nontrivial root of sin x  x


3

where x is in radians. Use bisection method with the


initial interval from 0.5 to 1. Perform the computation
until  a is less than  s  2%. Also, perform an error
check by substituting your final answer into the original
equation.

6/10/2019
18 Solution

 The stopping error criterion  s  2%


 The initial guesses are xl  0.5 and xu  1
 Let f ( x)  sin x  x
3

 First iteration:
xl  xu 0.5  1
xr    0.75
2 2
f ( xl ) f ( xr )  f (0.5) f (0.75)  (0.354426)(0.2597638)  0.092067  0

Therefore, the new bracket is xl  0.75 and xu  1

6/10/2019
19 Solution

 Second iteration:

xl  xu 0.75  1
xr    0.875
2 2
0.875  0.75
a  100%  14.29%   s
0.875
f ( xl ) f ( xr )  f (0.75) f (0.875)  (0.259764)(0.0976216)  0.025359  0

The new bracket is xl  0.875 and xu  1

6/10/2019
20 Solution
 All the iterations are shown below:

Iteration xl xu xr f ( xl ) f ( xu ) f ( xl ) f ( xu ) a

1 0.5 1 0.75 + + +
2 0.75 1 0.75 + + + 14.29
3 0.87 0.875 1 0.9375 + - - 6.67
4 0.875 0.9375 0.90625 + + + 3.45
5 0.90625 0.9375 0.921875 + + + 1.69

After 5 iterations we obtain a root estimate of 0.921875 with an


approximate error of 1.69% which is below the stopping error
criterion  s  2%

6/10/2019
21 Solution

 The result can be checked by substituting into the


original equation to verify that it is close to zero:

f ( x)  sin x  x3  sin(0.921875)  (0.921875)3  0.0132774

6/10/2019

You might also like