Numerical Methods (Short Notes)
Numerical Methods (Short Notes)
(rough draft)
Chapter 1
Finite differences
Therefore,
4ex = ex+4x − ex
= ex+1 − ex
= ex e − ex
2
3
Thus,
4ex = (e − 1)ex (1.1.1)
42 ex = 4(4ex )
= 4[(e − 1)ex ]
= (e − 1)4ex
= (e − 1)(e − 1)ex
Thus,
42 ex = (e − 1)2 ex (1.1.2)
43 ex = 4(42 ex )
= 4[(e − 1)2 ex ]
= (e − 1)2 4ex
= (e − 1)2 (e − 1)ex
Thus,
43 ex = (e − 1)3 ex (1.1.3)
Continuing this we get
4n ex = (e − 1)n ex
Theorem 1.1.2. The nth difference of a polynomial of degree n is constant and all higher
order differences are zero.
4f (x) = f (x + h) − f (x))
= [an (x + h)n + an−1 (x + h)n−1 + · · · + a1 (x + h) + a0 ] − [an xn + an−1 xn−1 + · · · + a1 x + a0 ]
= an [(x + h)n − xn ] + an−1 [(x + h)n−1 − xn−1 ] + · · · + a1 [(x + h) − x]
= an nhxn−1 + a0n−2 xn−2 + · · · + a00
which is a constant and hence the (n + 1)st and higher differences of a polynomial of
degree n are zero.
4
• ∇f (x) = f (x) − f (x − h)
• Ef (x) = f (x + h)
• E −1 f (x) = f (x − h)
1. 4 = E − 1
2. ∇ = 1 − E −1
3. 4 = E∇ = ∇E
Proof. 1. Consider
4f (x) = f (x + h) − f (x)
= Ef (x) − f (x)
= (E − 1)f (x)
Thus 4 = E − 1
2. Consider
∇f (x) = f (x) − f (x − h)
= f (x) − E −1 f (x)
= (1 − E −1 )f (x)
Thus ∇ = 1 − E −1
3. Consider
Thus
E∇ = 4 (1.2.1)
5
Consider
Thus
∇E = 4 (1.2.2)
From (1.2.1) and (1.2.2) we get 4 = E∇ = ∇E.
x x0 x1 x2 ··· xn
y y0 y1 y2 ··· yn
4yr = yr+1 − yr (0 ≤ r ≤ n − 1)
42 yr = 4yr+1 − 4yr (0 ≤ r ≤ n − 2)
Example 1.3.1. Write the forward difference table for the following data:
x 0 1 2 3 4
y 1 2 4 8 16
x y 4y 42 y 43 y
x0 y0
4y0
x1 y1 42 y0
4y1 43 y0
x2 y2 42 y1
4y2
x3 y3
x y 4y 42 y 43 y 44 y
0 1
1
1 2 1
2 1
2 4 2 1
4 2
3 8 4
8
4 16
Example 1.3.2. Construct the forward difference table for the following data:
x 1 2 3 4 5 6 7 8
y 0 5 6 4 10 8 20 25
x y 4y 42 y 43 y 44 y 45 y 46 y 47 y
1 0
5
2 5 -4
1 1
3 6 -3 10
-2 11 -37
4 4 8 -27 102
6 -16 65 -248
5 10 -8 38 -146
-2 22 -81
6 8 14 -43
12 -21
7 20 -7
5
8 25
Example 1.3.3. Find the missing term in the following data:
x 0 1 2 3 4
y 1 2 - 82 257
Solution. Let the missing term be a. The forward difference table is as shown below.
x y 4y 42 y 43 y 44 y
0 1
1
1 2 a−3
a−2 87 − 3a
2 a 84 − 2a 6a − 78
82 − a 9 + 3a
3 82 93 + a
175
4 257
As only four y values are given, the function y can be represented by a polynomial of
degree less than or equal to 3. Therefore, 44 y = 0 i.e., 6a − 78 = 0 which gives a = 13.
Example 1.3.4. Find the missing term in the following data:
x 1 2 3 4 5 6
y 2 6 12 - 30 42
Solution. Let the missing term be a. The forward difference table is as shown below.
8
x y 4y 42 y 43 y 44 y 45 y
1 2
4
2 6 2
6 a − 20
3 12 a − 18 80 − 4a
a − 12 60 − 3a 10a − 200
4 a 42 − 2a 6a − 120
30 − a 3a − 60
5 30 a − 18
12
6 42
As only five y values are given, the function y can be represented by a polynomial of
degree less than or equal to 4. Therefore, 45 y = 0 i.e., 10a − 200 = 0 which gives a = 20.
Suppose a function y = f (x) is tabulated, for the equally spaced values of x, as under.
x x0 x1 x2 ··· xn
y y0 y1 y2 ··· yn
∇2 yr = ∇yr − ∇yr−1
x y ∇y ∇2 y ∇3 y
x0 y0
∇y1
x1 y1 ∇2 y2
∇y2 ∇3 y3
x2 y2 ∇2 y3
∇y3
x3 y3
Interpolation
Given
x 0 2 4 6
y 0 16 128 432
then to find f (1), we first fit a curve to the given data i.e., we find a function y = f (x)
such that f (0) = 0, f (2) = 16,f (4) = 128 and f (6) = 432. The graph of such a function
pass through the points (0, 0), (2, 16), (4, 128) and (6, 432). Then we use y = f (x) to find
f (1)(this process is called “interpolation”). Note that y = 2x3 fits the given data and we
take f (1) = 2.
Note. There could be several curves that fit the given data.
x 0 1
Example 2.0.5. Curves that fit the data are
y 0 1
πx
• y = sin
2
• y = xex−1
• y=x
x 0 1
There are, in fact, infinitely many functions which fit the data . Look at
y 0 1
the function y = xn (n > 1). But there is a unique polynomial of degree less than two
which fits the above data. In this example, it is y = x(polynomial of degree 1).
Theorem 2.0.6. There exists a unique polynomial of degree less than n + 1 which fits the
x x0 x1 x2 · · · xn
data
y y0 y1 y2 · · · yn
10
11
The unique polynomial in the above theorem, is known as the interpolating polyno-
mial and the process of finding this polynomial is known as polynomial interpolation.
Question: How to find the interpolating polynomial for the given data?
If in the given data, x values are equally spaced then Newton’s forward difference interpo-
lation formula (NFDIF) or Newton’s backward difference interpolation formula (NBDIF)
can be used to find the interpolating polynomial.
13
x x0 x1 x2 ··· xn
y y0 y1 y2 ··· yn
xi = x0 + ih (0 ≤ i ≤ n) (2.1.1)
Let
F (x) = a0 + a1 (x − x0 ) + a2 (x − x0 )(x − x1 )
+ a3 (x − x0 )(x − x1 )(x − x2 ) + · · · (2.1.2)
+ an (x − x0 )(x − x1 ) · · · (x − xn−1 )
be the interpolating polynomial that fits given data. Note that yi = F (xi ) (0 ≤ i ≤ n).
Putting x = x0 in the equation (2.1.2), we get
F (x0 ) = a0
which implies
a0 = y0 (as y0 = F (x0 )) (2.1.3)
Putting x = x1 in the equation (2.1.2), we get
F (x1 ) = a0 + a1 (x1 − x0 )
= a0 + a1 h (as x1 − x0 = h)
which implies
F (x1 ) − a0
a1 =
h
y1 − y0
= (as F (x1 ) = y1 and a0 = y0 )
h
Thus,
1
a1 = 4y0 (as 4y0 = y1 − y0 ) (2.1.4)
h
Putting x = x2 in the equation (2.1.2), we get
which implies
F (x2 ) − a0 − 2ha1
a2 =
2h2
y2 − y0 − 2h h1 4y0 1
= 2
(as F (x2 ) = y2 , a0 = y0 and a1 = 4y0 )
2h h
y2 − y0 − 2(y1 − y0 )
= (as 4y0 = y1 − y0 )
2h2
y2 − y0 − 2y1 + 2y0
=
2h2
y2 − 2y1 + y0
=
2h2
(y2 − y1 ) − (y1 − y0 )
=
2h2
4y1 − 4y0
= (as 4yr = yr+1 − yr )
2h2
Thus,
1 2
a2 = 4 y0 (as 42 y0 = 4y1 − 4y0 ) (2.1.5)
2h2
Putting x = x3 in the equation (2.1.2), we get
which implies
Therefore,
y3 − 3y2 + 6y1 − y0
a3 =
6h3
(y3 − y2 ) − (y2 − y1 ) − [(y2 − y1 ) − (y1 − y0 )]
=
6h3
4y2 − 4y1 − [4y1 − 4y0 ]
= (as 4yr = yr+1 − yr )
6h3
42 y1 − 42 y0
= 3
(as 42 yr = 4yr+1 − 4yr )
6h
Thus,
1
a3 = 43 y0 (as 43 y0 = 42 y1 − 42 y0 ) (2.1.6)
3!h3
Continuing this, we get
1
a4 = 44 y0 (2.1.7)
4!h4
1
a5 = 5
45 y0 (2.1.8)
5!h
1
an = 4n y0 (2.1.9)
n!hn
1 1
F (x) = y0 + 4y0 (x − x0 ) + 42 y0 (x − x0 )(x − x1 )
h 2!h2
1
+ 43 y0 (x − x0 )(x − x1 )(x − x2 )
3!h3
1
+ ··· + 4n y0 (x − x0 )(x − x1 )(x − x2 ) · · · (x − xn−1 )
n!hn
x − x0 42 y0 x − x0 x − x1
= y0 + 4y0 +
h 2! h h
3
4 y0 x − x0 x − x1 x − x2
+
3! h h h
4n y0 x − x0 x − x1 x − x2 x − xn−1
+ ··· + ···
n! h h h h
x − x0 x − xr x − [x0 + rh] [x − x0 ] − rh x − x0
Put s = . Note that = = = −r = s − r.
h h h h h
Therefore,
42 y0
F (x) = y0 + 4y0 s + s(s − 1)
2!
43 y0
+ s(s − 1)(s − 2)
3!
4n y0
+ ··· + s(s − 1)(s − 2) · · · (s − n + 1)
n!
Xn
s
= Cr 4r y0
r=0
16
s(s − 1)(s − 2) · · · (s − r + 1)
where s Cr = and s C0 = 1.
r!
Newton’s interpolation formulae - rewritten
• (NFDIF):
n
X
s
F (x) = Cr 4r y0
r=0
x − x0 s s(s − 1)(s − 2) · · · (s − r + 1)
where s = , Cr = and s C0 = 1.
h r!
• (NBDIF):
s(s + 1) 2
F (x) = yn + s∇yn + ∇ yn
2!
s(s + 1)(s + 2) · · · (s + n − 1) n
+ ··· + ∇ yn
n!
x − xn
where s = .
h
Example 2.1.1. Find the cubic polynomial which takes the following values:
x 0 1 2 3
y 1 4 13 34
x y 4y 42 y 43 y
0 1
3
1 4 6
9 6
2 13 12
21
3 34
x − x0
Here n = 3, x0 = 0, h = 1. Thus, s = = x. Further y0 = 1, 4y0 = 3, 42 y0 = 6
h
and 43 y0 = 6. Thus, we have
3
X
s
F (x) = Cr 4r y0
r=0
= y0 +s C1 4y0 +s C2 42 y0 +s C3 43 y0
s(s − 1) 2 s(s − 1)(s − 2) 3
= y0 + s4y0 + 4 y0 + 4 y0
2! 3!
x(x − 1) 2 x(x − 1)(x − 2) 3
= y0 + x4y0 + 4 y0 + 4 y0
2! 3!
6 6
= 1 + 3x + (x2 − x) + (x3 − 3x2 + 2x)
2 6
= 1 + 3x + 3(x2 − x) + x3 − 3x2 + 2x
= x3 + 2x + 1
Example 2.1.2. Find the interpolating polynomial that fits the following data:
x 0 1 2 3
y 1 2 9 28
x y 4y 42 y 43 y
0 1
1
1 2 6
7 6
2 9 12
19
3 28
x − x0
Here n = 3, x0 = 0, h = 1. Thus, s = = x. Further y0 = 1, 4y0 = 1, 42 y0 = 6
h
and 43 y0 = 6. Thus, we have
3
X
s
F (x) = Cr 4r y0
r=0
= y0 +s C1 4y0 +s C2 42 y0 +s C3 43 y0
s(s − 1) 2 s(s − 1)(s − 2) 3
= y0 + s4y0 + 4 y0 + 4 y0
2! 3!
x(x − 1) 2 x(x − 1)(x − 2) 3
= y0 + x4y0 + 4 y0 + 4 y0
2! 3!
6 6
= 1 + x + (x2 − x) + (x3 − 3x2 + 2x)
2 6
= 1 + x + 3(x2 − x) + x3 − 3x2 + 2x
= x3 + 1
Example 2.1.3. Estimate the population in 1895 and 1925 from the following data:
x y 4y 42 y 43 y 44 y
1891 46
20
1901 66 -5
15 2
1911 81 -3 -3
12 -1
1921 93 -4
8
1931 101
n
X
s
F (x) = Cr 4r y0
r=0
19
x − x0 1895 − 1891
Here n = 4, x0 = 1891, h = 10 and x = 1895. Thus, s = = = 0.4.
h 10
Further y0 = 46, 4y0 = 20, 42 y0 = −5 43 y0 = 2 and 44 y0 = −3. Thus, we have
4
X
s
F (1895) = Cr 4r y0
r=0
= y0 +s C1 4y0 +s C2 42 y0 +s C3 43 y0 +s C4 44 y0
s(s − 1) 2 s(s − 1)(s − 2) 3
= y0 + s4y0 + 4 y0 + 4 y0
2! 3!
s(s − 1)(s − 2)(s − 3) 4
+ 4 y0
4!
0.4(0.4 − 1) 2
= y0 + (0.4)4y0 + 4 y0
2!
0.4(0.4 − 1)(0.4 − 2) 3
+ 4 y0
3!
0.4(0.4 − 1)(0.4 − 2)(0.4 − 3) 4
+ 4 y0
4!
Therefore,
s(s + 1) 2
F (x) = yn + s∇yn + ∇ yn
2!
s(s + 1)(s + 2) · · · (s + n − 1) n
+ ··· + ∇ yn
n!
x − xn 1925 − 1931
Here n = 4, xn = x4 = 1931, h = 10 and x = 1925. Thus, s = = =
h 10
2 2 3 3
−0.6. Further yn = y4 = 101, ∇yn = ∇y4 = 8, ∇ yn = ∇ y4 = −4 ∇ yn = ∇ y4 = −1
20
s(s + 1) 2
F (1925) = y4 + s∇y4 + ∇ y4
2!
s(s + 1)(s + 2) 3 s(s + 1)(s + 2)(s + 3) 4
+ ∇ y4 + ∇ y4
3! 4!
(−0.6)(−0.6 + 1) 2
= y4 + (−0.6)∇y4 + ∇ y4
2!
(−0.6)(−0.6 + 1)(−0.6 + 2) 3
+ ∇ y4
3!
(−0.6)(−0.6 + 1)(−0.6 + 2)(−0.6 + 3) 4
+ ∇ y4
4!
(−0.6)(0.4) 2
= y4 + (−0.6)∇y4 + ∇ y4
2!
(−0.6)(0.4)(1.4) 3
+ ∇ y4
3!
(−0.6)(0.4)(1.4)(2.4) 4
+ ∇ y4
4!
Therefore,
(−0.6)(0.4)
F (1925) = 101 + (−0.6)8 + (−4)
2!
(−0.6)(0.4)(1.4)
+ (−1)
3!
(−0.6)(0.4)(1.4)(2.4)
+ (−3)
4!
= 101 − 4.8 + 0.48 + 0.056 + 0.1008
= 96.8368
Example 2.1.4. From the following table, estimate the number of students who obtained
marks between 40 and 45:
x y 4y 42 y 43 y 44 y
40 31
42
50 73 9
51 -25
60 124 -16 37
35 12
70 159 -4
31
80 190
Now we find the number of students with marks less than 45. According to NFDIF
Xn
s
F (x) = Cr 4r y0
r=0
x − x0 45 − 40
Here n = 4, x0 = 40, h = 10 and x = 45. Thus, s = = = 0.5. Further
h 10
2 3 4
y0 = 31, 4y0 = 42, 4 y0 = 9 4 y0 = −25 and 4 y0 = 37. Thus, we have
4
X
s
F (45) = Cr 4r y0
r=0
= y0 +s C1 4y0 +s C2 42 y0 +s C3 43 y0 +s C4 44 y0
s(s − 1) 2 s(s − 1)(s − 2) 3
= y0 + s4y0 + 4 y0 + 4 y0
2! 3!
s(s − 1)(s − 2)(s − 3) 4
+ 4 y0
4!
0.5(0.5 − 1) 2
= y0 + (0.5)4y0 + 4 y0
2!
0.5(0.5 − 1)(0.5 − 2) 3
+ 4 y0
3!
0.5(0.5 − 1)(0.5 − 2)(0.5 − 3) 4
+ 4 y0
4!
Therefore,
0.5(0.5 − 1) 0.5(0.5 − 1)(0.5 − 2)
F (45) = 31 + (0.5)42 + (9) + (−25)
2! 3!
0.5(0.5 − 1)(0.5 − 2)(0.5 − 3)
+ (37)
4!
= 31 + 21 − 1.125 − 1.5625 − 1.4453125
= 47.8671875
Therefore, the number of students with marks less than 45 is 48. Note that the number
of students with marks less than 40 is 31. Thus the number of students getting marks
between 40 and 45 is 48 − 31 = 17.
22
x x0 x1 x2 ··· xn
y y0 y1 y2 ··· yn
(x − x1 )(x − x2 ) · · · (x − xn )
F (x) = y0
(x0 − x1 )(x0 − x2 ) · · · (x0 − xn )
(x − x0 )(x − x2 ) · · · (x − xn )
+ y1 + · · ·
(x1 − x0 )(x1 − x2 ) · · · (x1 − xn )
(x − x0 )(x − x1 ) · · · (x − xi−1 )(x − xi+1 ) · · · (x − xn )
+ yi + · · ·
(xi − x0 )(xi − x1 ) · · · (xi − xi−1 )(xi − xi+1 ) · · · (xi − xn )
(x − x0 )(x − x1 ) · · · (x − xn−1 )
+ yn
(xn − x0 )(xn − x1 ) · · · (xn − xn−1 )
Example 2.2.1. Using Langrange’s interpolation formula, find f (4) given that f (0) = 6,
f (1) = 8,f (3) = 16 and f (6) = 34
Solution. Given
x0 = 0 x1 = 1 x2 = 3 x3 = 6
y0 = 6 y1 = 8 y2 = 16 y3 = 34
If F (x) is the interpolating polynomial that fits the given data, then, by Langrange’s
interpolation formula, we have
Therefore,
(y − y1 )(y − y2 ) · · · (y − yn )
F (y) = x0
(y0 − y1 )(y0 − y2 ) · · · (y0 − yn )
(y − y0 )(y − y2 ) · · · (y − yn )
+ x1 + · · ·
(y1 − y0 )(y1 − y2 ) · · · (y1 − yn )
(y − y0 )(y − y1 ) · · · (y − yi−1 )(y − yi+1 ) · · · (y − yn )
+ xi + · · ·
(yi − y0 )(yi − y1 ) · · · (yi − yi−1 )(yi − yi+1 ) · · · (yi − yn )
(y − y0 )(y − y1 ) · · · (y − yn−1 )
+ xn
(yn − y0 )(yn − y1 ) · · · (yn − yn−1 )
Example 2.3.1. Apply Langrange’s method to find the value of x when f (x) = 15 from
the following data
x 5 6 9 11
y 12 13 14 16
Solution. Given
x0 = 5 x1 = 6 x2 = 9 x3 = 11
y0 = 12 y1 = 13 y2 = 14 y3 = 16
24
Example 2.3.2. Apply Langrange’s formula inversely to obtain a root of the equation
f (x) = 0, given that f (30) = −30, f (34) = −13, f (38) = 3 and f (42) = 18
Solution. Given
x0 = 30 x1 = 34 x2 = 38 x3 = 42
y0 = −30 y1 = −13 y2 = 3 y3 = 18
25
Not all functions (of a single variable) can be differentiated/integrated with the rules
(or methods or techniques) of differentiation/integration that we have studied so far. To
find an approximate value of the derivatives/integral of such functions, we use numerical
methods.
x x0 x1 x2 ··· xn
y y0 y1 y2 ··· yn
where x values are equally spaced with spacing h. Then xi = x0 + ih (0 ≤ i ≤ n). Now
replacing the given function by the interpolating polynomial (got by using NFDIF) we
26
27
have
n
X
s x − x0
y= Cr 4r y0 (where s = )
r=0
h
= y0 + s C1 4y0 + s C2 42 y0 + s C3 43 y0 + s C4 44 y0 + · · ·
42 y0 43 y0 44 y0
= y0 + 4y0 s + s(s − 1) + s(s − 1)(s − 2) + s(s − 1)(s − 2)(s − 3) + · · ·
2! 3! 4!
42 y0 2 43 y0 3 44 y0 4
= y0 + 4y0 s + (s − s) + (s − 3s2 + 2s) + (s − 6s3 + 11s2 − 6s) + · · ·
2 6 24
42 y0 2 43 y0 3 44 y0 4
dy d 2 3 2
= y0 + 4y0 s + (s − s) + (s − 3s + 2s) + (s − 6s + 11s − 6s) + · · ·
ds ds 2 6 24
d 42 y0 2 d 43 y0 3
d d 2
= (y0 ) + (4y0 s) + (s − s) + (s − 3s + 2s)
ds ds ds 2 ds 6
d 44 y0 4
3 2
+ (s − 6s + 11s − 6s) + · · ·
ds 24
ds 42 y0 d 2 43 y0 d 3
= 0 + 4y0 + (s − s) + (s − 3s2 + 2s)
ds 2 ds 6 ds
44 y0 d 4
+ (s − 6s3 + 11s2 − 6s) + · · ·
24 ds
Therefore,
42 y0 43 y0 2 44 y0 3
dy 2
= 4y0 + (2s − 1) + (3s − 6s + 2) + (4s − 18s + 22s − 6) + · · ·
ds 2 6 24
(3.1.1)
Now differentiating y w.r.t. x we get,
dy dy ds
= (by chain rule)
dx ds dx
1 dy ds 1
= because =
h ds dx h
42 y0 43 y0 2 44 y0 3
dy 1 2
= 4y0 + (2s − 1) + (3s − 6s + 2) + (4s − 18s + 22s − 6) + · · ·
dx h 2 6 24
(3.1.2)
28
d2 y
1 2 3 11 4
= 2 4 y0 − 4 y0 + 4 y0 + · · ·
dx2 x=x0 h 12
29
x 1 2 3 4 5
y 3 21 91 273 651
1 3
18
2 21 52
70 60
3 91 112 24
182 84
4 273 196
378
5 651
x − x0 1.5 − 1
Here x0 = 1, x = 1.5, h = 1 and s = = = 0.5.
h 1
We know that
42 y0 43 y0 2 44 y0 3
dy 1 2
= 4y0 + (2s − 1) + (3s − 6s + 2) + (4s − 18s + 22s − 6) + · · ·
dx h 2 6 24
Therefore,
0 1 52 60 2 24 3 2
y (1.5) = 18 + (2(0.5) − 1) + (3(0.5) − 6(0.5) + 2) + (4(0.5) − 18(0.5) + 22(0.5) − 6)
1 2 6 24
= [18 + 26(0) + 10(−0.25) + 1]
= 16.5
we know that
d2 y 44 y0 2
1 2 3
= 2 4 y0 + 4 y0 (s − 1) + (6s − 18s + 11) + · · ·
dx2 h 12
Therefore,
00 1 24 2
y (1.5) = 2 52 + 60(0.5 − 1) + (6(0.5) − 18(0.5) + 11)
1 12
= [52 − 30 + 2(3.5)]
= 29
30
1 100
58.56
1.2 158.56 48.64
107.2 20.16
1.4 265.76 68.8 3.84
176 24
1.6 441.76 92.8
268.8
1.8 710.56
We know that
dy 1 1 2 1 3 1 4
= 4y0 − 4 y0 + 4 y0 − 4 y0 + · · ·
dx x=x0 h 2 3 4
Therefore,
0 1 1 1 1
y (1) = 58.56 − (48.64) + (20.16) − (3.84)
0.2 2 3 4
1
= [58.56 − 24.32 + 6.72 − 0.96]
0.2
1
= (40)
0.2
= 200
We know that
d2 y
1 2 3 11 4
= 2 4 y0 − 4 y0 + 4 y0 + · · ·
dx2 x=x0 h 12
Therefore,
00 1 11
y (1) = 48.64 − 20.16 + (3.84)
(0.2)2 12
1
= [48.64 − 20.16 + 3.52]
0.04
1
= (32)
0.04
= 800
31
∇2 yn ∇3 yn 2 ∇4 yn 3
dy 1 2
= ∇yn + (2s + 1) + (3s + 6s + 2) + (4s + 18s + 22s + 6) + · · ·
dx h 2 6 24
(3.1.5)
2
dy 1 1
2
= 2 ∇2 yn + (s + 1)∇3 yn + (6s2 + 18s + 11)∇4 yn + · · · (3.1.6)
dx h 12
By putting s = 0 in Equations (3.1.5) and (3.1.6) we get the first and second derivatives
of y = f (x) at the end point x = xn and are given by
dy 1 1 2 1 3 1 4
= ∇yn + ∇ yn + ∇ yn + ∇ yn + · · ·
dx x=xn h 2 3 4
d2 y
1 2 3 11 4
= 2 ∇ yn + ∇ yn + ∇ yn + · · ·
dx2 x=xn h 12
x 1 2 3 4 5
y 3 21 91 273 651
x y 4y 42 y 43 y 44 y
1 3
18
2 21 52
70 60
3 91 112 24
182 84
4 273 196
378
5 651
x − xn 4.5 − 5
Here xn = 5, x = 4.5, h = 1 and s = = = −0.5.
h 1
We know that
dy 1 1 2 1 2 3 1 3 2 4
= ∇yn + (2s + 1)∇ yn + (3s + 6s + 2)∇ yn + (4s + 18s + 22s + 6)∇ yn + · · ·
dx h 2 6 24
32
Therefore,
0 1 1 1
y (4.5) = 378 + (2(−0.5) + 1)196 + (3(−0.5)2 + 6(−0.5) + 2)84
1 2 6
1 3 2
+ (4(−0.5) + 18(−0.5) + 22(−0.5) + 6)24 + · · ·
24
1
= 378 + (−0.25)84 − 1
6
= 373.5
We know that
d2 y
1 2 3 1 2 4
= 2 ∇ yn + (s + 1)∇ yn + (6s + 18s + 11)∇ yn + · · ·
dx2 h 12
Therefore,
00 1 1 2
y (4.5) = 2 196 + (−0.5 + 1)84 + (6(−0.5) + 18(−0.5) + 11)24
1 12
= 196 + 42 + 7
= 245
x 1 2 3 4 5
y 0.121 1.936 9.801 30.976 75.625
1 0.121
1.815
2 1.936 6.05
7.865 7.26
3 9.801 13.31 2.904
21.175 10.164
4 30.976 23.474
44.649
5 75.625
We know that
dy 1 1 2 1 3 1 4
= ∇yn + ∇ yn + ∇ yn + ∇ yn + · · ·
dx x=xn h 2 3 4
33
Therefore,
0 1 1 1 1
y (5) = 44.649 + (23.474) + (10.164) + (2.904)
1 2 3 4
= 44.649 + 11.737 + 3.388 + 0.726
= 60.5
We know that
d2 y
1 2 3 11 4
= 2 ∇ yn + ∇ yn + ∇ yn + · · ·
dx2 x=xn h 12
Therefore,
00 1 11
y (5) = 23.474 + 10.164 + (2.904)
(1)2 12
= 23.474 + 10.164 + 2.662
= 36.3
x x0 x1 x2 ··· xn
y y0 y1 y2 ··· yn
34
Now replacing the given function by the interpolating polynomial(got by NFDIF) we have
Zb
I= f (x) dx
a
Zb
1 1
= y0 + 4y0 (x − x0 ) + 42 y0 (x − x0 )(x − x1 )
h 2!h2
a
1 3
+ 3 4 y0 (x − x0 )(x − x1 )(x − x2 ) + · · · dx
3!h
x − x0 1
Put s = . This implies ds = dx i.e., dx = h ds
h h
When x = a (i.e., x = x0 ), s = 0
x0 + nh − x0
and when x = b (i.e., x = x0 + nh), s = = n. Therefore,
h
Zn
42 y0 43 y0
I= y0 + 4y0 s + s(s − 1) + s(s − 1)(s − 2) + · · · h ds
2! 3!
0
Zn
42 y0 2 43 y0 3
2
=h y0 + 4y0 s + (s − s) + (s − 3s + 2s) + · · · ds
2! 3!
0
n
s2 42 y0 s3 s2 43 y0 s4
3 2
= h y0 s + 4y0 + − + − s + s + ···
2 2! 3 2 3! 4
0
n2 42 y0 n3 n2 43 y0 n4
= h y0 n + 4y0 + − + − n3 + n2 + · · ·
2 2! 3 2 3! 4
i.e.,
Zb
1
f (x) dx = h y0 + (y1 − y0 )
2
a
h
= (y0 + y1 )
2
i.e.,
35
Rb
f (x) dx =(1/2)(length of the interval)[y at left end point+y at right end point]
a
Note. If we do not divide the interval [a, b](i.e., when n = 1) then we get a very crude
Rb
value of the integral I = f (x) dx. To get more accurate value of I, we divide the interval
a
into n sub-intervals of width h, use trapezoidal rule to evaluate the integral of f (x) over
each of these sub-intervals and finally add all these values.
Dividing the interval [a, b] into n sub-intervals of width h and using trapezoidal rule
we get,
x
Zr+1
h
f (x) dx = (yr + yr+1 ) (0 ≤ r ≤ n − 1)
2
xr
Therefore,
Zb Zxn
f (x) dx = f (x) dx
a x0
Zx1 Zx2 Zx3 xZn−1 Zxn
= f (x) dx + f (x) dx + f (x) dx + · · · + f (x) dx + f (x) dx
x0 x1 x2 xn−2 xn−1
h h h h h
= (y0 + y1 ) + (y1 + y2 ) + (y2 + y3 ) + · · · + (yn−2 + yn−1 ) + (yn−1 + yn )
2 2 2 2 2
h
= [(y0 + y1 ) + (y1 + y2 ) + (y2 + y3 ) + · · · + (yn−2 + yn−1 ) + (yn−1 + yn )]
2
h
= [(y0 + yn ) + 2(y1 + y2 + · · · + yn−1 )]
2
This is known as the composite trapezoidal rule. Henceforth we drop the word “compos-
ite”and say trapezoidal rule for the composite trapezoidal rule.
Simpson’s one third rule:Putting n = 2 in the Newton-Cotes’ quadrature formula, we
get
1 2
I = h 2y0 + 24y0 + 4 y0
3
36
i.e.,
Zb
1
f (x) dx = h 2y0 + 2(y1 − y0 ) + (y2 − 2y1 + y0 )
3
a
1
= h 2y0 + 2y1 − 2y0 + (y2 − 2y1 + y0 )
3
1
= h 2y1 + (y2 − 2y1 + y0 )
3
h
= (y0 + 4y1 + y2 )
3
Dividing the interval [a, b] into n sub-intervals of width h(n, an even number) and using
Simpson’s one third rule we get,
x
Zr+2
h
f (x) dx = (yr + 4yr+1 + yr+2 ) (0 ≤ r ≤ n − 2)
3
xr
Therefore,
Zb Zxn
f (x) dx = f (x) dx
a x0
Zx2 Zx4 Zx6 xZn−2 Zxn
= f (x) dx + f (x) dx + f (x) dx + · · · + f (x) dx + f (x) dx
x0 x2 x4 xn−4 xn−2
h h h
= (y0 + 4y1 + y2 ) + (y2 + 4y3 + y4 ) + (y4 + 4y5 + y6 )
3 3 3
h h
+ · · · + (yn−4 + 4yn−3 + yn−2 ) + (yn−2 + 4yn−1 + yn )
3 3
h
= [(y0 + 4y1 + y2 ) + (y2 + 4y3 + y4 ) + (y4 + 4y5 + y6 )
3
+ · · · + (yn−4 + 4yn−3 + yn−2 ) + (yn−2 + 4yn−1 + yn )]
h
= [(y0 + yn ) + 2(y2 + y4 + y6 · · · + yn−2 ) + 4(y1 + y3 + y5 · · · + yn−1 )]
3
This is known as the composite Simpson’s one third rule. Henceforth we drop the word
“composite”and say Simpson’s one third rule for the composite Simpson’s one third rule.
get
9 9 2 3 3
I = h 3y0 + 4y0 + 4 y0 + 4 y0
2 4 8
3h
8y0 + 124y0 + 642 y0 + 43 y0
=
8
i.e.,
Zb
3h
f (x) dx = [8y0 + 12(y1 − y0 ) + 6(y2 − 2y1 + y0 ) + (y3 − 3y2 + 3y1 − y0 )]
8
a
3h
= [8y0 + 12y1 − 12y0 + 6y2 − 12y1 + 6y0 + y3 − 3y2 + 3y1 − y0 ]
8
3h
= [y0 + 3y1 + 3y2 + y3 ]
8
This is known as the Simpson’s (3/8)th rule.
Dividing the interval [a, b] into n sub-intervals of width h(n, a multiple of 3) and using
Simpson’s (3/8)th rule we get,
x
Zr+3
3h
f (x) dx = (yr + 3yr+1 + 3yr+2 + yr+3 ) (0 ≤ r ≤ n − 3)
8
xr
Therefore,
Zb Zxn
f (x) dx = f (x) dx
a x0
Zx3 Zx6 Zx9 xZn−3 Zxn
= f (x) dx + f (x) dx + f (x) dx + · · · + f (x) dx + f (x) dx
x0 x3 x6 xn−6 xn−3
3h 3h 3h
= (y0 + 3y1 + 3y2 + y3 ) + (y3 + 3y4 + 3y5 + y6 ) + (y6 + 3y7 + 3y8 + y9 )
8 8 8
3h 3h
+ · · · + (yn−6 + 3yn−5 + 3yn−4 + yn−3 ) + (yn−3 + 3yn−2 + 3yn−1 + yn )
8 8
3h
= [(y0 + 3y1 + 3y2 + y3 ) + (y3 + 3y4 + 3y5 + y6 ) + (y6 + 3y7 + 3y8 + y9 )
8
+ · · · + (yn−6 + 3yn−5 + 3yn−4 + yn−3 ) + (yn−3 + 3yn−2 + 3yn−1 + yn )]
i.e.,
Zb
3h
f (x) dx = [(y0 + yn ) + 2(y3 + y6 + y9 + · · · + yn−3 ) + 3(y1 + y2 + y4 + y5 + · · · + yn−2 + yn−1 )]
8
a
38
This is known as the composite Simpson’s (3/8)th rule. Henceforth we drop the word
“composite”and say Simpson’s (3/8)th rule for the composite Simpson’s (3/8)th rule.
Weddle’s rule: Putting n = 6 in the Newton-Cotes’ quadrature formula and replacing
41 3
140
46 y0 by 10 46 y0 we get
Zb
3h
y dx = (y0 + 5y1 + y2 + 6y3 + y4 + 5y5 + y6 )
10
a
R6 dx
Example 3.2.1. Evaluate 1+x2
, using trapezoidal rule by taking seven ordinates. Com-
0
pare your answer with the actual value of the integral.
1
Solution. Let y = . Since we need to take seven ordinates, we divide the interval
1 + x2
1
[0, 6] into six sub-intervals of width h = 1. The values of the function y = are as
1 + x2
given below.
x 0 1 2 3 4 5 6
y 1 0.5 0.2 0.1 0.0588 0.03846 0.027
Zxn
h
y dx = [(y0 + yn ) + 2(y1 + y2 + · · · + yn−1 )]
2
x0
Since n = 6 we get,
Zx6
h
y dx = [(y0 + y6 ) + 2(y1 + y2 + y3 + y4 + y5 )]
2
x0
1
Here, x0 = 0, x6 = 6, y = , h = 1, y0 = 1, y1 = 0.5, y2 = 0.2, y3 = 0.1, y4 = 0.0588,
1 + x2
y5 = 0.03846 and y6 = 0.027. Therefore,
Z6
dx 1
2
= [(1 + 0.027) + 2(0.5 + 0.2 + 0.1 + 0.0588 + 0.03846)]
1+x 2
0
1
= [1.027 + 2(0.89726)]
2
= 1.41076(= IT , say)
39
Note that,
Z6
dx 6
2
= tan−1 (x) 0
1+x
0
= tan−1 (6) − tan−1 (0)
= tan−1 (6)
≈ 1.4056(= IA , say)
| IT − IA |= 0.00516. Therefore, the value of the given integral got by using trapezoidal
rule agrees with its actual value up to two decimal places.
R1 dx
Example 3.2.2. Evaluate 1+x
, using trapezoidal rule by taking h = 1/6 and hence find
0
an approximate value of log 2.
1 1
Solution. Let y = . The values of the function y = are as given below.
1+x 1+x
Since n = 6 we get,
Zx6
h
y dx = [(y0 + y6 ) + 2(y1 + y2 + y3 + y4 + y5 )]
2
x0
1
Here, x0 = 0, x6 = 1, y = , h = 1/6, y0 = 1, y1 = 6/7, y2 = 6/8, y3 = 6/9,
1+x
y4 = 6/10, y5 = 6/11 and y6 = 0.5. Therefore,
Z1
dx 1/6 6 6 6 6 6
= (1 + 0.5) + 2 + + + +
1+x 2 7 8 9 10 11
0
1
≈ [1.5 + 2(3.41926)]
12
= 0.694877
40
Note that,
Z1
dx
= log(1 + x)|10
1+x
0
= log 2 − log 1
= log 2
x y
1 1.5
1.1 1.3853
1.2 1.2879
1.3 1.204
1.4 1.131
1.5 1.0667
1.6 1.0096
1.7 0.9586
1.8 0.9127
1.9 0.8711
2 0.8333
Since n = 10 we get,
Zx10
h
y dx = [(y0 + y10 ) + 2(y2 + y4 + y6 + y8 ) + 4(y1 + y3 + y5 + y7 + y9 )]
3
x0
2x + 1
Here, x0 = 1, x10 = 2, y = 2 , h = 0.1, y0 = 1.5, y1 = 1.3853, y2 = 1.2879,
x +x
y3 = 1.204, y4 = 1.131, y5 = 1.0667, y6 = 1.0096, y7 = 0.9586, y8 = 0.9127, y9 = 0.8711
41
Z2
2x + 1 0.1
2
dx = [(1.5 + 0.8333) + 2 (1.2879 + 1.131 + 1.0096 + 0.9127)
x +x 3
1
+4(1.3853 + 1.204 + 1.0667 + 0.9586 + 0.8711)]
0.1
= [2.3333 + 2(4.3412) + 4(5.4857)]
3
≈ 1.098617
Note that,
Z2
2x + 1 2
2
dx = log(x2 + x) 1
x +x
1
Z 0
f (x)
because dx = log f (x) + C
f (x)
= log 6 − log 2
6
= log
2
= log 3
R2 2
Example 3.2.4. Evaluate ex dx, using Simpson’s one third rule by taking h = 0.2.
0
2 2
Solution. Let y = ex . The values of the function y = ex are as given below.
x y
0 1
0.2 1.0408
0.4 1.1735
0.6 1.4333
0.8 1.8965
1.0 2.7183
1.2 4.2207
1.4 7.0993
1.6 12.9358
1.8 25.5337
2 54.5982
42
Since n = 10 we get,
Zx10
h
y dx = [(y0 + y10 ) + 2(y2 + y4 + y6 + y8 ) + 4(y1 + y3 + y5 + y7 + y9 )]
3
x0
2
Here, x0 = 0, x10 = 2, y = ex , h = 0.2, y0 = 1, y1 = 1.0408, y2 = 1.1735, y3 = 1.4333,
y4 = 1.8965, y5 = 2.7183, y6 = 4.2207, y7 = 7.0993, y8 = 12.9358, y9 = 25.5337 and
y10 = 54.5982. Therefore,
Z2
2 0.2
ex dx = [(1 + 54.5982) + 2 (1.1735 + 1.8965 + 4.2207 + 12.9358)
3
0
+4(1.0408 + 1.4333 + 2.7183 + 7.0993 + 25.5337)]
0.2
= [55.5982 + 2(20.2265) + 4(37.8254)]
3
≈ 16.49019
R1 dx
Example 3.2.5. Evaluate 1+x
, using Simpson’s (3/8)th rule by taking h = 1/6 and
0
hence find an approximate value of log 2.
1 1
Solution. Let y = . The values of the function y = are as given below.
1+x 1+x
x 0 1/6 2/6 3/6 4/6 5/6 1
y 1 6/7 6/8 6/9 6/10 6/11 0.5
Since n = 6 we get,
Zx6
3h
y dx = [(y0 + y6 ) + 2y3 + 3(y1 + y2 + y4 + y5 )]
8
x0
43
1
Here, x0 = 0, x6 = 1, y = , h = 1/6, y0 = 1, y1 = 6/7, y2 = 6/8, y3 = 6/9,
1+x
y4 = 6/10, y5 = 6/11 and y6 = 0.5. Therefore,
Z1
dx 3(1/6) 6 6 6 6 6
= (1 + 0.5) + 2 +3 + + +
1+x 8 9 7 8 10 11
0
1 4
≈ [1.5 + + 3(2.7526)]
16 3
≈ 0.6931958
Note that,
Z1
dx
= log(1 + x)|10
1+x
0
= log 2 − log 1
= log 2
Example 3.2.6. The velocity v(m/sec) of a particle at a distance s meters from a point
on its path is given in the following table.
s 0 10 20 30 40 50 60
v 47 58 64 65 61 52 38
Using Simpson’s one third rule, estimate the time taken by the particle to travel 60 meters.
ds 1
Solution. We know that v = . This implies dt = ds. The time taken by the particle
dt v
R60 1
to travel 60 meters is given by ds. To evaluate this integral we use Simpson’s one
0 v
third rule. According to Simpson’s one third rule,
Zxn
h
y dx = [(y0 + yn ) + 2(y2 + y4 + · · · + yn−2 ) + 4(y1 + y3 + · · · + yn−1 )]
3
x0
Since n = 6 we get,
Zx6
h
y ds = [(y0 + y6 ) + 2(y2 + y4 ) + 4(y1 + y3 + y5 )]
3
x0
44
1 1 1 1 1 1
Here, x0 = 0, x6 = 60, y = , h = 10, y0 = , y1 = , y2 = , y3 = , y4 = ,
v 47 58 64 65 61
1 1
y5 = , y6 = . Therefore,
52 38
Z60
1 10 1 1 1 1 1 1 1
ds = + +2 + +4 + +
v 3 47 38 64 61 58 65 52
0
10
≈ [(0.04759) + 2(0.03202) + 4(0.05186)]
3
≈ 1.06357
Thus, the required time is 1.06357 seconds.
Example 3.2.7. A solid of revolution is formed by rotating about the x-axis, the area
between the lines x = 0, x = 1, the x-axis and a curve through the points with the
following coordinates.
x 0 0.25 0.5 0.75 1
y 1 0.9896 0.9589 0.9089 0.8415
Estimate the volume of the solid formed using Simpson’s rule.
R1 R1
Solution. The required volume is given by πy 2 dx i.e., π y 2 dx. To evaluate the integral
0 0
R1
y 2 dx we use Simpson’s one third rule. According to Simpson’s one third rule,
0
Zxn
h
y dx = [(y0 + yn ) + 2(y2 + y4 + · · · + yn−2 ) + 4(y1 + y3 + · · · + yn−1 )]
3
x0
Since n = 4 we get,
Zx4
h
y dx = [(y0 + y4 ) + 2y2 + 4(y1 + y3 )]
3
x0
R1 1
Example 3.2.8. Evaluate 1+x2
dx using Weddle’s rule by taking seven ordinates.
0
1
Solution. Here y = . the function y in the tabular form is as shown below.
1 + x2
x 0 1/6 2/6 3/6 4/6 5/6 1
y 1 36/37 36/40 36/45 36/52 36/61 0.5
Zb
3h
y dx = (y0 + 5y1 + y2 + 6y3 + y4 + 5y5 + y6 )
10
a
1
Here a = 0, b = 1, y = , h = 1/6, y0 = 1, y1 = 36/37, y2 = 36/40, y3 = 36/45,
1 + x2
y4 = 36/52, y5 = 36/61 and y6 = 0.5
Therefore,
Z1
1 3(1/6) 36 36 36 36 36
dx = 1+5 + +6 + +5 + 0.5
1 + x2 10 37 40 45 52 61
0
1
= [1 + 4.8649 + 0.9 + 4.8 + 0.6923 + 2.9508 + 0.5]
20
= 0.7854
Chapter 4
Many real world problems lead us to either single equation or a system of equations and
we are required solve such equation(s). When there is no analytical method for finding
the exact solution, we use numerical methods to get an approximate value of the required
solution.
In this chapter we shall discuss few numerical methods to solve single equation/system of
equations.
46
47
Example 4.1.5. Using the bisection method, find a real root of the equation cos x =
x exp(x) in [0, 1] correct to three decimal places.
Solution. Let f(x) := cos (x) − x exp(x). Since f(0) := cos (0) − 0 exp(0) = 1 > 0 and
f(1) := cos (1) − exp(1) ≈ −1.7184, there is a root of f(x) := cos (x) − x exp(x) between
0 and 1.
0+1
The first approximation to the root is x1 = = 0.5. Note that f(x1 ) = f(0.5) =
2
cos (0.5) − (0.5) exp(0.5) ≈ 0.05322 > 0. Therefore, a root lies between 0.5 and 1.
0.5 + 1
The second approximation to the root is x2 = = 0.75. Note that f(x2 ) = f(0.75) =
2
cos (0.75) − (0.75) exp(0.75) ≈ −0.85606 < 0. Therefore, a root lies between 0.5 and 0.75.
0.5 + 0.75
The third approximation to the root is x3 = = 0.625. Note that f(x3 ) =
2
f(0.625) = cos (0.625)−(0.625) exp(0.625) ≈ −0.35669 < 0. Therefore, a root lies between
0.5 and 0.625.
The successive approximation to the root got by repeating this process are,
and x10 = 0.5185546875. Since | x10 − x9 |=| 0.5185546875 − 0.517578125 |< 10−3 , a root
of the given equation correct to three decimal places is 0.5185546875.
49
Example 4.1.6. Using the method of false position, find a real root of the equation
x3 − 3x + 1 in [0, 1]. Carry out three iterations.
Note that f (x1 ) = f (0.5) = −0.375 < 0. Therefore, a root lies between 0 and 0.5
Taking a = 0 and b = 0.5 in the RHS of Equation (4.1.1) we get
0.5 − 0
x2 := 0 − f (0)
f (0.5) − f (0)
Therefore,
0.5
x2 = − (1)
−0.375 − 1
≈ 0.36364
Note that f (x2 ) = f (0.36364) ≈ −0.0428 < 0. Therefore, a root lies between 0 and
0.36364
Taking a = 0 and b = 0.36364 in the RHS of Equation (4.1.1) we get
0.36364 − 0
x3 := 0 − f (0)
f (0.36364) − f (0)
Therefore,
0.36364
x3 = − (1)
−0.0428 − 1
≈ 0.3487
Example 4.1.7. Using the method of false position, find a real root of the equation
2x − log x = 7 in [4, 5]. Carry out three iterations.
Solution. Let f (x) = 2x − log x − 7, a = 4 and let b = 5. Since f (a) = f (4) = 2(4) −
log 4 − 7 ≈ −0.38629 < 0 and f (b) = f (5) = 2(5) − log 5 − 7 ≈ 1.39056 > 0, a root lies
between 4 and 5.
51
In the method of false position, an approximate value of a root (lying between a and b)
of the equation f (x) = 0 is given by
b−a
c=a− f (a) (4.1.2)
f (b) − f (a)
Taking a = 4 and b = 5 in the RHS of Equation (4.1.2) we get
5−4
x1 := 4 − f (4)
f (5) − f (4)
Therefore,
1
x1 = 4 − (−0.38629)
1.39056 − (−0.38629)
≈ 4.2174
Note that f (x1 ) = f (4.2174) ≈ −0.0044 < 0. Therefore, a root lies between 4.2174 and 5
Taking a = 4.2174 and b = 5 in the RHS of Equation (4.1.2) we get
5 − 4.2174
x2 := 4.2174 − f (4.2174)
f (5) − f (4.2174)
Therefore,
0.7826
x2 = 4.2174 − (−0.0044)
1.39056 − (−0.0044)
≈ 4.2199
Note that f (x2 ) = f (4.2199) ≈ −0.00005 < 0. Therefore, a root lies between 4.2199 and
5
Taking a = 4.2199 and b = 5 in the RHS of Equation (4.1.2) we get
5 − 4.2199
x3 := 4.2199 − f (4.2199)
f (5) − f (4.2199)
Therefore,
0.7801
x3 = 4.2199 − (−0.00005)
1.39056 − (−0.00005)
≈ 4.22
Home Work
• Using regula falsi method, compute a real root of xex = 2 in [0, 1]. Carry out three
iterations.
• Find a root of cos x = 3x − 1 in [0, 1], using the method of false position. Carry out
three iterations.
52
There is a connection between the notion of a fixed point and that of a root. In fact,
x = a is a root of the equation f (x) = 0 if and only if it is a fixed point of g(x) := f (x)+x.
In the fixed point iteration method, we first rewrite the equation f (x) = 0 in the
form x = g(x) and then take x0 as an initial approximation to a root. We compute the
successive approximations of a root using xn+1 = g(xn ) (n = 0, 1, 2, · · · ).
Note. 1. The equation f (x) = 0 may be written in the form x = g(x) in several ways.
1
For example, x2 − x − 1 = 0 may be written as x = x2 − 1 or x = .
x−1
2. The fixed point iteration method does not always converge.
The following result gives a sufficient condition for the convergence of the fixed point
iteration method.
Theorem 4.1.10. Let x = a be a fixed point of g(x), g 0 (x) is continuous in some interval
I containing a and let | g 0 (x) |< 1 in I then lim xn = a where xn = g(xn−1 ) (n = 1, 2, · · · )
n→∞
and x0 is any point in I.
To find a root of the equation f (x) = 0 using fixed point iteration method, we proceed
as follows.
• Rewrite f (x) = 0 in the form x = g(x) in such a way that g 0 (x) is continuous in
some interval I and | g 0 (x) |< 1 in I.
Example 4.1.11. Use the fixed point iteration method to find a root of x4 − 16x + 16 = 0
near x = 1. Carry out five iterations.
x4 + 16
Solution. Let f (x) = x4 − 16x + 16. We rewrite x4 − 16x + 16 = 0 as x = . Here
16
x4 + 16 x3 x3
g(x) = and | g 0 (x) |= . Clearly < 1 if and only if | x3 |< 4 if and
16 4 4
53
√ √ √
only
√ | x |< 3 4. Therefore, | g 0 (x) |< 1 in the interval (− 3 4, 3 4). Clearly the interval
if √
(− 3 4, 3 4) contains 1. Now we take x0 = 1 as an initial approximation to a root and use
x4n + 16
xn+1 = (n = 0, 1, 2, · · · ) (4.1.3)
16
to compute successive approximations to a root.
Putting n = 0 in Equation (4.1.3), we get
x40 + 16
x1 =
16
1 + 16
=
16
= 1.0625
Putting n = 1 in Equation (4.1.3), we get
x41 + 16
x2 =
16
(1.0625)4 + 16
=
16
≈ 1.079652
Putting n = 2 in Equation (4.1.3), we get
x42 + 16
x3 =
16
(1.079652)4 + 16
=
16
≈ 1.0849
Putting n = 3 in Equation (4.1.3), we get
x43 + 16
x4 =
16
(1.0849)4 + 16
=
16
≈ 1.08658
Putting n = 4 in Equation (4.1.3), we get
x44 + 16
x5 =
16
(1.08658)4 + 16
=
16
≈ 1.087
54
Example 4.1.12. Use the fixed point iteration method to find a root of 5x = ex near
x = 0.2. Carry out five iterations.
ex ex
Solution. Let f (x) = 5x − ex . We rewrite 5x − ex = 0 as x = . Here g(x) = and
5 5
ex ex
| g 0 (x) |= . Clearly < 1 if and only if | ex |< 5 if and only if ex < 5 if and
5 5
only if x < log 5. Therefore, | g 0 (x) |< 1 in the interval (−∞, log 5). Clearly the interval
(−∞, log 5) contains 0.2. Now we take x0 = 0.2 as an initial approximation to a root and
use
exn
xn+1 = (n = 0, 1, 2, · · · ) (4.1.4)
5
to compute successive approximations to a root.
Putting n = 0 in Equation (4.1.4), we get
ex0
x1 =
5
e0.2
=
5
≈ 0.24428
ex1
x2 =
5
e0.24428
=
5
≈ 0.25534
ex2
x3 =
5
e0.25534
=
5
≈ 0.25818
ex3
x4 =
5
e0.25818
=
5
≈ 0.25891
55
Solution. Let f (x) = x3 − 5x + 3 and let x0 = 2. Note that f 0 (x) = 3x2 − 5. Newton-
Raphson’s formula is
f (xn )
xn+1 = xn − 0 (n = 0, 1, 2, · · · ) (4.1.5)
f (xn )
Putting n = 0 in Equation (4.6), we get
f (x0 )
x1 = x0 −
f 0 (x0 )
f (2)
=2− 0
f (2)
1
= 2 − (as f (2) = 1 and f 0 (2) = 7)
7
≈ 1.8571
56
f (x1 )
x2 = x1 −
f 0 (x1 )
f (1.8571)
= 1.8571 − 0
f (1.8571)
0.1193
= 1.8571 − (as f (1.8571) = 0.1193 and f 0 (1.8571) = 5.3465)
5.3465
≈ 1.8348
f (x2 )
x3 = x2 −
f 0 (x2 )
f (1.8348)
= 1.8348 − 0
f (1.8348)
0.0028
= 1.8348 − (as f (1.8348) = 0.0028 and f 0 (1.8348) = 5.0995)
5.0995
≈ 1.8343
Solution. Let f (x) = 2x − cos x − 3 and let x0 = π/2. Note that f 0 (x) = 2 + sin x.
Newton-Raphson’s formula is
f (xn )
xn+1 = xn − (n = 0, 1, 2, · · · ) (4.1.6)
f 0 (xn )
Putting n = 0 in Equation (4.7), we get
f (x0 )
x1 = x0 −
f 0 (x0 )
π f (π/2)
= − 0
2 f (π/2)
π π−3
= − (as f (π/2) = π − 3 and f 0 (π/2) = 3)
2 3
≈ 1.5236
Putting n = 1 in Equation (4.7), we get
f (x1 )
x2 = x1 −
f 0 (x1 )
f (1.5236)
= 1.5236 − 0
f (1.5236)
0.00002
= 1.5236 − (as f (1.5236) = 0.00002 and f 0 (1.5236) = 2.9989)
2.9989
≈ 1.5236
Since | x2 − x1 |< 10−3 , a root of the given equation near π/2 correct to three decimal
places is 1.5236
Example 4.1.15. Use Newton-Raphson method to find a root of tan x = 1.5x near 1,
correct to three decimal places.
Solution. Let f (x) = tan x − 1.5x and let x0 = 1. Note that f 0 (x) = sec2 x − 1.5 =
(1 + tan2 x) − 1.5 = tan2 x − 0.5. Newton-Raphson’s formula is
f (xn )
xn+1 = xn − (n = 0, 1, 2, · · · ) (4.1.7)
f 0 (xn )
Putting n = 0 in Equation (4.1.7), we get
f (x0 )
x1 = x0 −
f 0 (x0 )
f (1)
=1− 0
f (1)
0.0574
=1− (as f (1) = 0.0574 and f 0 (1) = 1.9255)
1.9255
≈ 0.9702
58
f (x1 )
x2 = x1 −
f 0 (x1 )
f (0.9702)
= 0.9702 − 0
f (0.9702)
0.0045
= 0.9702 − (as f (0.9702) = 0.0045 and f 0 (0.9702) = 1.6311)
1.6311
≈ 0.9674
f (x2 )
x3 = x2 −
f 0 (x2 )
f (0.9674)
= 0.9674 − 0
f (0.9674)
0.000004
= 0.9674 − (as f (0.9674) = −0.000004 and f 0 (0.9674) = 1.6057)
1.6057
≈ 0.9674
Since | x3 −x2 |< 10−3 , a root of the given equation near 1, correct to three decimal places
is 0.9674
Convergence analysis
Let xn be an approximate value of a root α of f (x) = 0, got in the nth iteration of Newton-
Raphson’s method. Let xn differs from α by a small quantity n so that xn = α + n .
According to Newton-Raphson’s formula
f (xn )
xn+1 = xn −
f 0 (xn )
Therefore,
f (α + n )
α + n+1 = α + n −
f 0 (α + n )
59
This implies,
f (α + n )
n+1 = n −
f 0 (α + n )
f (α) + n f 0 (α) + 12 2n f 00 (α) + · · ·
= n − 0
f (α) + n f 00 (α) + 12 2n f 000 (α) + · · ·
(by Taylor’s series expansion)
n f 0 (α) + 21 2n f 00 (α) + · · ·
= n −
f 0 (α) + n f 00 (α) + 12 2n f 000 (α) + · · ·
(as f (α) = 0)
n [f 0 (α) + n f 00 (α) + 12 2n f 000 (α) + · · · ] − [n f 0 (α) + 21 2n f 00 (α) + · · · ]
=
f 0 (α) + n f 00 (α) + 21 2n f 000 (α)
n f 0 (α) + 2n f 00 (α) + 12 3n f 000 (α) − n f 0 (α) − 12 2n f 00 (α) − · · ·
=
f 0 (α) + n f 00 (α) + 12 2n f 000 (α) + · · ·
n f 0 (α) + 2n f 00 (α) − n f 0 (α) − 12 2n f 00 (α)
≈
f 0 (α) + n f 00 (α) + 12 2n f 000 (α)
(neglecting third and higher powers of n )
1 2 00
f (α)
2 n
=
f 0 (α) + n f 00 (α) + 12 2n f 000 (α)
2 f 00 (α)
≈ n 0
2f (α)
2 f 00 (α)
= n 0
2 f (α)
This shows that the subsequent error at each step is proportional to the square of the
previous error and hence the convergence is quadratic.
Note. Newton-Raphson’s method may some time diverge(see Figures 4.6 and 4.7)
60
Figure 4.7: The successive approximations in N-R method go away from the root
61
3 −2 −1
Solution. The coefficient matrix of the given system of equations is A = 2 1 2 .
1 1 1
Let D =| A |. Note that
1 2 2 2 2 1
D =3· − (−2) · −1·
1 1 1 1 1 1
= 3(1 − 2) + 2(2 − 2) − (2 − 1)
= −4
6= 0
Therefore, by Cramer’s rule, the given system of linear equations has a unique solution
and is given by
D1 D2 D3
x= y= z=
D D D
where
3 −2 −1
D1 = 5 1 2
2 1 1
1 2 5 2 5 1
=3· − (−2) · −1·
1 1 2 1 2 1
= 3(1 − 2) + 2(5 − 4) − 1(5 − 2)
= −4
3 3 −1
D2 = 2 5 2
1 2 1
5 2 2 2 2 5
=3· −3· −1·
2 1 1 1 1 2
= 3(5 − 4) − 3(2 − 2) − 1(4 − 5)
=4
and
3 −2 3
D3 = 2 1 5
1 1 2
1 5 2 5 2 1
=3· − (−2) · +3·
1 2 1 2 1 1
= 3(2 − 5) + 2(4 − 5) + 3(2 − 1)
= −8
63
−4 4 −8
Thus, x = = 1, y = = −1 and z = =2
−4 −4 −4
Example 4.2.2. Solve the following system of linear equations by Cramer’s rule.
x + 3y − 2z = 1
2x − 4y + 3z = 3
x + y + 2z = 9
1 3 −2
Solution. The coefficient matrix of the given system of equations is A = 2 −4 3 .
1 1 2
Let D =| A |. Clearly D = −26 6= 0. Therefore, by Cramer’s rule, the given system of
linear equations has a unique solution and is given by
D1 D2 D3
x= y= z=
D D D
where
1 3 −2 1 1 −2 1 3 1
D1 = 3 −4 3 D2 = 2 3 3 D3 = 2 −4 3
9 1 2 1 9 2 1 1 9
0 2
Note. 1. Not all square matrices have an LU -factorization. For example A =
3 1
doesn’t have an LU -factorization. But it can be shown that, if a square matrix is
nonsingular then the matrix got by reordering the rows of the given matrix, has an
LU -factorization.
Note
that, by interchanging
therows of the matrix A we get the
3 1 1 0 3 1
matrix B = and B = .
0 2 0 1 0 2
2. Our aim is to solve the given system of linear equations. The solution of the given
system doesn’t change by reordering the equations of the system.
Consider the following system of equations.
a11 x1 + a12 x2 + · · · + a1n xn = b1
a21 x1 + a22 x2 + · · · + a2n xn = b2
(4.2.3)
··························· = ···
an1 x1 + an2 x2 + · · · + ann xn = bn
The system
(4.2.3) can be written
in a more convenient form as AX = B where
a11 a12 · · · a1n
a21 a22 · · · a2n
A= · · · · · · · · · · · · (called the coefficient matrix of the system (4.2.3)),
a a · · · ann
n1 n2
x1 b1
x2 b2
X = .. and B = .. . In LU -factorization method we write A = LU . Then
. .
xn bn
AX = B gives LU X = B which implies L(U X) = B. This may be written as
LY = B (4.2.4)
where
UX = Y (4.2.5)
On solving Equation (4.2.4), we get Y . Using this Y , we solve the Equation (4.2.5) which
gives the solution of the given system also.
In LU -factorization method, if we take all the principal diagonal entries of the lower
triangular matrix L as 1 then the method is called Doolittle’s method and if we take all
the principal diagonal entries of the upper triangular matrix U as 1 then the method is
called Crout’s method.
Example 4.2.4. Solve the following system of equations by Doolittle’s method.
2x + 5y − 3z = 5
2x + 6y − 4z = 6
4x + 11y − 6z = 10
65
2 5 −3
Solution. The coefficient matrix of the given system is A = 2 6 −4 .
4 11 −6
Let
1 0 0 u11 u12 u13
A = l21 1 0 0 u22 u23
l31 l32 1 0 0 u33
Then
2 5 −3 u11 u12 u13
2 6 −4 = l21 u11 l21 u12 + u22 l21 u13 + u23
4 11 −6 l31 u11 l31 u12 + l32 u22 l31 u13 + l32 u23 + u33
Therefore,
u11 = 2 (4.2.6)
u12 = 5 (4.2.7)
u13 = −3 (4.2.8)
l21 u11 = 2 (4.2.9)
l21 u12 + u22 = 6 (4.2.10)
l21 u13 + u23 = −4 (4.2.11)
l31 u11 = 4 (4.2.12)
l31 u12 + l32 u22 = 11 (4.2.13)
l31 u13 + l32 u23 + u33 = −6 (4.2.14)
From the Equations (4.2.6) and (4.2.9)
2 2
l21 = = =1 (4.2.15)
u11 2
From the Equations (4.2.7), (4.2.10) and (4.2.15)
Thus,
1 0 0 2 5 −3
A = 1 1 0 0 1 −1
2 1 1 0 0 1
The given system of equations can be written as
AX = B
x 5
where X = y and B = 6 . Therefore,
z 10
1 0 0 2 5 −3 x 5
1 1 0 0 1 −1 y = 6
2 1 1 0 0 1 z 10
i.e.,
1 0 0 2 5 −3 x 5
1 1 0 0 1 −1 y = 6
2 1 1 0 0 1 z 10
Writing
2 5 −3 x y1
0 1 −1 y = y2 (4.2.21)
0 0 1 z y3
we have,
1 0 0 y1 5
1 1 0 y2 = 6
2 1 1 y3 10
The corresponding system of equations is
y1 = 5 (4.2.22)
y1 + y2 = 6 (4.2.23)
2y1 + y2 + y3 = 10 (4.2.24)
From the Equations (4.2.22) and (4.2.23),
y2 = 6 − y1 = 6 − 5 = 1 (4.2.25)
67
Now, from the Equations (4.2.21), (4.2.22), (4.2.25) and (4.2.26), we have
2 5 −3 x 5
0 1 −1 y = 1
0 0 1 z −1
2x + 5y − 3z = 5 (4.2.27)
y−z =1 (4.2.28)
z = −1 (4.2.29)
From the Equations (4.2.29) and (4.2.28),
y = 1 + z = 1 + (−1) = 0 (4.2.30)
5 − 5y + 3z 5 − 5(0) + 3(−1) 2
x= = = =1
2 2 2
Thus, the solution of the given system of equations is x = 1, y = 0 and z = −1
3x − 6y + 3z = 9
x + 3y + z = −2
x − 3y + 3z = 4
3 −6 3
Solution. The coefficient matrix of the given system is A = 1 3 1 .
1 −3 3
Let
l11 0 0 1 u12 u13
A= l21 l22 0 0 1 u23
l31 l32 l33 0 0 1
Then
3 −6 3 l11 l11 u12 l11 u13
1 3 1 = l21 l21 u12 + l22 l21 u13 + l22 u23
1 −3 3 l31 l31 u12 + l32 l31 u13 + l32 u23 + l33
68
Therefore,
l11 = 3 (4.2.31)
l21 = 1 (4.2.32)
l31 = 1 (4.2.33)
l11 u12 = −6 (4.2.34)
l21 u12 + l22 = 3 (4.2.35)
l31 u12 + l32 = −3 (4.2.36)
l11 u13 = 3 (4.2.37)
l21 u13 + l22 u23 = 1 (4.2.38)
l31 u13 + l32 u23 + l33 = 3 (4.2.39)
From the Equations (4.2.31) and (4.2.34)
−6 −6
u12 = = = −2 (4.2.40)
l11 3
From the Equations (4.2.32), (4.2.35) and (4.2.40)
Thus,
3 0 0 1 −2 1
A = 1 5 0 0 1 0
1 −1 2 0 0 1
69
AX = B
x 9
where X = y and B = −2 . Therefore,
z 4
3 0 0 1 −2 1 x 9
1 5 0 0 1 0 y = −2
1 −1 2 0 0 1 z 4
i.e.,
3 0 0 1 −2 1 x 9
1 5 0 0 1 0 y = −2
1 −1 2 0 0 1 z 4
Writing
1 −2 1 x y1
0 1 0 y = y2 (4.2.46)
0 0 1 z y3
we have,
3 0 0 y1 9
1 5 0 y2 = −2
1 −1 2 y3 4
The corresponding system of equations is
3y1 = 9
i.e.,
y1 = 3 (4.2.47)
y1 + 5y2 = −2 (4.2.48)
y1 − y2 + 2y3 = 4 (4.2.49)
From the Equations (4.2.47) and (4.2.48),
−2 − y1 −2 − 3 −5
y2 = = = = −1 (4.2.50)
5 5 5
From the Equations (4.2.47), (4.2.48) and (4.2.49),
4 − y1 + y2 4−3−1 0
y3 = = = =0 (4.2.51)
2 2 2
70
Now, from the Equations (4.2.46), (4.2.47), (4.2.50) and (4.2.51), we have
1 −2 1 x 3
0 1 0 y = −1
0 0 1 z 0
x − 2y + z = 3 (4.2.52)
y = −1 (4.2.53)
z=0 (4.2.54)
From the Equations (4.2.54), (4.2.53) and (4.2.52),
x = 3 + 2y − z = 3 + 2(−1) − 0 = 1
Exercise
Taking x(0) = 0, y (0) = 0 and z (0) = 0 as an initial approximation, we find the successive
approximations to the required solution by using
12 − y (n) − z (n)
x(n+1) =
10
15 − x(n) + z (n)
y (n+1) = (n = 0, 1, 2, · · · ) (4.2.55)
15
20 − x(n) + y (n)
z (n+1) =
20
Putting n = 0 in the System (4.2.55), we get
12 − y (0) − z (0)
x(1) =
10
12 − 0 − 0
= (because y (0) = z (0) = 0)
10
12
=
10
= 1.2
15 − x(0) + z (0)
y (1) =
15
15 − 0 + 0
= (because x(0) = z (0) = 0)
15
15
=
15
=1
20 − x(0) + y (0)
z (1) =
20
20 − 0 + 0
= (because x(0) = y (0) = 0)
20
20
=
20
=1
Putting n = 1 in the System (4.2.55), we get
12 − y (1) − z (1)
x(2) =
10
12 − 1 − 1
= (because y (1) = z (1) = 1)
10
10
=
10
=1
73
15 − x(1) + z (1)
y (2) =
15
15 − 1.2 + 1
= (because x(1) = 1.2 and z (1) = 1)
15
14.8
=
15
= 0.9867
20 − x(1) + y (1)
z (2) =
20
20 − 1.2 + 1
= (because x(1) = 1.2 and y (1) = 1)
20
19.8
=
20
= 0.99
Putting n = 2 in the System (4.2.55), we get
12 − y (2) − z (2)
x(3) =
10
12 − 0.9867 − 0.99
= (because y (2) = 0.9867 and z (2) = 0.99)
10
10.0233
=
10
= 1.00233
15 − x(2) + z (2)
y (3) =
15
15 − 1 + 0.99
= (because x(2) = 1 and z (2) = 0.99)
15
14.99
=
15
= 0.9993
20 − x(2) + y (2)
z (3) =
20
20 − 1 + 0.9867
= (because x(2) = 1 and y (2) = 0.9867)
20
19.9867
=
20
= 0.999335
Excercise
Take x(0) = y (0) = z (0) = 0 as an initial approximation and carry out three iterations.
75
17 − y (0) + 2z (0)
x(1) =
20
17 − 0 − 0
= (because y (0) = z (0) = 0)
20
= 0.85
17 − y (1) + 2z (1)
x(2) =
20
17 − 1.0275 + 2(1.0109)
= (because y (1) = −1.0275 and z (1) = 1.0109)
20
= 1.0025
76
25 − 2x(2) + 3y (2)
z (2) =
20
25 − 2(1.0025) + 3(−0.9998)
= (because x(2) = 1.0025 and y (2) = −0.9998)
20
= 0.9998
Putting n = 2 in the System (4.2.56), we get
17 − y (2) + 2z (2)
x(3) =
20
17 − (−0.9998) + 2(0.9998)
= (because y (2) = −0.9998 and z (2) = 0.9998)
20
=1
25 − 2x(3) + 3y (3)
z (3) =
20
25 − 2(1) + 3(−1)
= (because x(3) = 1 and y (3) = −1)
20
=1
Excercise
Expanding each of the functions in the System (4.3.2) by Taylor’s series(up to first degree
terms), we get
f (x0 , y0 ) + hfx (x0 , y0 ) + kfy (x0 , y0 ) = 0 (4.3.3)
g(x0 , y0 ) + hgx (x0 , y0 ) + kgy (x0 , y0 ) = 0 (4.3.4)
Solving the Equations (4.3.3) and (4.3.4) for h and k we get a new approximation to the
required solution of the given system as x1 = x0 + h and y1 = y0 + k. This process is
repeated till we get the solution to the desired degree of accuracy.
Note. The Equations (4.3.3)and (4.3.4) are called Newton-Raphson’s equations.
Example 4.3.1. Solve the following system of non-linear equations: x2 +y = 3; y 2 +x = 5.
Taking x0 = y0 = 1 as an initial approximation, find x1 and y1 .
Solution. Let f (x, y) = x2 + y − 3 and let g(x, y) = x + y 2 − 5. Clearly fx = 2x,fy = 1,
gx = 1 and gy = 2y. We know that
This implies
0 = f (1, 1) + hfx (1, 1) + kfy (1, 1) (as x0 = y0 = 1)
= [12 + 1 − 3] + h[2(1)] + k(1) (as f (x, y) = x2 + y − 3 fx (x, y) = 2x and fy (x, y) = 1)
Thus
2h + k = 1 (4.3.5)
78
Thus
h + 2k = 3 (4.3.6)
Solving the Equations (4.3.5) and (4.3.6) we get, h = − 31 ≈ −0.3333 and k = 53 ≈ 1.6667.
Therefore, x1 = x0 + h = 1 + (−0.3333) = 0.6667 and y1 = y0 + k = 1 + 1.6667 = 2.6667
Excercise
Many practical problems often lead to differential equations which can not solved by the
methods that we have learnt so far. In such cases we use numerical methods to solve the
differential equation under consideration.
dy
= f (x, y) given y(x0 ) = y0
dx
We shall now study few of them.
dy
= f (x, y) (5.1.1)
dx
together with the initial condition
y(x0 ) = y0 (5.1.2)
In this method we assume that y(x) can be expanded in powers of x − x0 , giving
(x − x0 )2 00 (x − x0 )3 000 (x − x0 )n (n)
y(x) = y(x0 )+y 0 (x0 )(x−x0 )+ y (x0 )+ y (x0 ) · · ·+ y (x0 )+· · ·
2! 3! n!
Taking h = x − x0 we get
h2 00 h3 hn
y(x0 + h) = y(x0 ) + hy 0 (x0 ) + y (x0 ) + y 000 (x0 ) · · · + y (n) (x0 ) + · · · (5.1.3)
2! 3! n!
79
80
y(x0 ) is known from the Equation (5.1.2) and y 0 (x0 ) is found from the Equation (5.1.1).
y 00 (x0 ), y 000 (x0 ) · · · are obtained by successively differentiating the Equation (5.1.1) and
evaluating at x = x0 . On substituting the values of h, y 0 (x0 ), y 00 (x0 ), · · · in the Equa-
tion (5.1.3), we get the required value of y.
Example 5.1.1. Employ Taylor’s series method to obtain approximate value of y at
dy
x = 0.1 for the differential equation − 2y = 3ex , y(0) = 0
dx
Solution. Given
dy
= 2y + 3ex (5.1.4)
dx
and
y(0) = 0 (5.1.5)
We know that
h2 00 h3 h4
y(x0 + h) = y(x0 ) + hy 0 (x0 ) +
y (x0 ) + y 000 (x0 ) + y (iv) (x0 ) + · · ·
2! 3! 4!
Here x0 = 0 and h = x − x0 = 0.1 − 0 = 0.1. Therefore, we have
(0.1)2 00 (0.1)3 000 (0.1)4 (iv)
y(0.1) = y(0) + (0.1)y 0 (0) + y (0) + y (0) + y (0) + · · · (5.1.6)
2! 3! 4!
From the Equation (5.1.4), we have
y 0 (0) = 2y(0) + 3e0
= 2(0) + 3(1) (as y(0) = 0 and e0 = 1) (5.1.7)
=3
Differentiating the Equation (5.1.4) w.r.t. x, we get
y 00 (x) = 2y 0 (x) + 3ex (5.1.8)
This implies
y 00 (0) = 2y 0 (0) + 3e0
= 2(3) + 3(1) (by the Equation (5.1.7)) (5.1.9)
=9
Differentiating the Equation (5.1.8) w.r.t. x, we get
y 000 (x) = 2y 00 (x) + 3ex (5.1.10)
This implies
y 000 (0) = 2y 00 (0) + 3e0
= 2(9) + 3(1) (by the Equation (5.1.9)) (5.1.11)
= 21
81
This implies
From the Equations (5.1.5), (5.1.6), (5.1.7), (5.1.9), (5.1.11) and (5.1.13) we get
Example 5.1.2. Using Taylor’s series method, find an approximate value of y(0.2) given
dy
that = 1 − 2xy, y(0) = 0 and h = 0.1.
dx
Solution. Given
dy
= 1 − 2xy (5.1.14)
dx
and
y(0) = 0 (5.1.15)
We know that
h2 00 h3 h4
y(x0 + h) = y(x0 ) + hy 0 (x0 ) + y (x0 ) + y 000 (x0 ) + y (iv) (x0 ) + · · · (5.1.16)
2! 3! 4!
Here x0 = 0 and h = 0.1. Therefore, we have
y 0 (0) = 1 − 2(0)y(0)
(5.1.18)
=1
This implies
y 00 (0) = −2[(0)y 0 (0) + y(0)]
= −2[0(1) + 0] (by the Equations (5.1.15) and (5.1.18)) (5.1.20)
=0
Differentiating the Equation (5.1.19) w.r.t. x, we get
y 000 (x) = −2[xy 00 (x) + 2y 0 (x)] (5.1.21)
This implies
y 000 (0) = −2[(0)y 00 (0) + 2y 0 (0)]
= −2[(0)(0) + 2(1)] (by the Equations (5.1.18) and (5.1.20)) (5.1.22)
= −4
Differentiating the Equation (5.1.21) w.r.t. x, we get
y (iv) (x) = −2[xy 000 (x) + 3y 00 (x)] (5.1.23)
This implies
y (iv) (0) = −2[(0)y 000 (0) + 3y 00 (0)]
= −2[(0)(−4) + 3(0)] (by the Equations (5.1.20) and (5.1.22)) (5.1.24)
=0
From the Equations (5.1.15), (5.1.17), (5.1.18), (5.1.20), (5.1.22) and (5.1.24) we get
(0.1)2 (0.1)3 (0.1)4
y(0.1) = 0 + (0.1)1 + (0) + (−4) + (0) + · · ·
2! 3! 4!
(5.1.25)
≈ 0.1 − 0.0007
= 0.0993
To find y(0.2), we replace x0 by x1 := x0 + h in the Equation (5.1.16).
h2 00 h3 h4
y(x1 + h) = y(x1 ) + hy 0 (x1 ) + y (x1 ) + y 000 (x1 ) + y (iv) (x1 ) + · · ·
2! 3! 4!
Here h = 0.1 and x1 = x0 + h = 0 + 0.1 = 0.1. Therefore, we have
(0.1)2 00 (0.1)3 000 (0.1)4 (iv)
y(0.2) = y(0.1) + (0.1)y 0 (0.1) + y (0.1) + y (0.1) + y (0.1) + · · ·
2! 3! 4!
(5.1.26)
From the Equation (5.1.14), we have
y 0 (0.1) = 1 − 2(0.1)y(0.1)
= 1 − 2(0.1)(0.0993) (from the Equation (5.1.25)) (5.1.27)
= 0.9801
83
From the Equations (5.1.26), (5.1.27), (5.1.28), (5.1.29) and (5.1.30) we get
Exercise
1. Using Taylor’s series method, find an approximate value of y(0.1) given that
y 0 = x − y 2 , y(0) = 1 and h = 0.1.
2. Using Taylor’s series method, find an approximate value of y(0.2) given that
dy
= x2 + y 2 , y(0) = 1 and h = 0.1.
dx
y − y0 = m(x − x0 ) (5.1.33)
where m is the slope of the tangent at x = x0 . If y1 = y(x1 ) then from the Equa-
tion (5.1.33), we get
y1 = m(x1 − x0 ) + y0
= mh + y0 (as x1 − x0 = h)
Note that from the Equations (5.1.31) and (5.1.32), m = f (x0 , y0 ). Therefore, y1 =
y0 + hf (x0 , y0 ). Similarly, we can show that y2 = y1 + hf (x1 , y1 ), y3 = y2 + hf (x2 , y2 ) and,
in general,
yn+1 = yn + hf (xn , yn ) (5.1.34)
where yn+1 = y(xn+1 ) and xn+1 = xn + h (n ≥ 0). When the step size h is quite large
then by using the Equation (5.1.34) we get a very crude value of y. To minimize the error
we use
h ∗
yn+1 = yn + [f (xn , yn ) + f (xn+1 , yn+1 )] (5.1.35)
2
85
where
∗
yn+1 = yn + hf (xn , yn ) (5.1.36)
Example 5.1.3. Using Modified Euler’s method find an approximate value of y(0.1)
given that y 0 = −xy 2 , h = 0.1 and y(0) = 2.
Solution. We know that
h ∗
yn+1 = yn + [f (xn , yn ) + f (xn+1 , yn+1 )] (n ≥ 0) (5.1.37)
2
where
∗
yn+1 = yn + hf (xn , yn ) (n ≥ 0) (5.1.38)
Here f (x, y) = −xy 2 , h = 0.1, x0 = 0 and y0 = 2. Now, putting n = 0 in the Equa-
tion (5.1.38) we get
y1∗ = y0 + hf (x0 , y0 )
= y0 + h[−x0 (y0 )2 ]
(5.1.39)
= 2 + (0.1)[−0(22 )]
=2
(1) h
y1 = y0 + [f (x0 , y0 ) + f (x1 , y1∗ )]
2
h
= y0 + [−x0 (y0 )2 − x1 (y1∗ )2 ]
2
0.1 (5.1.40)
=2+ [−0(22 ) − (0.1)(22 )]
2
= 2 − 0.02
= 1.98
(2) h (1)
y1 = y0 + [f (x0 , y0 ) + f (x1 , y1 )]
2
h (1)
= y0 + [−x0 (y0 )2 − x1 (y1 )2 ]
2
0.1 (5.1.41)
=2+ [−0(22 ) − (0.1)((1.98)2 )]
2
= 2 − 0.019602
= 1.980398
Therefore, the value of y at x = 0.1 correct to three decimal places is 1.98
Example 5.1.4. Using Modified Euler’s method find an approximate value of y(0.1)
given that y 0 = x2 + y, h = 0.05 and y(0) = 1. Carry out two iterations at each step.
86
h ∗
yn+1 = yn + [f (xn , yn ) + f (xn+1 , yn+1 )] (n ≥ 0) (5.1.42)
2
where
∗
yn+1 = yn + hf (xn , yn ) (n ≥ 0) (5.1.43)
y1∗ = y0 + hf (x0 , y0 )
= y0 + h[(x0 )2 + y0 ]
(5.1.44)
= 1 + (0.05)[02 + 1]
= 1.05
(1) h
y1 = y0 + [f (x0 , y0 ) + f (x1 , y1∗ )]
2
h
= y0 + [((x0 )2 + y0 ) + ((x1 )2 + y1∗ )]
2
0.05 2 (5.1.45)
=1+ [(0 + 1) + ((0.05)2 + 1.05)]
2
= 1 + 0.051313
= 1.051313
(2) h (1)
y1 = y0 + [f (x0 , y0 ) + f (x1 , y1 )]
2
h (1)
= y0 + [((x0 )2 + y0 ) + ((x1 )2 + y1 )]
2
0.05 2 (5.1.46)
=1+ [(0 + 1) + ((0.05)2 + 1.051313)]
2
= 1 + 0.051345
= 1.051345
y2∗ = y1 + hf (x1 , y1 )
= y1 + h[(x1 )2 + y1 ]
(5.1.47)
= 1.0513 + (0.05)[(0.05)2 + 1.0513]
= 1.10399
87
(1) h
y2 = y1 + [f (x1 , y1 ) + f (x2 , y2∗ )]
2
h
= y1 + [((x1 )2 + y1 ) + ((x2 )2 + y2∗ )]
2
0.05 (5.1.48)
= 1.0513 + [((0.05)2 + 1.0513) + ((0.1)2 + 1.10399)]
2
= 1.0513 + 0.05419475
= 1.10549475
(2) h (1)
y2 = y1 + [f (x1 , y1 ) + f (x2 , y2 )]
2
h (1)
= y1 + [((x1 )2 + y1 ) + ((x2 )2 + y2 )]
2
0.05 (5.1.49)
= 1.0513 + [((0.05)2 + 1.0513) + ((0.1)2 + 1.10549475)]
2
= 1.0513 + 0.05423
= 1.10553
Therefore, the value of y at x = 0.1 correct to four decimal places is 1.1055
Exercise
1. Using Modified Euler’s method find an approximate value of y(0.1) given that y 0 =
x + y, h = 0.1 and y(0) = 1.
2. Using Modified Euler’s method find an approximate value of y(1.5) given that y 0 −
√
xy = 2, h = 0.25 and y(1) = 1. Carry out two iterations at each step.
yi+1 = yi + k
88
where
1
k = (k1 + 2k2 + 2k3 + k4 )
6
k1 = hf (xi , yi )
h k1
k2 = hf x i + , yi +
2 2
h k2
k3 = hf x i + , yi +
2 2
and
k4 = hf (xi + h, yi + k3 )
Example 5.1.5. Apply Runge - Kutta method of order four, to find an approximate
value of y(0.1) given that y 0 = x + y 2 , h = 0.1 and y(0) = 1.
1
k = (k1 + 2k2 + 2k3 + k4 )
6
and
yi+1 = yi + k
Putting i = 0 we get
k1 = hf (x0 , y0 )
= h(x0 + y02 )
= (0.1)(0 + 1)
= 0.1
89
h k1
k2 = hf x0 + , y0 +
2 2
2 !
h k1
= h x0 + + y0 +
2 2
2 !
0.1 0.1
= (0.1) 0 + + 1+
2 2
= (0.1) (0.05 + 1.1025)
≈ 0.1153
h k2
k3 = hf x0 + , y0 +
2 2
2 !
h k2
= h x0 + + y0 +
2 2
2 !
0.1 0.1153
= (0.1) 0 + + 1+
2 2
≈ (0.1) (0.05 + 1.1186)
≈ 0.1169
k4 = hf (x0 + h, y0 + k3 )
= (0.1) [x0 + h] + [y0 + k3 ]2
k1 = hf (x0 , y0 )
= h(x0 + y0 )
= (0.2)(0 + 1)
= 0.2
h k1
k2 = hf x0 + , y0 +
2 2
h k1
= h x0 + + y0 +
2 2
0.2 0.2
= (0.2) 0 + + 1+
2 2
= (0.2) (0.1 + 1.1)
= 0.24
h k2
k3 = hf x0 + , y0 +
2 2
h k2
= h x0 + + y0 +
2 2
0.2 0.24
= (0.2) 0 + + 1+
2 2
= (0.2) (0.1 + 1.12)
= 0.244
91
k4 = hf (x0 + h, y0 + k3 )
= h ([x0 + h] + [y0 + k3 ])
= (0.2) ([0 + 0.2] + [1 + 0.244])
= (0.2) (0.2 + 1.244)
= 0.2888
1
k = (k1 + 2k2 + 2k3 + k4 )
6
1
= (0.2 + 2(0.24) + 2(0.244) + 0.2888)
6
= 0.2428
and
y1 = y0 + k
= 1 + 0.2428
= 1.2428
y0 = y(x0 ), y1 = y(x1 ) = y(x0 + h), and here x0 = 0 and h = 0.2. Thus, y1 = y(0 + 0.2) = y(0.2)
What is asked?...y(0.4) =?
To find y(0.4), put i = 1.
k1 = hf (x1 , y1 )
= h(x1 + y1 )
= (0.2)(0.2 + 1.2428)
≈ 0.2886
h k1
k2 = hf x1 + , y1 +
2 2
h k1
= h x1 + + y1 +
2 2
0.2 0.2886
= (0.2) 0.2 + + 1.2428 +
2 2
= (0.2) (0.3 + 1.3871)
≈ 0.3374
92
h k2
k3 = hf x1 + , y1 +
2 2
h k2
= h x1 + + y1 +
2 2
0.2 0.3374
= (0.2) 0.2 + + 1.2428 +
2 2
= (0.2) (0.3 + 1.4115)
= 0.3423
k4 = hf (x1 + h, y1 + k3 )
= h ([x1 + h] + [y1 + k3 ])
= (0.2) ([0.2 + 0.2] + [1.2428 + 0.3423])
= (0.2) (0.4 + 1.5851)
≈ 0.397
1
k = (k1 + 2k2 + 2k3 + k4 )
6
1
= (0.2886 + 2(0.3374) + 2(0.3423) + 0.397)
6
≈ 0.3408
and
y2 = y1 + k
= 1.2428 + 0.3408
= 1.5836
y2 = y(x2 ) = y(x1 + h), and here x1 = x0 + h, x0 = 0 and h = 0.2. Thus, x1 = 0.2
and y2 = y(0.2 + 0.2) = y(0.4)
Exercise
1. Apply Runge - Kutta method of order four, to find an approximate value of y(0.2)
given that y 0 = 3x + 12 y, h = 0.1 and y(0) = 1.
2. Apply Runge - Kutta method of order four, to find an approximate value of y(0.2)
given that 10y 0 = x2 + y 2 , h = 0.1 and y(0) = 1.
1. y1 = y(0.1) = 1.0666 and y2 = y(0.2) = 1.1673 2. y1 = y(0.1) = 1.0101 and y2 = y(0.2) = 1.0206
93
(p) 4h
y4 = y0 + (2f1 − f2 + 2f3 )
3
which is called a predictor. A better value of y4 is found using
(c) h
y4 = y2 + (f2 + 4f3 + f4 )
3
(p)
which is called a corrector where f4 = f (x4 , y4 ). Using this new value of y4 , f4 is
computed and applying corrector formula again we get an improved value of y4 . We
repeat this until the absolute difference between the successive values of y4 is negligible.
Example 5.1.7. Using Milne’s method find an approximate value of y(0.4) given that
y 0 = e−x − y and
f0 = f (x0 , y0 )
= e−x0 − y0
= e−0 − 0
=1
f1 = f (x1 , y1 )
= e−x1 − y1
= e−0.1 − 0.0905
≈ 0.8143
94
f2 = f (x2 , y2 )
= e−x2 − y2
= e−0.2 − 0.1637
≈ 0.6550
f3 = f (x3 , y3 )
= e−x3 − y3
= e−0.3 − 0.2222
≈ 0.5186
Now using the predictor formula we have
(p) 4h
y4 = y0 + (2f1 − f2 + 2f3 )
3
4(0.1)
=0+ (2(0.8143) − 0.6550 + 2(0.5186))
3
= 0.2681
(p)
f4 = f (x4 , y4 )
(p)
= e−x4 − y4
= e−0.4 − 0.2681
≈ 0.4022
Now using corrector formula we have
(c) h
y4 = y2 + (f2 + 4f3 + f4 )
3
0.1
= 0.1637 + (0.655 + 4(0.5186) + 0.4022)
3
≈ 0.268087
(c)
f4 = f (x4 , y4 )
(c)
= e−x4 − y4
= e−0.4 − 0.268087
≈ 0.40223
Now using corrector formula again we have
(c) h
y4 = y2 + (f2 + 4f3 + f4 )
3
0.1
= 0.1637 + (0.655 + 4(0.5186) + 0.40223)
3
≈ 0.268088
95
Exercise
• parabolic if B 2 − 4AC = 0
2. Given
∂2u 2
2 ∂ u
x2 + (1 − y ) =0 (5.2.4)
∂x2 ∂y 2
(x 6= 0, −1 < y < 1). On comparing the given equation with (5.2.2) we get A = x2 ,
B = 0 and C = 1 − y 2 . Therefore,
B 2 − 4AC = −4x2 (1 − y 2 )
= 4x2 (y 2 − 1)
Since x 6= 0, x2 > 0 and as −1 < y < 1, y 2 − 1 < 0. Thus, B 2 − 4AC < 0 and hence
the given PDE is elliptic.
3. Given
∂2u ∂2u 2
2 ∂ u
(1 + x2 ) + (5 + 2x 2
) + (4 + x ) =0 (5.2.5)
∂x2 ∂x ∂y ∂y 2
On comparing the given equation with (5.2.2) we get A = 1 + x2 , B = 5 + 2x2 and
C = 4 + x2 . Therefore,
Exercise
Let R be a rectangular region for which u(x, y) is known at the boundary. Divide this
region into a network of square meshes of side h as shown in the Figure 5.2. Note that
∂2u
the finite difference approximation for is given by
∂x2
∂2u u(x − h, y) − 2u(x, y) + u(x + h, y)
2
≈
∂x h2
Writing u(x, y) = u(ih, jh) as simply ui,j we get
1 1
u2 = [5 + 5 + u1 + u4 ] = [10 + u1 + u4 ] (5.2.10)
4 4
1 1
u3 = [1 + 1 + u1 + u4 ] = [2 + u1 + u4 ] (5.2.11)
4 4
1 1
u4 = [2 + 4 + u2 + u3 ] = [6 + u2 + u3 ] (5.2.12)
4 4
From equations (5.2.9) and (5.2.12),
u1 = u4 (5.2.13)
Example 5.2.3. Solve uxx + uyy = 0 for the square mesh with the boundary values as
shown in the Figure 5.5.
101
u2 = u3 (5.2.20)
Solution. Let u1 , u2 , u3 and u4 be the values of u at the interior mesh points (1, 1), (1, 2), (2, 1)
and (2, 2) respectively(see Figure 5.6). We know that
1
ui,j = [ui−1,j + ui+1,j + ui,j−1 + ui,j+1 − h2 fi,j ] (5.2.25)
4
Therefore,
1
u1 = [0 + u2 + 0 + u3 − (12 )(−120)]
4
(as h = 1, f (x, y) = −10(x2 + y 2 + 10) and f1,1 = f (1, 1) = −120)
i.e.,
1
u1 = [u2 + u3 + 120] (5.2.26)
4
1
u2 = [u1 + 0 + 0 + u4 − (12 )(−150)]
4
(as h = 1, f (x, y) = −10(x2 + y 2 + 10) and f2,1 = f (2, 1) = −150)
i.e.,
1
u2 = [u1 + u4 + 150] (5.2.27)
4
1
u3 = [0 + u4 + u1 + 0 − (12 )(−150)]
4
(as h = 1, f (x, y) = −10(x2 + y 2 + 10) and f1,2 = f (1, 2) = −150)
103
i.e.,
1
u3 = [u1 + u4 + 150] (5.2.28)
4
1
u4 = [u3 + 0 + u2 + 0 − (12 )(−180)]
4
(as h = 1, f (x, y) = −10(x2 + y 2 + 10) and f2,2 = f (2, 2) = −180)
i.e.,
1
u4 = [u2 + u3 + 180] (5.2.29)
4
From equations (5.2.27)and (5.2.28) we get
u2 = u3 (5.2.30)
Exercise
Solve the PDE ∇2 u = −81xy, 0 < x, y < 1, h = 1/3, u(0, y) = 0 = u(x, 0) and
u(1, y) = 100 = u(x, 1)
kc2 1
where α = 2
. This is known as Schmidt explicit formula and is valid only for 0 < α ≤ .
h 2
The schematic form of the equation (5.2.34) is as shown in the Figure 5.7.
104
Example 5.2.5. Use Schmidt explicit method to obtain numerical solution of ut = uxx ,
u(0, t) = u(1, t) = 0, u(x, 0) = sin πx with h = 1/3, k = 1/36 for two time levels.
kc2 9 1
Solution. Here c2 = 1, h = 1/3 and k = 1/36. Therefore, α = 2 = = . The
h 36 4
Schmidt explicit formula for the heat equation is given by
j \i 0 1 2 3
0 0 0.866 0.866 0
1 0 0.64952 0.64952 0
2 0 0.48714 0.48714 0
Table 5.1: Values of u in Example 5.2.5 at the boundary and interior mesh points
j \i 0 1 2 3 4 5
0 0 0.5878 0.9511 0.9511 0.5878 0
1 0 0.47555 0.76945 0.76945 0.47555 0
2 0 0.384725 0.6225 0.6225 0.384725 0
3 0 0.31125 0.5036125 0.5036125 0.31125 0
4 0 0.25180625 0.40743125 0.40743125 0.25180625 0
Table 5.2: Values of u in Example 5.2.6 at the boundary and interior mesh points
Example 5.2.6. Solve the boundary value problem ut = uxx under the conditions
u(0, t) = u(1, t) = 0, u(x, 0) = sin πx (0 ≤ x ≤ 1) with h = 0.2 and k = 0.02 for
four time levels.
kc2 0.02 1
Solution. Here c2 = 1, h = 0.2 and k = 0.02. Therefore, α = 2 = = . The
h 0.04 2
Schmidt explicit formula for the heat equation is given by
ui,j+1 = αui−1,j + (1 − 2α)ui,j + αui+1,j
1
Substituting α = , we have
2
1 1 1
ui,j+1 = ui−1,j + 1 − 2 ui,j + ui+1,j
2 2 2
107
Therefore,
1
ui,j+1 = [ui−1,j + ui+1,j ] (5.2.37)
2
Since u(x, 0) = sin πx we get
u(0.2, 0) = sin(0.2)π ≈ 0.5878
u(0.4, 0) = sin(0.4)π ≈ 0.9511
u(0.6, 0) = sin(0.6)π ≈ 0.9511
u(0.8, 0) = sin(0.8)π ≈ 0.5878
Thus, by the equation (5.2.37), we get
1
u1 = (0 + 0.9511) = 0.47555
2
1
u2 = (0.5878 + 0.9511) = 0.76945
2
1
u3 = (0.5878 + 0.9511) = 0.76945
2
1
u4 = (0 + 0.9511) = 0.47555
2
1 1
u5 = (0 + u2 ) = (0 + 0.76945) = 0.384725
2 2
1 1
u6 = (u1 + u3 ) = (0.47555 + 0.76945) = 0.6225
2 2
1 1
u7 = (u2 + u4 ) = (0.76945 + 0.47555) = 0.6225
2 2
1 1
u8 = (u3 + 0) = (0.76945 + 0) = 0.384725
2 2
1 1
u9 = (0 + u6 ) = (0 + 0.6225) = 0.31125
2 2
1 1
u10 = (u5 + u7 ) = (0.384725 + 0.6225) = 0.5036125
2 2
1 1
u11 = (u6 + u8 ) = (0.6225 + 0.384725) = 0.5036125
2 2
1 1
u12 = (u7 + 0) = (0.6225 + 0) = 0.31125
2 2
1 1
u13 = (0 + u10 ) = (0 + 0.5036125) = 0.25180625
2 2
1 1
u14 = (u9 + u11 ) = (0.31125 + 0.5036125) = 0.40743125
2 2
1 1
u15 = (u10 + u12 ) = (0.5036125 + 0.31125) = 0.40743125
2 2
1 1
u16 = (u11 + 0) = (0.5036125 + 0) = 0.25180625
2 2
109
This implies
ui−1,0 + ui+1,0
ui,1 = (5.2.41)
2
which gives the values of u at the first level. The schematic form of the equation (5.2.41)
is as shown in the Figure 5.11.
Example 5.2.7. Evaluate the pivotal values of the equation utt = 16uxx up to t = 1
given that u(0, t) = u(5, t) = 0, ut (x, 0) = 0, u(x, 0) = x2 (5 − x), k = 0.25 and h = 1.
Solution. The difference equation for solving the given wave equation is
k
Here c2 = 16 which implies c = 4. Given, k = 0.25 and h = 1 which implies α = =
h
1 1
0.25 = = . Thus, the equation (5.2.42) reduces to
4 c
ui,j+1 = ui−1,j + ui+1,j − ui,j−1
1
u3 = (12 + 16) = 14
2
1
u4 = (18 + 0) = 9
2
The values of u at the second level :
u5 = 0 + 11 − 4 = 7
u6 = 6 + 14 − 12 = 8
u7 = 11 + 9 − 18 = 2
u8 = 14 + 0 − 16 = −2
The values of u at the third level :
u9 = 0 + 8 − 6 = 2
u10 = 7 + 2 − 11 = −2
u11 = 8 + (−2) − 14 = −8
u12 = 2 + 0 − 9 = −7
112
j\i 0 1 2 3 4 5
0 0 4 12 18 16 0
1 0 6 11 14 9 0
2 0 7 8 2 -2 0
3 0 2 -2 -8 -7 0
4 0 -9 -14 -11 -6 0
Table 5.3: Values of u in Example 5.2.7 at the boundary and interior mesh points
u13 = 0 + (−2) − 7 = −9
u14 = 2 + (−8) − 8 = −14
u15 = −2 + (−7) − 2 = −11
u16 = −8 + 0 − (−2) = −6