Lecture 4
Lecture 4
𝑥 + 7𝑥 − 5𝑥 + 10 = 0,
𝑥 − 4 = 0.
We assume in the foregoing that the exact root of equation (1) will be
denoted by α and the approximate solution 𝑥 will be approximated
by a sequence of estimates 𝑥 , 𝑥 , ⋯, with
𝑥 = lim 𝑥
Chapter 1 Numerical solution of nonlinear equations 3
Note that all the methods we will use require an initial estimate of the
root we are computing. It often requires as much thought and effort to
get a good starting value as it does to refine it to acceptable accuracy.
Sometimes one’s knowledge of the physical problem will suggest a
starting value. When this is not available, one normally finds starting
values by initial trial-and-error computations (analytical approach), or
by making a rough graph of the function (graphical approach). We
now discuss the usual approaches to guess the initial approximations.
𝑓 >0
𝑓 >0
𝑓 >0 𝑓 >0
𝑎 α 𝑏 𝑐 α 𝑑 α 𝑒 α
𝑥
𝑓 <0 𝑓 <0 𝑓 <0
𝑓 <0
sin 𝑥 − cosh 𝑥 + 1 = 0,
6 Chapter 1 Numerical solution of nonlinear equations
1
𝑦=cosh(𝑥−1) 𝑦 = sin 𝑥
0 1.3 𝑥
-1
Solution We first sketch the graphs of the two curves 𝑦 = sin 𝑥 and
𝑦 = 𝑥 − 0.5 (see Fig. 1.3). Since the roots of the given equation
represent the points of intersections of these two curves, and we know
that |sin 𝑥| ≤ 1, then we have 𝑥 − 0.5 ≤ 1. This gives
−1 ≤ 𝑥 − 0.5 ≤ 1,
or
−0.5 ≤ 𝑥 − 0.5 ≤ 1.5
Chapter 1 Numerical solution of nonlinear equations 7
We deduce from the graph that the equation has only one root near
𝑥 𝑓 (𝑥 )
1.45 0.0427
We have seen in the above section how to estimate the number, nature
and values of the roots of general nonlinear equations in the form
8 Chapter 1 Numerical solution of nonlinear equations
𝑏, 𝑓 (𝑏)
𝑎 𝑥 𝑥 𝛂 𝑏
𝑎, 𝑓(𝑎)
𝑏−𝑎
2 ≥ ,
𝑇𝑜𝑙
or
1 𝑏−𝑎
𝑛≥
ln 2 𝑇𝑜𝑙
Solution The solution of this problem lies in two main steps. In the
first step we locate the interval containing the root. Put
𝑓 (𝑥 ) = 𝑥 − 8𝑥 + 5,
then
𝑥 0 1
𝑓 (𝑥 ) 5 −2
𝑓 0 𝑓 1 <0
The inequality 𝑓(0)𝑓(1) < 0 implies that there is at least one root in
the interval (0,1).
+ + + − −
0 0.5 0.625 0.75 −1
𝑎 𝑥 𝑥 𝑥 𝑏
𝑓(𝑥) = 𝑥 − 12𝑥 − 10 = 0
Here, we have
𝑥 0 1 2 3 4
𝑓 (𝑥 ) −10 −21 −42 −37 54
Then there is at least one root in the interval (3, 4). Using the
bisection method gives the following values.
that
𝑓(𝑥) = 𝑥𝑒 − 1 0 1
Fig. 1.5
Changes its sign in the interval
Chapter 1 Numerical solution of nonlinear equations 15
After 11 iterations, the difference between the last two values of 𝑓 (𝑥)
is
0.567140 − 0.567091 ≅ 0.000049 = 4.9 × 10 < 5 × 10 ,
then the last value of 𝑥 is the required value of the root i.e.,
𝑥 ≅ 0.567
correct to 3-decimal places.
𝑓 (𝑥) = 0, (1)
when it is known that the required root is located between two values
𝑎 and 𝑏 given that 𝑓 (𝑎) and 𝑓 (𝑏) have opposite signs. The false
position method can be summarized in the following steps.
𝑏, 𝑓(𝑏)
𝑎 𝑥 𝑥 𝛂 𝑏
𝑎, 𝑓(𝑎)
𝑎𝑓(𝑏) − 𝑏𝑓(𝑎)
𝑥 = (3)
𝑓 (𝑏 ) − 𝑓 (𝑎 )
𝑎 𝑓 (𝑎 )
𝑏 𝑓 (𝑏 ) (4)
𝑥 =
𝑓(𝑏) − 𝑓(𝑎)
𝑎=0 𝑓 (𝑎 ) = 5
−
𝑏=1 𝑓 (𝑏) = −2
𝑎 𝑓 (𝑎 )
𝑏 𝑓 (𝑏 ) (0)(−2) − (1)(5)
𝑥 = = = 0.714286,
𝑓(𝑏) − 𝑓(𝑎) −2 − 5
𝑓 (𝑥 ) = −0.349854
The sign of 𝑓 (𝑥 ) implies that the required root lies in the interval
(0, 0.714286). Therefore, the second approximation is given by
𝑎=0 𝑓 (𝑎 ) = 5
−
𝑥 = 0.714286 𝑓 (𝑏) = −0.349854
20 Chapter 1 Numerical solution of nonlinear equations
(0)(−0.349854) − (0.714286)(5)
𝑥 = = 0.667575,
−0.349854 − 5
𝑓(𝑥 ) = − 0.04309,
⋮
Repeating the process, we get the following table
𝒏 𝒙 𝒇 (𝒙)
0 5.000000
1 -2.000000
0.714286 -0.349856
0.667575 -0.043091
0.661871 -0.005020
0.661207 -0.000580
0.661130 -0.000065
0.661121 -0.000005
0.661120 0.000002
0.661120 0.000002
Example 2 Using the false position method, find the three roots of the
equation
𝑥 − 4𝑥 − 5𝑥 + 10 = 0
𝑥 0 1 2 3 4 5
𝑓 (𝑥 ) 10 2 −8 −14 −10 10
𝑓 1 𝑓 2 <0 𝑓 4 𝑓 5 <0
It is evident that the given equation has two roots in the intervals (1,2)
and (4,5), respectively. On finding these roots by the use of the false
position method we obtain
𝒏 𝒙 𝒇(𝒙) 𝒏 𝒙 𝒇(𝒙)
1 2 4 -10
2 -8 5 10
1.200000 -0.032000 4.500000 -2.375000
1.196850 0.000378 4.595960 -0.391427
1.196887 -0.000002 4.611179 -0.060413
1.196887 -0.000002 4.613514 -0.009224
4.613870 -0.001410
4.613924 -0.000225
4.613933 -0.000027
4.613934 -0.000005
4.613934 -0.000005
Solution Using the false position method with the starting values
(5, −34.506758) and (8,28.00586)
To get the table
𝒏 𝒙 𝒇 (𝒙)
5 -34.506758
8 28.005860
6.655990 -4.275627
6.834002 -0.406143
6.850670 -0.037546
6.852209 -0.003458
6.852351 -0.000313
6.852364 -0.000025
6.852365 -0.000003
6.852365 -0.000003
𝑓 (𝑥) = 0, (1)
the secant method, as illustrated in Fig. 1.7, uses the secant to the
curve 𝑦 = 𝑓 (𝑥) employing two previous approximations 𝑥 and 𝑥 .
That is
0 − 𝑓(𝑥 ) 𝑓 (𝑥 ) − 𝑓(𝑥 )
= ,
𝑥 −𝑥 𝑥 −𝑥
or
𝑥 −𝑥
𝑥 =𝑥 − 𝑓(𝑥 ), 𝑛 = 1,2, ⋯ (2)
𝑓 (𝑥 ) − 𝑓 (𝑥 )
or, alternatively
𝑥 𝑓 (𝑥 )
𝑥 𝑓 (𝑥 )
𝑥 = , 𝑛 = 1,2, ⋯ (3)
𝑓 (𝑥 ) − 𝑓 (𝑥 )
From a study of Fig. 3.9 it is clear that the secant method converges
for any continuous function. However, from equation (1), we have
𝑓(𝑥 )
𝑥 −𝑥 = , (4)
𝑚
24 Chapter 1 Numerical solution of nonlinear equations
( ) ( )
where 𝑚 is the slop defined by 𝑚 = . Equation (4)
𝑓(𝑥)
𝑥 𝑥 𝑥 x
with
𝑛 𝑥 𝑓(𝑥 )
0 5
1 −2
1 0.714285714 -0.349854
2 0.653710295 0.049672
3 0.661241475 -0.000810
4 0.661120635 -0.000002
5 0.661120336 0.000000
6 0.661120336 0.000000
From the above table the approximate root correct to 9 decimal places
is 0.661120336.
Exercise 1.1
𝟐. 𝑥 + 3𝑥 − 1 = 0, (− 4, 1)
𝟑. 𝑥 − 10 = 0, (0, 1.3)
[Answer: 𝑥 = 1.258925]