Professional Documents
Culture Documents
Applied Numerical Methods: Dr. Khaled Ahmida Al-Ashouri The Libyan Academy - Tripoli
Applied Numerical Methods: Dr. Khaled Ahmida Al-Ashouri The Libyan Academy - Tripoli
ROOT FINDING
Almost all root-finding methods are iterative
Start from an initial guess and improve solution until
convergence satisfied
Initial guess can be improved by plotting equation
Simplest: Bracketing methods Bisection & False-
Position
Numerical Analysis Course
Dr. Khaled Ahmida
ROOT FINDING
ELEMENTARY
Bisection Method
False Position Method
… others
PRACTICAL
Newton-Raphson’s Method, Brent’s algorithm, Laguerre’s method
Numerical Analysis Course
Dr. Khaled Ahmida
BISECTION METHOD
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) < 0.
f(x)
x
x
xu
BISECTION METHOD
f(x)
x x
xu
Figure 2 Function does not change sign between two points but roots exist
Numerical Analysis Course
Dr. Khaled Ahmida
BISECTION METHOD
f(x)
xu
x
x
Figure 3 If the function changes sign between two points, at least one root exists
Numerical Analysis Course
Dr. Khaled Ahmida
Step 2:
Estimate the root xm of the equation f(x)=0 as the mid-point between xl
and xu as
x xu
xm =
2
Numerical Analysis Course
Dr. Khaled Ahmida
BISECTION METHOD
Step 3:
check the following
a) If f xl f xm 0 then the root lies between xl and xm; then
xl = xl ; xu = xm Continue process (step 4)
BISECTION METHOD
Step 4:
Find the new estimate of the root
x xu
xm =
2
Find absolute relative approximate error (criteria to stop)
xmnew xmold
a new
100
xm
Or check if f ( xm ) s
Numerical Analysis Course
Dr. Khaled Ahmida
BISECTION METHOD
Step 5:
Compare the absolute relative approximate error a with the pre-
specified error tolerance s (usually ~10-6)
Go to Step 2 using new
No upper and lower
Is a s ? guesses.
Input xl,xu,f, s
BISECTION METHOD
xm=(xl+xu)/2
yes
f(xm)=<s Root=xm
no
BISECTION METHOD
Advantages:
always converges
brackets halved in every step f(x)=1/x
1
Drawbacks: 0.9
methods 0.7
0.6
if one initial guess is close to root, it converges 0.5
slowly 0.4
all 1
0.2
f x 0.1
x 0
0 10 20 30 40 50 60 70 80 90 100
Numerical Analysis Course
Dr. Khaled Ahmida
BISECTION METHOD
Example 1: solve the following equation using Bisection
method
f x e x sin( x) 2.1
x 2
1
Graph of the function f(x)
0.8
0.4
0.2
f(x)
0
-0.2
-0.4
-0.6
-0.8
-1
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
x
Numerical Analysis Course
Dr. Khaled Ahmida
BISECTION METHOD
False-Position Method
Numerical Analysis Course
Dr. Khaled Ahmida
FALSE-POSITION METHOD
f(xu)
f(x)
Equal angles
xl xr xu
x
x*
f(xr)
f(xl)
Numerical Analysis Course
Dr. Khaled Ahmida
FALSE-POSITION METHOD
Start with [xl,xu] with f(xl)*f(xu) < 0
Draw a straight line to approximate the root
f ( xu ) xl f ( xl ) xu
f ( xr ) 0 xr
f ( xu ) f ( xl )
Check signs of f(xl)*f(xr) and f(xr)*f(xu) so that [xl , xu ]
always bracket the root
Numerical Analysis Course
Dr. Khaled Ahmida
FALSE-POSITION METHOD
Step 1: Choose xl and xu
Step 2 : Estimate the root by finding the intersection of the
line connecting the two points (xl,f(xl)), and (xu,f(xu)) and the x-
axis
f ( xu ) xl f ( xl ) xu
xr
f ( xu ) f ( xl )
Numerical Analysis Course
Dr. Khaled Ahmida
FALSE-POSITION METHOD
Step 3: Determine the new bracket
If f(xr)*f(xl) >0 then xl= xr else xu= xr
a 100
m m
new
x m
Numerical Analysis Course
Dr. Khaled Ahmida
FALSE-POSITION METHOD
f(x)
xu,f(xu)
Second iteration
xr,0
o x
xl,f(xl)
Numerical Analysis Course
Dr. Khaled Ahmida
FALSE-POSITION METHOD
input data
Algorithm
check if
f(xl)*f(xu) < 0
otherwise choose another limits
no yes
If f(xr)f(xl) < 0 Solution
then xu = xr obtaind
else xl = xr xr
end
Numerical Analysis Course
Dr. Khaled Ahmida
FALSE-POSITION METHOD
Example: Solving the previous equation solved before by
Bisection method in the range of x=[0,1]
f x e x x 2 sin( x) 2.1
FALSE-POSITION
Numerical Analysis Course
Dr. Khaled Ahmida
COMPARISON OF METHODS
Usually False-Position converges faster
than Bisection
Errors usually converge in a zigzag
manner, like in Bisection Method
There are cases when False-Position
converges slowly. An example is
f x x10 1
Numerical Analysis Course
Dr. Khaled Ahmida
COMPARISON OF METHODS 14
12
f x x 1
10
10
8
-2
0 0.2 0.4 0.6 0.8 1 1.2 1.4
This example shows a drawback
of False-Position method
Numerical Analysis Course
Dr. Khaled Ahmida
COMPARISON OF METHODS
Slow convergence of f x x10 1
by False-Position method
One solution is to use Modified
False-Position. Determine which bound
stays fixed (stuck) and divide it by half.
Modified False-Position is not covered in
this course.
Numerical Analysis Course
Dr. Khaled Ahmida
COMPARISON OF METHODS
f x x10 1
using
Bisection
Numerical Analysis Course
Dr. Khaled Ahmida
COMPARISON OF METHODS
f x x10 1
using
False-position
…….