Professional Documents
Culture Documents
C4L2 Bisection Methods
C4L2 Bisection Methods
C4L2 Bisection Methods
Roots of Equations
• Bracketing Methods
- Bisection Method
Introduction
Findingthe roots of equation (or solving
the equation) is a process to find the
values of x such that this value satisfies the
equation.
Introduction
Example:
Solve for x in the equation
4 sin 3 x 2 sin 2 x 2 sin x 1 0
The answers to this question are x=−0.5235988,
x=0.785398, x=−0.785398.
Now, when we substitute x=−0.5235988 into
the equation
4 sin 3 (0.5235988) 2 sin 2 (0.5235988) 2 sin( 0.5235988) 1 0
it gives zero which is in agreement to the right
hand side of the equation.
Introduction
Ingeneral, it is very hard to solve the
equation or finding the roots of the
equation.
Example: how to solve the following
equation analytically?
1 sinh( x)
sin x ln( x 2 1) 2e cos x 1
1 tanh( x)
Introduction
Any equations can be drafted in the
diagram.
cos x 1 1 sinh( x)
Let f ( x ) sin x ln( x 2
1) 2e
1 tanh( x)
y
f (x)
x0 = ?
x
root f ( x0 ) 0
Roots of Equation
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
y
1. Bracketing Methods f (x)
2. Open Methods
x0 = ?
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
How to know that the initial guesses are
on either side of the root?
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 ( xl ) f ( xu ) 0
Then there is at least one real root
between xl and xu . f (x)
f ( xu ) ve
xl xu
f ( xl ) ve
root
f ( xu )
f (x)
Bisection Method xl xu
f ( xl )
root
Bisection Method xl xr xu
root
Algorithm for the Bisection Method:
Step 1: Choose lower x l 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
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 f (x)
return to step 2. f ( xu ) ve
f ( xr ) ve
xl xr xu
f ( xl ) ve
root
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
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
Termination Criteria and Error
Estimates
An approximate percent relative error can be
calculated as
new old
x r xr
a new
100%
xr
new
where
old
xr is the root for the current iteration and
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.
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 and xu 1 , iterate until
the estimate error a falls below a level of
s 10%
Solution
The pre specified error criterion s 10%
The initial guesses are xl 0 and xu 1 .
Check: f (0) 2, f (1) 4, f (0) f (1) 2 4 8 0
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
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
Iteration xl xu xr f ( xl ) f ( xr ) f ( xl ) f ( xr ) a
1 0.5 1 0.75 + + +
2 0.75 1 0.875 + + + 14.29
3 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%
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 0