Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
Learning Objectives
2
ROOTS OF EQUATIONS
3
Content
• Bisection Method
• False position Method
• Newton’s Method
• Secant Method
• Fixed point Method
Bisection Method
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) < 0.
f(x)
x
x
xu
Figure 1 At least one root exists between the two points if the function is
real, continuous, and changes sign.
Basis of Bisection Method
Figure 2 If function f (x ) does not change sign between two points, roots
of the equation f (x ) = 0 may still exist between the two points.
f(x)
x x
xu
Basis of Bisection Method
Figure 3 If the function f (x ) does not change sign between two
points, there may not be any roots for the equation f (x ) = 0 between the
f(x)
two points. f(x)
x xu
x x
x xu
Basis of Bisection Method
f(x)
xu x
x
x
x
xu
Figure 1
Step 2
Estimate the root, xm of the equation f (x) = 0 as the mid
point between x and xu as
f(x)
x + xu
xm =
2
x xm
x
xu
Figure 5 Estimate of xm
Step 3
Now check the following
a = 100
m m
new
x m
where
xmold = previous estimate of root
xmnew = current estimate of root
Step 5
Compare the absolute relative approximate error a with
the pre-specified error tolerance s .
Go to Step 2 using new
Yes upper and lower
Is a s ? guesses.
15
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.
0 x 2R
0 x 2(0.055)
0 x 0.11
Solution
Hence
( )( )
f (xl ) f (xu ) = f (0) f (0.11) = 3.99310−4 − 2.66210−4 0
So there is at least on root between x and xu, that is between 0 and 0.11
20
Example 1 Cont.
( )( )
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
xl = 0.055, xu = 0.11
At this point, the absolute relative approximate error a cannot be
calculated as we do not have a previous approximation.
Example 1 Cont.
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 5%.
Example 1 Cont.
( )( )
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 x and xm, that is, between 0.055
and 0.06875. So, the lower and upper limits of the new bracket are
xl = 0.055, xu = 0.06875
Example 1 Cont.
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 5%.
Seven more iterations were conducted and these iterations are shown in
Table 1.
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)
• Always convergent
• The root bracket gets halved with each
iteration - guaranteed.
Drawbacks
◼ Slow convergence
◼ If one of the initial guesses is close to
the root, the convergence is slower
Drawbacks (continued)
f(x)
f (x ) = x 2
x
Drawbacks (continued)
f (x ) =
f(x)
1
x
x
Newton-Raphson
Method
Newton-Raphson Method
f(x)
f(xi)
x f (x )
i, i
xi +1 = xi -
f(xi )
f (xi )
f(xi-1)
xi+2 xi+1 xi X
f(x)
AB
f(xi) B tan( ) =
AC
f ( xi )
f ' ( xi ) =
xi − xi +1
C A X f ( xi )
xi +1 = xi −
f ( xi )
xi+1 xi
39
Step 2
40
Step 3
xi +1- xi
a = 100
xi +1
41
Step 4
f (x ) = x3-0.165x 2+3.99310- 4
Figure 3 Floating ball problem.
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,
where
f (x ) = x3-0.165x 2+3.99310- 4
Figure 4 Graph of the function f(x)
45
Example 1 Cont.
f (x ) = x 3-0.165x 2+3.99310- 4
f ' (x ) = 3x 2-0.33x
Let us assume the initial guess of the root of f ( x ) = 0
is x0 = 0.05m . This is a reasonable guess (discuss why
x = 0 and x = 0.11m are not good choices) as the
extreme values of the depth x would be 0 and the
diameter (0.11 m) of the ball.
Example 1 Cont.
Iteration 1
f (x ) = x3-0.165x 2+3.99310- 4
The estimate of the root is
f ( x0 )
x1 = x0 −
f ' ( x0 )
= 0.05 −
(0.05)
3
− 0.165(0.05) + 3.993 10 − 4
2
3(0.05) − 0.33(0.05)
2
1.118 10 − 4
= 0.05 −
− 9 10 −3
= 0.05 − (− 0.01242 )
= 0.06242
Example 1 Cont.
f (x1 )
x2 = x1 −
f ' (x1 )
= 0.06242 −
(0.06242 ) − 0.165(0.06242 ) + 3.993 10 − 4
3 2
3(0.06242 ) − 0.33(0.06242 )
2
− 3.97781 10 −7
= 0.06242 −
− 8.90973 10 −3
(
= 0.06242 − 4.4646 10 −5 )
= 0.06238
Example 1 Cont.
2− m
The maximum value of m for which a 0.5 10 is 2.844.
Hence, the number of significant digits at least correct in the
answer is 2.
Example 1 Cont.
f (x ) = x3-0.165x 2+3.99310- 4
Iteration 3
The estimate of the root is
f ( x2 )
x3 = x2 −
f ' ( x2 )
= 0.06238 −
(0.06238 ) − 0.165(0.06238 ) + 3.993 10 −4
3 2
3(0.06238 ) − 0.33(0.06238 )
2
roots.
Drawbacks – Oscillations near local
maximum and minimum
f (xi ) a %
Iteration
Number xi 4
–1.0000
3
0 3.00 3
4. Root Jumping
In some cases where the function f ( x ) is oscillating and has a number
of roots, one may choose an initial guess close to a root. However, the
guesses may jump and converge to some other root.
1.5
f(x)
For example 1
f ( x ) = sin x = 0 0.5
x
Choose 0
x0 = 2.4 = 7.539822
-2 0 2 4 6 8 10
-0.06307 0.5499 4.461 7.539822
-0.5
x = 2 = 6.2831853
-1.5
E D A
On rearranging, the secant
xi+1 xi-1 xi
X
method is given as
f ( xi )( xi − xi −1 )
Figure 2 Geometrical representation of xi +1 = xi −
the Secant method. f ( xi ) − f ( xi −1 )
Algorithm for Secant Method
Step 1
Calculate the next estimate of the root from two initial guesses
f ( xi )( xi − xi −1 )
xi +1 = xi −
f ( xi ) − f ( xi −1 )
Find the absolute relative approximate error
xi +1- xi
a = 100
xi +1
Step 2
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,
where
f (x ) = x3-0.165x 2+3.99310- 4
Iteration 1
The estimate of the root is
f (x0 )(x0 − x−1 )
x1 = x0 −
f (x0 ) − f (x−1 )
= 0.05 −
(0.05 − 0.165(0.05) + 3.99310 )(0.05 − 0.02)
3 2 −4
= 0.06461
Example 1 Cont.
Iteration 2
The estimate of the root is
f (x1 )(x1 − x0 )
x2 = x1 −
f (x1 ) − f (x0 )
= 0.06461 −
(0.06461 − 0.165(0.06461) + 3.993 10 )(0.06461 − 0.05)
3 2 −4
= 0.06241
Example 1 Cont.
Iteration 3
The estimate of the root is
f (x2 )(x2 − x1 )
x3 = x2 −
f (x2 ) − f (x1 )
= 0.06241 −
(0.06241 − 0.165(0.06241) + 3.993 10 )(0.06241 − 0.06461)
3 2 −4
= 0.06238
Example 1 Cont.
2
2
f ( x)
0
f ( x) 0
f ( x)
−2 2
10 5 0 5 10
− 10 x x guess1 x guess2 10
f(x)
prev. guess
new guess f (x ) = Sin(x ) = 0
Division by zero
Drawbacks (continued)
2
2
f ( x)
f ( x)
0
f ( x) 0
secant( x)
f ( x)
−2 2
10 5 0 5 10
− 10 x x 0 x 1' x x 1 10
f(x)
f ( x ) = Sinx = 0
x'1, (first guess)
x0, (previous guess)
Secant line
x1, (new guess)
Root Jumping
Fixed Point Iteration
• Start from f(x) =0 and derive a relation x = g(x)
Introduction
f (xU )
f ( x) = 0 (1)
In the Bisection method
Exact root
f ( xL ) * f ( xU ) 0 (2)
xL
O xr xU x
f (xL ) x L + xU
xr = (3)
2
1
94
Figure 1 False-Position Method
http://numericalmethods.eng.usf.edu
False-Position Method
f ( x L ) 0; xr − x L 0
f ( xU ) 0; xr − xU 0
From Eq. (4), one obtains
(xr − xL ) f (xU ) = (xr − xU ) f (xL )
xU f (xL ) − xL f (xU ) = xr f (xL ) − f (xU )
The above equation can be solved to obtain the next
xr , as predicted root
xU f (xL ) − xL f (xU )
xr = (5)
f (xL ) − f (xU )
Step-By-Step False-Position
Algorithms
1. Choose x L and xU as two guesses for the root such
f (xL ) f (xU ) 0
that
xU f (x L ) − xL f (xU )
2. Estimate the root, xm =
f (xL ) − f (xU )
3. Now check the following
(a) If f (xL ) f (xm ) 0 , then the root lies between xL
and xm ; then x L = x L and xU = xm
(b) If f (xL ) f (xm ) 0 , then the root lies between xm
and xU ; then xL = xm and xU = xU
(c) If f (xL ) f (xm ) = 0 , then the root is xm .
Stop the algorithm if this is true.
4. Find the new estimate of the root
xU f (x L ) − xL f (xU )
xm =
f (xL ) − f (xU )
Find the absolute relative approximate error as
xmnew − xmold
a = new
100
xm
where
new
xm = estimated root from present iteration
old
xm = estimated root from previous iteration
−3
5. say s = 10 = 0.001. If a s , then go to step 3,
else stop the algorithm.
Notes: The False-Position and Bisection algorithms are
quite similar. The only difference is the formula used to
calculate the new estimate of the root xm ,
shown in steps #2 and 4!
Example 1
The floating ball has a specific gravity of 0.6 and has a
radius of 5.5cm.
You are asked to find the depth to which the ball is
submerged when floating in water.
The equation that gives the depth x to which the ball is
submerged under water is given by
−4
x − 0.165 x + 3.993 10
3 2
=0
Use the false-position 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. Find the
absolute relative approximate error at the end of each
iteration, and the number of significant digits at least
correct at the converged iteration.
Solution
Figure 2 :
Floating ball x
problem water
Let us assume
xL = 0, xU = 0.11
Hence,
( )(
f (xL ) f (xU ) = f (0) f (0.11) = 3.993 10−4 − 2.662 10−4 0 )
Iteration 1
xU f (x L ) − x L f (xU )
xm =
f (x L ) − f (xU )
=
(
0.11 3.993 10 −4 − 0 − 2.662 10 −4 )
−4
(
3.993 10 − − 2.662 10 −4
)
= 0.0660
(
f (xm ) = f (0.0660 ) = (0.0660 ) − 0.165(0.0660 ) + 3.993 10 −4
3 2
)
= −3.1944 10 −5
f (xL ) f (xm ) = f (0) f (0.0660) = (+ )(−) 0
xL = 0, xU = 0.0660
Iteration 2
xU f (x L ) − x L f (xU )
xm =
f (x L ) − f (xU )
=
(
0.0660 3.993 10 −4 − 0 − 3.1944 10 −5 )
(
3.993 10 −4 − − 3.1944 10 −5 )
= 0.0611
(
f (xm ) = f (0.0611) = (0.0611) − 0.165(0.0611) + 3.993 10 −4
3 2
)
= 1.1320 10 −5
f (xL ) f (xm ) = f (0) f (0.0611) = (+ )(+ ) 0
Hence, xL = 0.0611, xU = 0.0660
0.0611 − 0.0660
a = 100 8%
0.0611
Iteration 3
xU f (x L ) − x L f (xU )
xm =
f (x L ) − f (xU )
=
(
0.0660 1.132 10 −5 − 0.0611 − 3.1944 10 −5 )
( )
1.132 10 −5 − − 3.1944 10 −5
= 0.0624
f (xm ) = −1.1313 10−7
0.0624 − 0.0611
a = 100 2.05%
0.0624
Table 1: Root of f (x ) = x 3 − 0.165x 2 + 3.993 10−4 = 0
for False-Position Method.
Iteration xL xU xm a % f (xm )
1 0.0000 0.1100 0.0660 N/A -3.1944x10-5