Numerical Analysis

Chap-17
B.V.Ramana
August 30, 2007
Chapter
10:15
17
Numerical Analysis
WORKED OUT EXAMPLES
Bisection Method
Example 1: Find a real root of the equation x 3 −
6x − 4 = 0 by bisection method.
[JNTU 2006, Set No. 1]
Solution:
x:
0
1
2 3
f (x) = x 3 − 6x − 4: −4 −9 −8 5
...
one root lies between 2 and 3. Take x0 = 2,
x1 = 3. By bisection method, the next approxima1
tion is x2 = x0 +x
= 2+3
= 2.5. Now at x2 = 2.5,
2
2
f (2.5) = −3.375 < 0. Thus, a root lies between 2.5
and 3. So the next approximation is x3 = 2.5+3
=
2
5.5
=
2.75.
At
x
=
2.75,
f
(2.75)
=
0.2968
>
0.
3
2
Thus a root lies between 2.5 and 2.75. Next approximation is x4 = 2.5+2.75
= 2.625.
2
Now f (2.625) = −1.6621 < 0. The root lies between 2.625 and 2.75. Then x5 = 2.625+2.75
=
2
2.6875 and f (2.6875) = −0.7141 < 0. So root lies
between 2.6875 and 2.75. The approximate value of
the real root of the given equation is 2.6875+2.75
=
2
2.71875.
Example 2: Find a real root of x 3 − 5x + 3 = 0
using bisection method.
[JNTU 2006, Set No. 2]
Solution:
x: 0
1 2
f (x) = x 3 − 5x + 3: 3 −1 1
Thus, a root lies between 0 and 1 and another root
lies between 1 and 2.
1
Choose x0 = 1 and x1 = 2. Then x2 = x0 +x
=
2
1+2
=
1.5,
f
(1.5)
=
−1.125
<
0.
2
1
So root lies in between 1.5 and 2. So x3 = x2 +x
=
2
1.5+2
=
1.75,
f
(1.75)
=
−0.3906
<
0.
2
So root lies between 1.75 and 2. Then x4 = 1.75+2
=
2
1.875, f (1.875) = 0.2167 > 0.
So root lies between 1.75 and 1.875. So the approximate root of the given equation is x5 = 1.75+1.875
=
2
1.8125.
Example 3: Find a real root of the Equation x 3 −
x − 11 = 0 by bisection method.
[JNTU 2007, Set No. 2]
Solution:
x:
f (x) = x 3 − x − 11:
0
−11
1
−11
2
−5
3
13
A root lies between 2 and 3. Then the first approxi1
mation is x2 = x0 +x
= 2+3
= 2.5. Now f (2.5) =
2
2
2.125 > 0. So root lies between 2 and 2.5. So
the next approximation is x3 = 2+2.5
= 2.25. Now
2
f (2.25) = −1.859 < 0. So next approximation is
x4 = 2.25+2.5
= 2.375. Now f (2.375) = 0.0215 >
2
0 and f (2.25) < 0.
... Root lies between 2.25 and 2.375. So x =
5
= 2.3125. Now f (2.3125) = −0.946 < 0
and f (2.375) > 0.
2.25+2.375
2
17.1
Chap-17
B.V.Ramana
17.2
August 30, 2007
10:15
MATHEMATICAL METHODS
So root lies between 2.3125 and 2.375. x6 =
2.3125+2.375
= 2.34375, f (x6 ) = −0.4691 < 0. Root
2
lies in (2.34375, 2.375). So
X7 = 2.34375+2.375
= 2.359375.
2
Since f (x7 ) = −0.225 < 0, root lies between
2.359375 and 2.375. So x8 = 2.359375+2.375
=
2
2.3671875.
f (x8 ) = −0.10247 < 0,
root
lies
between
2.3671875 and 2.375. Then
x7 =
=1−
(2 − 1)
· [−0.2817]
[11.778 − (−0.2817)]
x2 = 1.329
Now f (x2 ) = f (1.329) = 2.0199 > 0 and f (1) =
−0.2817 < 0 so root lies in between 1 and 1.329.
Take x0 = 1, x2 = 1.329.
Then x3 = x0 −
=1−
2.3671875 + 2.375
= 2.37109.
2
Approximate root is 2.37109.
Example 4: Using bisection method, find a root of
the Equation x 3 − 4x − 9 = 0
x:
f (x) = x 3 − 4x − 9:
0
−9
1
−12
2
−9
3
6
A root lies between 2 and 3. First approximation is
x0 + x 1
2+3
x2 =
=
= 2.5.
2
2
Since f (2.5) = −3.375 < 0, root lies between 2.5
and 3. The second approximation is x3 = 21 (2.5 +
3) = 2.75. Since f (2.75) = 0.7969 > 0, root lies
between 2.5 and 2.75. So third approximation is x4 =
2.5+2.75
= 2.625. Since f (2.625) = −1.4121 < 0,
2
root lies between 2.5 and 2.625. Thus, the fourth
approximation to the root is x5 = 21 (2.5 + 2.625) =
2.6875.
Example 5: Find a real root of xex = 2 using
Regula–falsi method.
[JNTU 2007, Set 4]
Example 6: Find a real root of xex = 3 using
Regula–falsi method.
[JNTU 2006, Set 4]
(1.329−1)
[−0.2817]
[2.0199−(−0.2817)]
(x3 − x2 )
· f (x2 )
[f (x3 ) − f (x2 )]
= 1.329 −
x:
f (x) = xe − 3:
0
−3
1
− 0.2817
... 1,
... root lies in (1, 2). Take x0 = 1,
Then
(x1 − x0 )
x2 = x0 −
· f (x0 )
(f (x1 ) − f (x0 ))
2
11.778
x1 = 2.
(1.04 − 1.329)
· [2.0199]
[−0.05 − (2.0199)]
x4 = 1.08 is the required approximate root.
Example 7: Find a real root of ex sin x = 1 using
Regula–Falsi method.
[JNTU 2006, Supply, Set No. 1, Code No.
R059010202]
Solution:
x:
0
1
root lies in
ex · sin x − 1 = f (x): −1 1.2874
(0, 1).
By bisection method: f (0.5) = −0.2094, root lies in
(0.5, 1).
By bisection method: f (0.75) = 0.443 root lies in
(0.5, 0.75).
Since f (0.5) < 0, choose b = 0.75. Then by
Regula–Falsi method
Solution:
x
· f (x0 )
x3 = 1.04
Now f (x3 ) = f (1.04) = −0.05 < 0.
Since f (x2 ) = 2.0199 > 0, root lies between 1.04
and 1.329. Then
x4 = x2 −
Solution:
(x2 −x0 )
[f (x2 )−f (x0 )]
x1 = x0 −
= 0.5 −
f (x0 )
(b − x0 )
f (b) − f (x0 )
(−0.20941)
(0.75 − 0.5)
(0.443 + 0.20941)
x1 = 0.5 + 0.160 = 0.6605
Now f (x1 ) = f (0.6605) = 0.1876 > 0 root lies in
Chap-17
B.V.Ramana
August 30, 2007
10:15
NUMERICAL ANALYSIS
(0.5, 0.6605).
Since f (a) = f (0.5) < 0; we have b = 0.6605
x2 = 0.5 −
−0.2094
(0.6605
(0.1876+0.2094)
− 0.5)
x2 = 0.5 + 0.08465 = 0.58466
At x2 , f (x2 ) = −0.009653.
So x2 = 0.58466 is an approximate root of the given
transcendental equation.
Example 8: Using Regula–Falsi method, find an
approximate real root of the transcendental Equation
x · log10 x = 1.2.
Solution:
x:
1
2
3
f (x) = x log10 x − 1.2: − 1.2 − 0.59794 0.23136
... a root lies between 2 and 3.
Take x0 = 2, x1 = 3. Then approximate root
x1 − x0
x2 = x0 −
· f (x0 )
f (x1 ) − f (x0 )
x2 = 2.72102
Now f (x2 ) = f (2.72102) = −0.0179, so root lies
between 2.72102 and 3. Then
x3 = x2 −
x1 − x2
· f (x2 )
f (x1 ) − f (x2 )
= 2.72102 −
starting from an initial guess x0 , better successive approximations x1 , x2 , x3 , . . . of an unknown solution
of (1) are computed step by step.
Generally, iterative methods are easy to program.
The bisection method and Regula–Falsi method are
two such iterative methods which are known as interpolation methods or bracketing methods because
the root (guess) is bracketed between two estimates
(one for f (x) > 0 and one for f (x) < 0). The other
kind of iterative methods such as “fixed point iteration method”, “Newton-Raphson method”, its variant “secant method” are known as extrapolation
methods or open-end methods in which a single value
(initial estimate) is chosen.
Fixed-point iteration method
Rewriting the Equation (1) in the form
x = g(x)
(3 − 2)
=2−
[−0.59794]
[0.23136 + 0.59794]
17.3
(2)
observe that the roots (or solutions) of (1) are same as
the points of intersection of the straight line y = x
and the curve representing y = g(x), as shown in
the figure. The exact solution (root) is ξ which is the
intersection of y = x and y = g(x).
(3 − 2.72102)
× (−0.0179)
[0.23136 + 0.0179]
x3 = 2.74021
Similarly, we get x4 = 2.74024, x5 = 2.74063. Note
at x5 ,
f (x5 ) = −0.0000140385
... An approximate root is x5 = 2.74063.
Fig. 17.1
Iteration Methods
In general, there is no formula for the exact solution
of
f (x) = 0
(1)
which may be an algebraic equation or transcendental equation. In such cases the iterative method,
which is an approximation method, is used in which
Starting with an initial estimate x0 , compute the
first approximation x1 given by
x1 = g(x0 )
Now, treating x1 as the initial value, compute the
second approximation x2 as
x2 = g(x1 )
Chap-17
B.V.Ramana
17.4
August 30, 2007
10:15
MATHEMATICAL METHODS
In general the n + 1th approximation is
xn+1 = g(xn )
for n = 0, 1, 2, . . .
The name of the method is motivated, since a solution
of (2) is called a fixed point of g.
This method converges in an interval (a, b) if
|g (x)| ≤ k < 1
Example 9: Find a real root of the Equation 2x −
log10 x = 7 by successive approximation method.
[JNTU 2006, Set No. 3]
Rewriting the given equation as
x=
1
(cos x + 1) = g(x).
3
Observe that
|g (x)| = 13 | sin x| < 1 in 0, π2 .
Starting with x0 = 0, the fixed point iteration methods yields the following successive approximations.
x1 = g(x0 ) =
1
(cos 0 + 1) = 0.6667,
3
1
(cos(.6667) + 1) = 0.5953,
3
1
Solution:
x3 = g(x2 ) = (cos(.5953) + 1) = 0.6093,
x: 1
2
3
4
3
f (x) = 2x − log x − 7: − 5 − 3.301 − 1.4471 0.398
1
x4 = g(x3 ) = (cos(.6093) + 1) = 0.6067,
... A root lies between 3 and 4.
3
Rewrite the given equation as
1
x5 = g(x4 ) = (cos(.6067) + 1) = 0.6072,
1
3
x = [log10 x + 7] = g(x)
1
2
x6 = g(x5 ) = (cos(.6072) + 1) = 0.6071.
3
Thus the approximate root is 0.6071 since x5 and x6
Now |g (x)| = | 21 · x1 log10 e| < 1 when 3 < x < 4.
1 1
are nearly equal.
when x = 3, |g (3)| = | · · log10 e| = 0.07238
2
x2 = g(x1 ) =
3
when x = 4, |g (4)| = | 21 · 41 (0.4343)| = 0.0542
Since |f (4)| = 0.398 < 1.4471 = |f (3)|, The root
is near to 4. Now taking the initial guess as x0 = 3.6,
we apply the fixed point iteration method yielding
the successive approximations as
1
x1 = g(x0 ) = (log10 (3.6) + 7) = 3.77815,
2
1
x2 = g(x1 ) = (log10 (3.77815) + 7) = 3.78863,
2
1
x3 = g(x2 ) = (log10 (3.78863) + 7) = 3.78924,
2
1
x4 = g(x3 ) = (log10 (3.78924) + 7) = 3.78927.
2
Thus the approximate root is 3.7892.
Example 11: Find the negative root of the equation x 3 − 2x + 5 = 0.
Solution: If α, β, γ are the roots of
x 3 + 0 · x 2 − 2x + 5 = 0
Then the equation whose roots are −α, −β, −γ is
x 3 + (−1) · 0 · x 2 + (−1)2 (−2x) + (−1)3 · 5 = 0
or x 3 − 2x − 5 = 0
(2)
To find the positive root of (2), we have
f (x) = x 3 − 2x − 5, f (2) = −1 < 0, f (3) = 16 >
0. So root lies between 2 and 3 and it is nearer to 2
(since |f (2)| = 1 < 16 = |f (3)|).
Rewriting the Equation (2) we get
1
x = (2x + 5) 3 = g(x)
2
Example 10: Using iteration method, find a real
root of the Equation cos x = 3x − 1.
Solution:
Here, f (x)
= cos x − 3x + 1, and
f (0) = 2 > 0 and f π2 = − 3·π
+ 1 = −3.71 < 0
2
π
.
. . A root lies between 0 and .
2
(1)
Then |g (x)| = | 13 (2x + 5)− 3 · 2| < 1 in (2, 3).
Choosing x0 = 2.1, we apply the fixed point iteration method. Then
1
x1 = g(x0 ) = [2(2.1) + 5] 3 = 2.09538,
1
x2 = g(x1 ) = [2(2.09538) + 5] 3 = 2.09468,
1
x3 = g(x2 ) = [2(2.09468) + 5] 3 = 2.09457,
Chap-17
B.V.Ramana
August 30, 2007
10:15
NUMERICAL ANALYSIS
x4 = g(x3 ) = 2.09455, x5 = g(x4 ) = 2.09455
Hence the approximate root of (2) is 2.09455; so the
negative root of the given Equation (1) is −2.09455.
Example 12: Find a solution of x 3 + x − 1 = 0 by
iteration.
Solution:
x:
0
1
f (x) = x 3 + x − 1: −1 1
... A root lies in (0, 1).
Rewriting the given equation,
x=
1
= g(x)
1 + x2
so that
xn+1 =
1
.
1 + xn2
2|x|
Also |g (x)| = (1+x
2 )2 < 1 for any x.
Choosing x0 = 1, we obtain
1
1
= = 0.5
1 + 12
2
1
= 0.800,
x2 =
1 + (0.5)2
1
= 0.610,
x3 =
1 + (0.8)2
x4 = 0.729, x5 = 0.653, x6 = 0.701
x1 =
Approximate root is 0.701.
Newton–Raphson Method
Example 13: Find a real root of xex − cos x = 0
using Newton–Raphson method.
[JNTU 2007, Set No. 1],
[JNTU 2006, Supply, Set No. 4, (R059010202)]
Solution: f (0) = −1 < 0, f (1) = 2.178 > 0
Here, f (x) = xex − cos x. Root lies between 0 and
1. Also f (x) = xex + ex + sin x
By Newton–Raphson method:
f (xn )
f (xn )
xn
(xn e − cos xn )
= xn −
(xn exn + exn + sin xn )
xn+1 = xn −
xn+1
17.5
Since f (1) = 2.178 and f (1) = 6.2780 are of the
same sign, we choose x0 as 1. Then for n = 0,
we have x1 = x0 − ff(x(x0 )) or x1 = 1 − 2.178
= 0.653,
6.278
0
f (x1 ) = 0.46, and f (x1 ) = 3.7835. Then for n = 1,
0.46
we get x2 = x1 − ff(x(x1 )) = 0.653 − 3.7835
= 0.5314.
1
Now f (x2 ) = 0.042, f (x2 ) = 3.11213. For n = 2,
0.042
we get x3 = x2 − ff(x(x2 )) or x3 = 0.5314 − 3.11213
=
2
0.518. Then f (x3 ) = 0.000738, f (x3 ) = 3.0433.
So for n = 3, x4 = x3 − ff(x(x3 )) = 0.518 − 0.000738
=
3.0433
3
0.5177. Since f (0.5177) = −0.000174, we take
x4 = 0.5177 as an approximate root.
Example 14: Find a real root of x + log10 x − 2 =
0 using Newton–Raphson method.
[JNTU 2007, Set No. 3]
Solution: Here, f (x) = x + log10 x − 2, f (x) =
1 + x1 · log e10 = 1 + 2.3026
.
x
Since f (1) = −1 < 0 and f (2) = 0.3010 > 0, a
root lies between 1 and 2. Again at 1.5, we have
f (1.5) = −0.324, root lies between 1.5 and 2.
Choose x0 = 1.8. Then for n = 0, we have the first
0.0553
approximation as, x1 = x0 − ff(x(x0 )) = 1.8 − 2.2792
,
0
x1 = 1.7757. Then x2 = x1 − ff(x(x1 )) = 1.7757 −
0
0.0251
= 1.7648.
2.2967
Now x3 = x2 − ff(x(x2 )) = 1.7648 − 0.0015
= 1.7598,
2.3047
2
0.0053
Again x4 = x3 − ff(x(x3 )) = 1.7598 − 2.3084
= 1.7575
3
f (x4 ) = f (1.7575) = 0.002395, we may take x4 =
1.7575 as an approximate root.
Example 15: Find a real root of x tan x + 1 = 0
using Newton–Raphson method.
[JNTU 2006, Aug. Supply. Set 2]
Solution:
Rewriting x sin x + cos x = 0, so
f (x) = x sin x + cos x, f (x) = x cos x. Then NR
iteration formula is
xn+1 = xn −
with
n
0
1
2
3
xn sin xn + cos xn
xn cos xn
x0 = π , the successive iterations
xn
f (xn )
xn+1
3.1416 − 1.0
2.8233
2.8233 − 0.0662 2.7986
2.7986 − 0.0006 2.7984
2.7984
0.0
2.7984
are:
Chap-17
B.V.Ramana
17.6
August 30, 2007
10:15
MATHEMATICAL METHODS
... Approximate (exact) root is 2.7984
Example 16: Find f (2.5) using newton’s forward
formula from the following table.
x: 0 1 2
3
4
5
6
y: 0 1 16 81 256 625 1296
[JNTU: 2006, Set No. 1]
Solution: Here, h = 1, x0 , y0 = 0, x = 2.5, q =
x−x0
= 2.5−0
... q = 2.5.
h
1
Finite difference table
x
y
0
0
1
1
2
16
15
3
81
65
4
256
5
625
6 1296
Dy
1
175
369
671
D 2y
14
50
110
194
302
D3y
36
60
84
108
D 4y
D5y
24
D6y
0
24
0
24
0
Here y0 = 1, 2 y0 = 14, 3 y0 = 36, 4 y0 = 24,
5 y0 = 0, 6 y0 = 0.
Using Newton’s forward formula y = y0 + qy0 +
q(q−1) 2
y0
2!
+ q(q−1)(q−2)
3 y0
3!
+ q(q−1)(q−2)(q−3)
4 y0
4!
+ 0 + 0.
Substituting the values, we get at x = 2.5,
(2.5)(2.5 − 1)
y(2.5) = 0 + 2.5(1) +
(14)
2!
(2.5)(2.5 − 1)(2.5 − 2)
+
(36) +
3!
+
(2.5)(2.5 − 1)(2.5 − 2)(2.5 − 3)
(24) + 0 + 0
4!
= 2.5 + 26.25 + 11.25 − 0.9375 = 39.0625.
◦
Example 17:
Given that sin 45 = 0.7077,
sin 50◦ = 0.766, sin 55◦ = 0.8192, sin 60◦ = 0.866,
find sin 52◦ using Newton’s forward differences
formula.
[JNTU 2006, Set No. 2]
Solution: Here, h = 5◦ , x = 52◦ , x0 = 45◦ , y0 =
◦
= 52−45
= 75
0.7077, q = x−45
2
5
Finite difference table
x
D2y
y = sin x Dy
x0
y0
45
0.7077
50
0.766
55
0.8192
60
0.866
Dy0
0.0583
0.0532
0.0468
D3y
D2y0
0.0051
–0.0064
D3y0
–0.0013
Using Newton’s forward differences formula
y(52◦ ) = 0.7077 + 75 (0.0583)
+ 75 75 − 1 − 0.0051)
7 7
7
+ 5 5 − 1 5 − 2 (−0.0013) = 0.7869008
Example 18: Find y(1.6) using Newton’s forward
differences formula from the table
x
y
1
3.49
1.4
4.82
1.8
5.96
2.2
6.5
[JNTU 2006, Set No. 3]
Solution: Here, h = 0.4, x = 1.6, x0 = 1, y0 =
.6
0
3.49, q = x−x
= 1.6−1
= .4
= 23
h
0.4
x
y
Dy
1
3.49 = y0
Dy0
1.4
4.82
1.8
5.96
2.2
6.50
1.33
1.14
0.54
D2y
D2y0
– 0.19
–0.60
D3y
D3y0
–0.41
Using Newton’s forward differences
formula
y(1.6) = 3.49 + 23 (1.33) + 23 23 − 1 (−0.19)
+ 23 23 − 1 23 − 2 (−0.4) = 5.4925.
Example 19: Show that fi2 = (fi + fi+1 )fi
[JNTU 2006, Set No. 4] (Question Corrected)
Solution: We know that fi = fi+1 − fi
2
Then fi2 = fi+1
− fi2 = (fi+1 + fi )(fi+1 − fi )
= (fi+1 + fi )fi
Example 20: Find the unique polynomial P (x)
of degree 2 or less such that P (1) = 1, P (3) = 27,
Chap-17
B.V.Ramana
August 30, 2007
10:15
NUMERICAL ANALYSIS
P (4) = 64 using Lagrange interpolation formula.
[JNTU Aug. 2006, Supply. S 2004]
Put x = 3 and substitute x0 , x1 , x2 , . . ., f (x0 ) . . ., etc.
f (3) = 1 ×
Solution: x0 = 1, x1 = 3, x2 = 4, y(x) = P (x),
so y0 = P (x0 = 1) = P (1) = 1, y1 = P (x1 = 3) =
27, y3 = P (3) = 27. By Lagrange’s interpolation
formula, we get
y(x) = P (x) =
(x − x1 )(x − x2 )
y0 +
(x0 − x1 )(x0 − x2 )
(x − x0 )(x − x2 )
y1 +
+
(x1 − x0 )(x1 − x2 )
+
=
(x − x0 )(x − x1 )
y2
(x2 − x0 )(x2 − x1 )
(x − 1)(x − 4)
(x − 3)(x − 4)
×1+
× 27+
(1 − 3)(1 − 4)
(3 − 1)(3 − 4)
17.7
=
(3 − 1)(3 − 2)(3 − 4)(3 − 5)(3 − 6)
+
(0 − 1)(0 − 2)(0 − 4)(0 − 5)(0 − 6)
+ 14 ×
(3 − 0)(3 − 2)(3 − 4)(3 − 5)(3 − 6)
+
(1 − 0)(1 − 2)(1 − 4)(1 − 5)(1 − 6)
+ 15 ×
(3 − 0)(3 − 1)(3 − 4)(3 − 5)(3 − 6)
+
(2 − 0)(2 − 1)(2 − 4)(2 − 5)(2 − 6)
+5 ×
(3 − 0)(3 − 1)(3 − 2)(3 − 5)(3 − 6)
+
(4 − 0)(4 − 1)(4 − 2)(4 − 5)(4 − 6)
+6 ×
(3 − 0)(3 − 1)(3 − 2)(3 − 4)(3 − 6)
+
(5 − 0)(5 − 1)(5 − 2)(5 − 4)(5 − 6)
+19 ·
(3 − 0)(3 − 1)(3 − 2)(3 − 4)(3 − 5)
(6 − 0)(6 − 1)(6 − 2)(6 − 4)(6 − 5)
18
36
36
12
−
× 14 +
× 15 +
×5
240 60
48
48
18
12
− ×6+
× 19
60
240
= 0.05 − 4.2 + 11.25 + 3.75 − 1.8 + 0.95 = 10.
+
=
(x − 1)(x − 3)
× 64
(4 − 1)(4 − 3)
1
[48x 2 − 114x + 72] = 8x 2 − 19x + 12
6
Example 21: Using Lagrange’s formula, calculate
f(3) from the following table.
x
0 1
2 4 5 6
f (x) 1 14 15 5 6 19
Example 22: If yx is the value of y at x for which
the fifth differences are constant and y1 + y7 =
−784, y2 + y6 = 686, y3 + y5 = 1088, then find y4 .
[JNTU 2007, Set No. 3]
Solution: Since 5th order differences are constant,
we have 5 yn = constant for any n. Then all the
higher order differences are zero i.e., 6 yn = 0 and
7 yn = 0, etc. for any n. We know that
[JNTU Aug. 2006, Supply. Aug. 2003]
0 = 6 y0 = y6 − 6y5 + 15y4 − 20y3 + 15y2
Solution: Here, x0 = 0, x1 = 1, x2 = 2, x3 = 4,
x4 = 5, x5 = 6 and f (x0 ) = 1, f (x1 ) = 14, f (x2 ) =
15, f (x3 ) = 15, f (x4 ) = 5, f (x5 ) = 6, f (x6 ) = 19.
From Lagrange’s interpolation formula, we get
0 = y0 = y7 − 7y6 + 21y5 − 35y4 + 35y3
5
f (x) =
5
i=0
f (xi )
j =0
j =i
5
j =0
i
=1
=
5
i=0
−21y2 + 7y1 − y0
(x − xj )
since n yk = yn+k − n c1 , yn+k−1 + n c2 yn+k−2 +
. . . + (−1)n yk .
Adding, we get
(xi − xj )
(y1 + y7 ) − 6(y2 + y6 ) + 15(y3 + y5 ) − 20y4 = 0.
5
(x − xj )
f (xi )
(x
i − xj )
j =0
j =i
−6y1 + y0
7
Given, y1 + y7 = −784, y2 + y6 = 686 and y3 +
y5 = 1088
Therefore −784 − 6(686) + 15(1088) − 20y4 = 0
or y4 = 721.
Chap-17
B.V.Ramana
17.8
August 30, 2007
10:15
MATHEMATICAL METHODS
Example 23: Construct the difference table for the
following data.
Solution: Finite differences table is
x
x
0.1 0.3 0.5 0.7
0.9
1.1
1.3 20
F (x): 0.003 0.067 0.148 0.248 0.370 0.518 0.697 25
354
30
291
35
260
40
231
45
204
and find F (0.6) using a cubic that fits at x = 0.3, 0.5,
0.7 and 0.9 using Newton’s forward formula.
[JNTU 2007, Set No. 2]
Solution: The differences table is
x F(x) DF(x) D2F(x) D3F(x) D4F(x) D5F(x)
0.1 0.003
0.3 0.067
0.5 0.148
0.7 0.248
0.9 0.370
1.1 0.518
1.3 0.697
0.064
0.081
0.100
0.122
0.148
0.179
0.017
0.019
0.022
0.026
0.031
0.002
0.003
0.004
0.005
0.001
0.001
0.001
0
0
Take x0 = 0.3. Here, h = 0.2, x = 0.6; so
q=
Example 24: Find f (22) from the following table
x0 using Gauss’ forward formula
x
f (x)
20
354
25
332
30
35
40
45
291 260 231 204
[JNTU 2007, Set No. 4]
332
Df
–22
–41
–29
–29
–27
D2f
–19
12
0
D 3f
D4f
31
–43
–12
14
2
2
Gauss’s forward (first GI) interpolation formula (see
(1) on page 17.19)
f (x) = f0 + qf0 + q(q−1)
2 f−1
2
(q+1)q(q−1) 3
+
f−1 + . . .
6
0
Here, x = 22, x0 = 20, h = 5, q = x−x
= 22−20
=
h
5
2
0.4, f0 = 354, f0 = −41, f−1 = −19,
3 f−1 = 31
f (22) = 354 + (0.4)(−41) + (0.4)(−0.6)
(−19)
2
(1.4)(0.4)(−0.6)
(31)
+
6
= 354 − 16.4 + 2.28 − 1.736 = 338.144
Example 25: Using Gauss’ backward differences
formula find y(8) from the following table.
x;
0 5 10 15 20 25
y(x): 7 11 14 18 24 32
0.6 − 0.3
x − x0
=
= 1.5
h
0.2
with x0 = 0.3, x1 = 0.5, x2 = 0.7, x3 = 0.9 we can
fit a polynomial of degree 3.
By Newton’s forward differences formula, with
y0 = 0.067, y0 = 0.081, 2 y0 = 0.019, 3 y0 =
0.003, 4 y0 = 0.001, 5 y0 = 0, we get, F (0.6) =
(0.019)+
0.067 + (1.5)(0.081) + (1.5)(1.5−1)
2!
(1.5)(1.5−1)(1.5−2)
+
(0.003)+
3!
+ (1.5)(1.5−1)(1.5−2)(1.5−3)
(0.001)
4!
= 0.067 + 0.1215 + 0.0071 − 0.0011 + 0.000002
F (0.6) = 0.194502
f(x)
[JNTU 2007, Set No. 1]
0
, x = 8, x0 = 10, h = 5
Solution: Here, q = x−x
h
8−10
so q = 5 = −0.4. The Gauss’ backward differences formula (Gauss’ second G2: see (2) on Page
17.19).
y(x) =
1) (q−1)
3!
3 y−2 +
y0 + qy−1 +
q(q+1)
2!
(q+2)(q+1)q(q−1) 4
y−2
4!
x
y
0
7
5
11
10
14
15
18
20
24
25
32
D
4
3
4
6
8
D2
–1
1
2
2
2 y−1 + q(q +
+ ...
D3
2
1
0
D4
–1
–1
Chap-17
B.V.Ramana
August 30, 2007
10:15
NUMERICAL ANALYSIS
Using the Gauss’ backward differences formula with
y0 = 14, y−1 = 3, 2 y−1 = 1, 2 y−2 = 2, we get
y(8) = 14 + (−0.4) × 3 + (−0.4)(0.6) × 1
EXERCISE
+ (0.6)(−0.4)(−1.4)
× (2)
6
y(8) = 12.792.
Example 26: If f (x) = u(x)v(x) show that
f [x0 , x1 ] = u[x0 ] · v[x0 , x1 ] + u[x0 , x1 ] · v[x1 ]
[JNTU 2006, Aug. Supply. Set No. 4]
Solution: From the definition of first order divided
differences, we have
0]
0]
u[x0 , x1 ] = u[xx1 ]−u[x
, v[x0 , x1 ] = v[xx1 ]−v[x
,
−x
−x
1
0
1
0
[x0 ]
and f [x0 , x1 ] = f [xx1 ]−f
1 −x0
Thus RHS
= u[x0 ] ·v[x0, x1 ] + u[x0 , x1 ] · v[x1 ]
0]
0]
+ u[xx1 ]−u[x
v[x1 ]v[x1 ]
= u[x0 ] v[xx1 ]−v[x
−x
−x
1
=
1
x1 −x0
0
1
+[u[x1 ] · v[x1 ] − u[x0 ] · v[x1 ]}
{u[x1 ]v[x1 ] − u[x0 ] · v[x0 ]}
=
1
x1 −x0
=
1
{f [x1 ]
x1 −x0
− f [x0 ]} = f [x0 , x1 ].
Example 27: Find the unique polynomial P (x)
of degree 2 or less such that P (1) = 1, P (3) = 27,
P (4) = 64 using Newton divided differences formula.
[JNTU Aug. 2006, Supply. Set No. 2]
Solution: Divided differences table
x
P (x)
x0 = 1
P0 = 1
Divided differences
of order
1
2
[x0 , x1 ] = 27−1
3−1
= 13
x1 = 3
P1 = 27
[x1 , x2 ] = 64−27
4−3
= 37
x2 = 4
P2 = 64
1. Show that
n−1
k=0
2 fk = fn − f0
[JNTU 2003]
Hint: fk = fk+1 − fk
n−1
2
fk = 2 f0 + 2 f1 + 2 f2 + . . . + 2 fn−1
2
k=0
= (f1 − f0 ) + (f2 − f1 ) +
. . . (fn − fn−1 )
= fn − f0 .
2. Consider the following data for g(x) =
0
{u[x0 ]v[x1 ] − u[x0 ] · v[x0 ]
[x0 , x1 , x2 ]
= 37−13
=8
4−1
17.9
sin x
.
x2
x:
0.1
0.2
0.3
0.4
0.5
g(x): 9.9833 4.9696 3.2836 2.4339 1.9177
Calculate g(0.25) accurately using Newton’s
forward method of interpolation.
[JNTU: Aug. 2003]
Hint: q = 0.25−0.1
= 1.5, h = 0.1, x = 0.25,
0.1
x0 = 0.1, g(0.25) = 9.9833 + 1.5(−5.0137) +
(1.5)(0.5)
× 3.3277
2
+ 1.5×0.5×(−0.5)
× (−2.4919)
3×2
+ 1.5×0.5×(−0.5)×(−1.5)
× 1.9886
4×3×2
Ans. g(0.25) = 3.9134.
3. For x = 0, 1, 2, 4, 5; f (x) = 1, 14, 15, 5, 6. Find
f (3) using forward differences table.
[JNTU 2004]
Hint: x = 3, h = 1, q =
f (3) = 1 + 13(3)+
3−0
1
=3
3(2)
3(2)(1)
(−12)+
2
3×2×1
(1)
Here, x0 = 1, P0 = 1, [x0 , x1 ] = 13, [x0 , x1 , x2 ] = 8
Using Newton’s divided differences formula
Ans. 5.
P (x) = P0 + (x − x0 )[x0 , x1 ] + (x − x0 )(x − x1 )
4. Find y(25) given that y20 = 24, y24 = 32, y28 =
[x0 , x1 , x2 ]
= 1 + (x − 1) × 13+(x − 1)(x − 3)×8
35, y32 = 40 using Gauss’ forward differences
= 8x 2 − 19x + 12
formula. [JNTU Aug. 2006, Supply. Set No. 1]
Chap-17
B.V.Ramana
17.10
August 30, 2007
10:15
MATHEMATICAL METHODS
Hint: x0 = 28, x = 25, h = 4, q =
x
y = f(x)
x – 2 = 20 y – 2 = 24
x–1 = 24
y–1 = 32
x0 = 2.8
y0 = 35
x1 = 32
y1 = 40
25−28
4
= − 43
[JNTU 2002]
Hint: x0 = 1, x1 = 7, x2 = 15, x = 10,
f0 = 168, f1 = 192, f2 = 336
f (10) = (10−7)(10−15)
× 168 + (10−1)(10−15)
×
(1−7)(1−15)
(7−1)(7−5)
192+
+ (10−1)(10−7)
× 336
(15−1)(15−7)
D y D2y D3y
8
–5
3
2
5
7
Ans. 231.005
3 3
−4 −4 − 1
3
y(25) = 35 + −
3+
×2
4
2!
3 3
− 4 − 4 − 1 − 43 + 1
+7 ×
3!
7. Compute f (3.5) from the following data
x:
1 2 3 4
f (x): 1 2 9 28
Using Lagrange’s, interpolation of 2nd and
3rd-order degree polynomials.
Hint: x0 = 1, x1 = 2, x2 = 3, y0 = 1, y1 = 2,
y2 = 9, x = 3.5
(a) 2nd order f (3.5) = 16
(b) 3rd order: x0 = 1, x1 = 2, x2 = 3, x3 =
4, y0 = 1, y1 = 2, y2 = 9, y3 = 28, x = 3.5,
f (3.5) = 16.625.
Ans. y(25) = 34.4453.
5. Use Gauss’ backward differences formula to find
y(8) from the following table.
x
y
0
7
5
11
10
14
15
18
20
24
25
32
[JNTU Aug. 2006, Supply, Set No. 4]
Solution: x0 = 10, y0 = 14, h = 5, x = 8, so q =
x−x0
= 8−10
= − 25 = −0.4
h
5
x
y(x)
x–2 = 0 y– 2 = 7
x–1 = 5 y–1 = 11
x0 = 10
y0 = 14
x1 = 15
y1 = 18
x1 = 20
y2 = 24
x1 = 25
y3 = 32
D y D2y D3y D4y D5y
4
3
4
6
8
–1
1
2
2
2
1
0
–1
–1
8. Find a real root of x 3 − x − 1 = 0 by bisection
method.
Hint: root in (1, 2), x2 = 1.25, x3 = 1.375, x4 =
1.3125, x5 = 1.34375, x6 = 1.328125
Ans. 1.328125.
9. Using bisection method, find a real root of x +
tan x − 1 = 0.
Hint: f (0) = −1, f (0.5) = 0.0463, root (0, 0.5).
0
Ans. 0.4795.
10. Find out an approximate root of x sin x = 1 using
bisection method.
(−0.4)(0.6) × 1
2
Ans.
(−0.4)(−0.4 − 1)(−0.4 + 1)2
×2
+
6
11.
(−0.4)(−0.4 − 1) + (−0.4 + 1)(−0.4 + 2)
+
× (−1)
24
Ans.
y(8) = 14 + (−0.4) × 3 +
Ans. y(8) = 12.7696.
6. Evaluate f (10), given f (x) = 168, 192, 336 at
x = 1, 7, 15 respectively. Use Lagrange’s interpolation.
Hint: f (0) = −1, f (1) = −0.158529, f (1.5) =
0.496, root in (1, 1.5); x3 = 1.125, x2 = 1.25,
x4 = 1.0625, x5 = 1.09375, x6 = 1.109375,
x7 = 1.1171875, x8 = 1.11328125.
1.11328125.
Use bisection method to find a real root of 667.38
(1 − e−0.146843x ) = 40 x.
14.5.
Hint: f (12) = 6.067, f (16) = −2.269, root in
(12, 16).
12. Find the root of the Equation 2x − log10 x = 7
Chap-17
B.V.Ramana
August 30, 2007
10:15
NUMERICAL ANALYSIS
17.11
which lies between 3.5 and 4 by Regula–Falsi 17. Find a real root of tan−1 x − x = 1.
method.
[JNTU 2006, Set No. 3] Ans. 2.1323.
Ans. 3.789.
Hint: g(x) = 1 + tan−1 x, xn+1 = 1 + tan−1 xn ,
Hint: x0 = 3.5, x1 = 4, x2 = 3.7888,
f (2) = 0.10, f (3) = −0.75; choose x0 = 1,
f (x2 ) = −0.0009, f (x1 ) = −0.3979,
x1 = 1.7854, x2 = 2.0602, x3 = 2.1189, x4 =
root (3.7888, 4), x0 = 3.7888, x1 = 4,
2.1318, x5 = 2.1322, x6 = 2.1323.
x3 = 3.7893
18. Using fixed point
√ iteration method, evaluate apIteration Method
proximately (a) 12 (b) √1 .
12
13. Find a real root of x 3 + x 2 − 100 = 0.
Ans. (a) 3.46425 (b) 0.2887.
√
Ans. 4.3311
Hint: (a) 12 = x, x 2 = 12 or x = 12
= g(x).
x
Hint:
f (4) = −20 < 0,
f (5) = 50 > 0
Since 9 and 16
are
nearest
numbers
to
12 with
√
√
root in (4, 5), xn+1 = √x10+1 = g(x),
perfect
squares
9
=
3,
16
=
4.
Take
x0 =
n
5 =
3.4285,
x
=
3.5,
x
3.5,
x
=
3.4285,
x4 =
1
2
3
|g (x)| = (x+1)3/2 < 1 in (4, 5). Take x0 = 4.2
=
3.46425.
3.5, approximate root = 3.4285+3.5
2
1
1
x1 = 4.38529, x2 = 4.30919, x3 = 4.33996,
(b) x = √112 , x 2 = 12
or x = 12x
= g(x)
x4 = 4.32744, x5 = 4.33252, x6 = 4.33046,
1
choose
x0 = 3.5 = 0.285,
x1 = 0.2924,
x7 = 4.33129, x8 = 4.33096, x9 = 4.33109,
x2 = 0.285, x3 = 0.2924, approximate root
x10 = 4.33104, x11 = 4.33106, x12 = 4.33105,
= 0.285+0.2924
= 0.2887.
2
x13 = 4.33105
19. Find a real root of ex sin x = 1 using Newton–
14. Find the real root of the Equation
x−
x5
x7
x9
x 11
x3
+
−
+
−
+ ...
3
10 42 216 1320
= 0.4431135.
Ans. 0.4769.
3
5
7
9
11
x
x
+ 1320
Hint:
x = x3 − x10 + x42 − 216
+
0.4431135
x1 = 0.4699,
Choose
x0 = 0.44,
x2 = 0.4755, x3 = 0.47664, x4 = 0.47686,
x5 = 0.47690.
15. By iteration method, find a real root of sin x =
10(x − 1).
Ans. x = 1.088.
Hint: f (1) > 0 and f (2) < 0, root in (1, 2)
choose x0 = 1, x1 = 1.084, x2 = 1.088, x3 =
1.088
16. Using method of successive approximation find
a root of x 3 − 3x + 1 = 0.
Ans. 0.347.
Hint: f (0) = 1 > 0, f (1) = −1 < 0, xn+1 =
xn3 +1
.
3
Raphson’s method.
[JNTU Aug. 2006, Supply Set No. 3,
R059010202]
Hint:
f (x) = ex sin x − 1,
f (x) =
x
f (2) = 5.7188,
e (sin x + cos x).
f (π ) = −1; f (2) = 3.6439.
Since f (2) and f (2) have the same sign
choose x0 = 2. NR formula is
xn+1 = xn −
exn · sin xn − 1
,
exn (sin xn + cos xn )
= 0.4305, f (x1 ) = −0.358,
x1 = 2 − 5.7188
3.6439
f (x1 ) = 2.039, x2 = 0.606, f (x2 ) = 0.044,
f (x2 ) = 2.5507, x3 = 0.5887,
f (x3 ) = 0.0004178. Approximate root x3 =
0.5887.