Roots of Equations - Bisection Method

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

Chapter 2

Roots of Equations
- Bisection Method

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
f (x)
1. Bracketing Methods
2. Open Methods
x=?

root

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

Bisection Method
If f (x)

is real and continuous in the


xl from
xu
interval
tof ( xl ) and f ( xu ) and
have opposite signs, that
is
f (x ) f (x ) 0
l

Then there is at least one real root


between xl and xu .

f (x)

f ( xu )

xl
f ( xl )

xu
root

f (x)

f ( xu )

Bisection Method
The

xl
f ( xl )

xu
root

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.

Bisection Method
Algorithm for the Bisection Method:
Step 1: Choose lower xl and upperxu
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 rootxr


determined by
xl xu
xr

is

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
xu set
xr
lower subinterval, therefore,
and return to step f2.
( xu ) ve

f (x)

f ( xr ) ve

xl
f ( xl ) ve

xr

xu
root

Bisection Method
b)

If f ( xl ) f ( xr ) 0
, the root lies in the
xl xrset
upper subinterval. Therefore,
and return to step 2.
f (x)
f ( xu ) ve
f ( xr ) ve
f ( xl ) ve

xl

xr

xu
root

Bisection Method
c)

xr
If f ( xl ) f ( xr ) 0
, the root equals
terminate the computation.
f (x)
f ( xu ) ve
f ( xr ) 0
f ( xl ) ve

xl

xr

xu
root

Termination Criteria and Error


Estimates
An

approximate percent relative error can be


calculated as
new
old
x r xr
a
100%
new
xr

xr

new

where
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
a usually
concerned with the magnitude of
rather than
a
with its sign. When
becomes
s less than the pre
specified stopping criterion
, the computation is
terminated.

Example 1
Determine

the real root of

f ( x) 5 x 3 5 x 2 6 x 2

using bisection method. Employ initial


guesses of xl 0 andxu 1 , iterate until
the estimate error a falls below a level
of
s 10%

Solution
pre specified error criterion s 10%
The initial guesses are
xl 0
xu 1
and
First iteration:
The

xl xu 0 1

0 .5
2
2
f ( xl ) f ( xr ) f (0) f (0.5) 2(0.375) 0.75 0

xr

The new bracket is xl 0

and
xu 0.5

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

andxu 0.5

Solution
Third

iteration:

0.25 0.5
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)
xr

0.139129638 0

The new bracket isxl 0.375

andxu 0.5

Solution
Fourth

iteration:

0.375 0.5
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)
xr

0.016419887 0

The new bracket isxl 0.375

xu 0.4375
and

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.

Example 2
3
sin
x

x
the first nontrivial root of
where x is in radians. Use bisection
method with the initial interval from 0.5
a
to 1. Perform the computation until
s than
2%
is less
. Also, perform an
error check by substituting your final
answer into the original equation.

Locate

Solution
stopping error criterion s 2%
The initial guesses are x 0.5 and x 1
l
u
Let
f ( x) sin x x 3
First iteration:
The

xl xu 0.5 1

0.75
2
2
f ( xl ) f ( xr ) f (0.5) f (0.75) (0.354426)( 0.2597638) 0.092067 0

xr

Therefore, the new bracket is

xl 0.75and

xu 1

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 isxl 0.875

xu 1
and

Solution

All the iterations are shown below:


xl

Iteratio
n

xu

xr

f ( xl ) f ( xu ) f ( xl ) f ( xu )

0.5

0.75

0.75

0.875

14.29

0.875

0.9375

6.67

0.875

0.937
5

0.90625

3.45

After 5 iterations we obtain a root estimate of


0.9062 0.937 0.92187 +
+
+
1.69
0.921875
with
an
approximate
error
of
1.69%
5
5
5
which is below the stopping error criterion s 2%

Solution
The

result can be checked by


substituting into the original equation to
verify that it is close to zero:

f ( x) sin x x 3 sin( 0.921875) (0.921875) 3 0.0132774

You might also like