Professional Documents
Culture Documents
Unit - IV
Unit - IV
Satish Shukla 1 of 33
Numerical Analysis
Finite Differences. In theoretical science most of the functions and relations are in explicit
and continuous form. Practical problems leads us to situations when the value of function
y = f (x) is known not in form of an explicit formula, but value of y are known only at
some points. In such cases we cannot calculate the value of y at any arbitrary given point.
Similarly, in such cases it is not possible to find derivatives or integral of the function,
and so, it is difficult to analyze the behaviour of function in its domain. To overcome this
problem, we need the techniques of finite differences and approximation.
Let y = f (x) be any function of the independent variable x. Suppose the explicit
values of y in form of x is not known, but only a finite number of values of y at points
x0 , x1 , x2 . . . , xn are known and given by the following table:
x x0 x1 x2 xn
y y0 y1 y2 yn
f (x) = f (x + h) f (x).
By definition of , it is clear that the forward difference operator finds the difference of
the values of function y = f (x) on two consecutive values x + h and x of argument. Also:
x y y 2 y 3 y 4 y
x0 y0
y0 = y1 y0
x1 y1 2 y0 = y1 y0
y1 = y2 y1 3 y0 = 2 y1 2 y0
x2 y2 2 y1 = y2 y1 4 y0 = 3 y1 3 y0
y2 = y3 y2 3 2 2
y1 = y2 y1
x3 y3 2
y2 = y3 y2
y3 = y4 y3
x4 y4
The higher order backward differences can be obtained similarly. The various higher order
differences can be obtained by following backward difference table:
x y y 2 y 3 y 4 y
x0 y0
y1 = y1 y0
x1 y1 2 y2 = y2 y1
y2 = y2 y1 3 y 3 = 2 y 3 2 y 2
x2 y2 2
y3 = y3 y2 4 y 4 = 3 y 4 3 y 3
y3 = y3 y2 3 y 4 = 2 y 4 2 y 3
x3 y3 2
y4 = y4 y3
y4 = y4 y3
x4 y4
Ef (x) = f (x + h).
E 2 f (x) = Ef (x + h) = f (x + 2h).
Similarly, we define
E n f (x) = f (x + nh).
The negative powers of E is defined in similar way;
Therefore
E1 or E 1+.
(b)By definition we have
Therefore
1 E 1 or E 1 1 .
(c) By (a) and (b) we have
E 1 E EE 1 (1 E 1 )E E.
(1 + )(1 ) EE 1 1.
(E 1)(1 E 1 ) E EE 1 1 + E 1 E 2 + E 1 .
1
D ln(1 + ) .
h
(g) Again, since E ehD and E 1 1 we have
1
ehD
1
= 1 ehD
= ln(1 ) hD
1
= D ln(1 ).
h
Dr. Satish Shukla 4 of 33
2 Eex
x
Example 2. Prove that: e = ex .
E 2 ex
Sol. We have
2 x Eex
R.H.S. = e 2 x
E e
(E 1)2 x Eex
= e
E (E 1)2 ex
2
Eex
E 2E + 1 x
= e 2
E (E 2E + 1)ex
Eex
E 2 + E 1 ex 2
=
(E 2E + 1)ex
ex+h
ex+h 2ex + exh x+2h
=
(e 2ex+h + ex )
ex ex+2h 2ex+h + ex
=
(ex+2h 2ex+h + ex )
x
= e
= L.H.S.
f (x)
Example 3. Prove that: ln f (x) = ln 1 + .
f (x)
Sol. We have
L.H.S. = ln f (x)
= (E 1) ln f (x)
= ln f (x + h) ln f (x)
f (x + h)
= ln
f (x)
Ef (x)
= ln
f (x)
(1 + )f (x)
= ln
f (x)
f (x)
= ln 1 +
f (x)
= R.H.S.
2
3 n 1
Example 5. Find the value of (i) x (ii) .
E x
2 (E 1)2 3
Sol. (i) 3
x = x
E E
E 2 + E 1 x3
=
= (x + h)3 2x3 + (x h)3
= (x3 + 3x2 h + 3xh2 + h3 ) 2x3 + (x3 3x2 h + 3xh2 h3 )
= 6xh2 .
(ii) 1 1 1 h
= = .
x x+h x x(x + h)
Similarly 2 1 1 h
= =
x x x(x + h)
1 1
= h
(x + h)(x + 2h) x(x + h)
(1)2 2! h2
= .
x(x + h)(x + 2h)
In general, we have
(1)n n! hn
1
n
= .
x x(x + h)(x + 2h) (x + nh)
Proof. Let
f (x) = a0 xn + a1 xn1 + a2 xn2 + + an1 x + an .
By definition we have
f (x) = f (x + h) f (x)
= a0 (x + h)n + a1 (x + h)n1 + a2 (x + h)n2 + + an1 (x + h) + an
a0 xn + a1 xn1 + a2 xn2 + + an1 x + an
Therefore
Zb
Some motivation for the calculus of finite differences. How can we evaluate f (x)dx,
a
where f is continuous in its domain? The answer is given by the the fundamental theorem
of calculus. It says that if g(x) is the anti-derivative of f (x), i.e., f (x) = g 0 (x) then
Zb
f (x)dx = g(a) g(b).
a
Obviously, the above problem is meaningful when the function f is continuous in its
domain (in general). For a function f (x), where the value of function is known only at
some finite number of values of x in the interval [a, b]. For such functions an analogue
Xb
of the above problem can be stated as: how can we evaluate f (x) ? Such problems
x=a
occurs frequently in practical and theoretical calculations.
To answer this question,
P we need R
a result similar to the fundamental theorem of
calculus which works for instead .
Definition 1 (Anti-difference operator). A function g(x) is called anti-derivative of the
function f (x) if
g(x) = f (x).
Sol. Suppose
Therefore
y = 2x3 3x2 + 3x 10 = 2x(3) + 3x(2) + 2x(1) 10.
Also,
Sol. Suppose f (x) is the function whose first forward difference is 6x2 + 2, i.e.,
Therefore
f (x) = 6x(2) + 6x(1) + 2.
Integrating the above we obtain:,
Exercise (Assignment)
(Q.4) Prove that + = .
Hint: Use the relations between , and E.
x: 0 1 2 3 4
f (x) : 1.0 1.5 2.2 3.1 4.6
(Q.6) Express x3 2x2 + x 1 into factorial polynomial hence show that 4 f (x) = 0.
Ans: f (x) = x(3) + x(2) 1.
(Q.7) Represent the function f (x) = x4 12x3 + 24x2 30x + 9 and all its successive
differences into factorial notation. Hence show that 5 f (x) = 0.
Ans: f (x) = x(4) 6x(3) + 13x(2) + x(1) + 9.
(Q.8) Find the function whose first forward difference is 2x3 + 3x2 5x + 4.
Ans: f (x) = 12 x(4) + 3x(3) + 4x(1) + c.
(Q.9) Find the function whose first forward difference is 9x2 + 11x + 5.
Finding the missing terms in a given series. In this, we deal with the data in which few
terms are missing and we have to recover those missing values. We know that to fit a
straight line we must have two points i.e., two points known means we can assume that a
first degree curve can be fitted. Generally, n points known means a (n1)-th degree curve
can be fitted with the given data. Then we apply the theorem that the n-th difference of
a (n 1)-th degree polynomial is zero.
Dr. Satish Shukla 9 of 33
Sol. In the above data, there are 4 points are known (as their both x and y co-ordinates
are known). So, we can assume that y is a third degree polynomial. Hence all the fourth
differences must be zero. Let a be the unknown values of y. Then the difference table will
be as follows:
x y y 2 y 3 y 4 y
0 1
2
1 3 4
6 a 19
2 9 a 15 124 3a
a9 105 3a
3 a 90 2a
81 a
4 81
Since the fourth difference must be zero, we have 124 3a = 0 = a = 31. This value
is not 33 = 27, because we assume y as a polynomial, while it is y = 3x .
Sol. In the above data, there are 5 points are known (as their both x and y co-ordinates
are known). So, we can assume that y is a fourth degree polynomial. Hence all the fifth
differences must be zero. Let a, b, c respectively, are the unknown values of y. Then the
difference table will be as follows:
x y y 2 y 3 y 4 y 5 y
0 1
2
1 1 4
2 8
2 1 4 16
2 8 a 31
3 1 4 a 15
2 a7 b 5a + 26
4 1 a3 b 4a + 11
a1 b 3a + 4 c 5b + 10a 16
5 a b 2a + 1 c 4b + 6a 5
ba c 3b + 3a 1
6 b c 2b + a
cb
7 c
Dr. Satish Shukla 10 of 33
Example 11. If yx is a polynomial for which fifth difference is constant and y1 +y7 =
7845, y2 + y6 = 686, y3 + y5 = 1088, find y4 .
Therefore:
r(r 1) 2 r(r 1)(r 2) 3
y = y0 + ry0 + y0 + y0 + + r y0 .
2! 3!
Newtons Backward interpolation formula. Suppose the value of function y = f (x) is
given at n + 1 equally spaced points x0 , x1 = x0 + h, x2 = x1 + h, . . . , xn = xn1 + h,
and we have to find the value of function at an intermediate point x [x0 , xn ]. Suppose
xn x
x = xn rh, i.e., r = . Then we know that
h
y = f (x) = f (xn rh)
r
= E r f (xn ) = E 1 yn
= (1 )r y0
r
1 C1 +r C2 2 +r C3 3 + + (1)r rCr r yn .
=
Therefore:
r(r 1) 2 r(r 1)(r 2) 3
y = yn ryn + yn yn + + (1)r r yn .
2! 3!
Example 12. The area A of a circle of diameter d is given by the following table:
d: 80 85 90 95 100
A: 5026 5674 6362 7088 7854
We represent d by x and A by y. Since d = 82 is near the initial value 80 we will use the
x x0 82 80
forward interpolation formula. Then for x = 82 we have r = = = 0 4.
h 5
Now by Newtons forward interpolation formula we have:
Example 13. From the following table, estimate the number of students who ob-
tained marks between 40 and 45.
Marks: 30-40 40-50 50-60 60-70 70-80
No. of Students: 31 42 51 35 31
We have to find y(45) and 45 is near the initial value 40, therefore we will use the Newtons
forward interpolation formula. Then for x = 45 we have
x x0 45 40
r= = = 0 5.
h 10
Now by Newtons forward interpolation formula we have:
Thus, the number of students obtained marks less than 45, i.e., y(45) = 48 and from the
table the number of students obtained marks less than 40 is y(40) = 31. Therefore, the
number of students ontaining the marks between 40 and 45 will be:
x y y 2 y 3 y
0 1
1
1 2 2
1 12
2 1 10
9
3 10
Here h = 1, x0 = 0, and so
x x0 x0
=r= = x.
h 1
Now by forward interpolation formula we have:
f (x) = y
r(r 1) 2 r(r 1)(r 2) 3
= y0 + ry0 + y0 + y0 +
2! 3!
x(x 1) x(x 1)(x 2)
= 1 + x(1) + (2) + (12)
2 6
= 1 + x x(x 1) + 2x(x 1)(x 2)
= 2x3 7x2 + 6x + 1.
Sol. Here h = 0.5. Since 3.75 is near to the final value x = 5 we will use the Newtons
backward interpolation formula. Then,
xn x 5 3.75
r= = = 2.5.
h 0.5
The backward difference table is given as follows:
x y y 2 y 3 y 4 y 5 y
2.5 24.145
2.102
3 22.043 2.284
0.182 6.047
3.5 22.225 3.763 12.009
3.581 5.962 20.003
4 18.644 2.199 7.994
1.382 2.032
4.5 17.262 0.167
1.215
5 16.047
Dr. Satish Shukla 14 of 33
y = f (3.75)
r(r 1) 2 r(r 1)(r 2) 3 r(r 1)(r 2)(r 3) 4
= y5 ry5 + y5 y5 + y5
2! 3! 4!
r(r 1)(r 2)(r 3)(r 4) 5
+ y5
5!
(2.5)(1.5) (2.5)(1.5)(0.5)
= 16.047 (2.5)(1.215) + (0.167) (2.032)
2 6
(2.5)(1.5)(0.5)(0.5) (2.5)(1.5)(0.5)(0.5)(1.5)
+ (7.994) + (20.003)
24 120
= 16.047 + 3.037 + 0.313 + 0.635 + 0.312 0.2352
= 20.1088.
Example 16. Find the values of f (1.5) and f (5.5) from the following table:
x: 0 1 2 3 4 5 6 7
y: 1 -1 1 2 12 30 45 50
Now use the forward interpolation for f (1.5) and backward interpolation for f (5.5).
Exercise (Assignment)
x: 4 6 8 10
y: 1 3 8 16
Hence find y at x = 5.
(Q.3) Given that sin(45 ) = 0.7071, sin(50 ) = 0.7660, sin(55 ) = 0.8192, sin(60 ) =
0.8660. Then find sin(52 ).
Hint: Use Newtons forward difference formula with x = 52. Ans. 0.788.
(Q.4) Find the number of mens getting wages between Rs. 10 and Rs. 15 from the
Wages 10-20 20-30 30-40 40-50
following data:
Frequency 9 30 35 42
Ans. 15.
(Q.5) Find the cubic polynomial in x for the following polynomial:
x : 0 1 2 3 4 5
y : -3 3 11 27 57 107
v : 10 20 30 40
p : 1.1 2.0 4.4 7.9
x : 20 25 30 35 40 45
f (x) : 354 332 291 260 231 204
Interpolation for unequally spaced intervals. For unequally spaced intervals we will use
two formulae: (i) The Lagranges formula; (ii) Newtons Divided Difference formula.
(i) The Lagranges formula. Suppose, the values of function y = f (x) at points x0 , x1 , x2 , . . . , xn
be y0 = f (x0 ), y1 = f (x1 ), y2 = f (x2 ), . . . , yn = f (xn ). Then, the Lagranges approximated
polynomial of degree n is given by:
(x x1 )(x x2 )(x x3 ) (x xn ) (x x0 )(x x2 )(x x3 ) (x xn )
f (x) = y0 + y1
(x0 x1 )(x0 x2 )(x0 x3 ) (x0 xn ) (x1 x0 )(x1 x2 )(x1 x3 ) (x1 xn )
(x x0 )(x x1 )(x x2 ) (x xn1 )
+ + yn .
(xn x0 )(xn x1 )(xn x3 ) (xn xn1 )
(ii) Newtons Divided Difference formula. First we define the divided difference of a
function. Suppose x0 , x1 , x2 , . . . , xn be the values of arguments x and y0 = f (x0 ), y1 =
f (x1 ), y2 = f (x2 ), . . . , yn = f (xn ) be the corresponding values of y. Then the first divided
difference of f is denoted by 4 | f (x0 ) or f [x0 , x1 ] and
f (x1 ) f (x0 )
4
| f (x0 ) = f [x0 , x1 ] = .
x1 x0
Dr. Satish Shukla 16 of 33
Similarly, we define
f [x1 , x2 ] f [x0 , x1 ]
| 2 f (x0 ) = f [x0 , x1 , x2 ] =
4
x2 x1
and so on.
Suppose, the values of function y = f (x) at points x0 , x1 , x2 , . . . , xn be y0 = f (x0 ), y1 =
f (x1 ), y2 = f (x2 ), . . . , yn = f (xn ). Then, the Newtons divided difference approximated
polynomial of degree n is given by:
2 n
f (x) = f (x0 ) + (x x0 ) 4
| f (x0 ) + (x x0 )(x x1 ) 4
| f (x0 ) + + (x x0 )(x x1 ) (x xn1 ) 4
| f (x0 )
Example 17. Find the Newtons divided difference approximated polynomial for
the function given below and hence find f (8), f (9) and f (15).
x : 4 5 7 10 11 13
y = f (x) : 48 100 294 900 1210 2028
Sol. The divided difference table for the given function is as follows:
x y 4
| f (x) | 2 f (x)
4 | 3 f (x)
4 | 4 f (x)
4
4 48
100 48
= 52
54
97 52
5 100 = 15
74
294 100 21 15
= 97 =1
75 10 4
202 97 11
7 294 = 21 =0
10 5 11 4
900 294 27 21
= 202 =1
10 7 11 5
310 202 11
10 900 = 27 =0
11 7 13 5
1210 900 33 27
= 310 =1
54 13 7
409 310
11 1210 = 33
13 10
1210 2028
= 409
13 11
13 2028
f (x) = f (x0 ) + (x x0 ) 4
| f (x0 )
| 2 f (x0 ) + (x x0 )(x x1 )(x x2 ) 4
+(x x0 )(x x1 ) 4 | 3 f (x0 )
| 4 f (x0 )
+(x x0 )(x x1 )(x x2 )(x x3 ) 4
| 5 f (x0 )
+(x x0 )(x x1 )(x x2 )(x x3 )(x x4 ) 4
= 48 + 52(x 4) + 15(x 4)(x 5) + (x 4)(x 5)(x 7).
Example 18. Given that f (0) = 18, f (1) = 0, f (3) = 0, f (5) = 248, f (6) =
0, f (9) = 13104, then find f (x).
0 -18
0 + 18
= 18
10
0 18
1 0 = 6
30
00 31 + 6
=0 = 5
31 50
124 0 31 + 5
3 0 = 31 =6
51 60
248 0 124 + 31 15 6
= 124 = 31 =1
53 61 90
248 + 124 151 31
5 -248 = 124 = 15
63 91
0 + 248 1030 124
= 248 = 151
65 93
4368 248
6 0 = 1030
95
13104 0
= 4368
96
9 13104
f (x) = f (x0 ) + (x x0 ) 4
| f (x0 )
| 2 f (x0 ) + (x x0 )(x x1 )(x x2 ) 4
+(x x0 )(x x1 ) 4 | 3 f (x0 )
| 4 f (x0 )
+(x x0 )(x x1 )(x x2 )(x x3 ) 4
| 5 f (x0 )
+(x x0 )(x x1 )(x x2 )(x x3 )(x x4 ) 4
= 18 + 18x 6x(x 1) + 7.4x(x 1)(x 3) + 1.87x(x 1)(x 3)(x 5)
+1.63x(x 1)(x 3)(x 5)(x 6).
Inverse Interpolation. Sometimes it will be required to find out the value of x corre-
sponding to a value of y. Keeping in mind x and y are variables representing independent
and dependent variable, in such case we have to treat y as independent variable and x as
dependent variable so that the interpolation formulae remain valid in this case also. Since
y is considered as the independent variable, we have to check whether the values of y are
equally spaced or not and accordingly we have to decide which interpolation formula is
applicable.
Example 19. Find the value of x for y = 2.2 from the following table:
x : 0 1 2 3 4 5
y : 1 2 3 5 12 30
Dr. Satish Shukla 18 of 33
Sol. Since the values of y are not equidistant, we use the Newtons inverse divided
difference formula. Then, the divided difference table for y will be:
y x 4
| x |2x
4 |3x
4 |4x
4 |5x
4
1 0
10
=1
21
11
2 1 =0
31
21 0.167 0
=1 = 0.042
32 51
0.5 1 .013 .042
3 2 = 0.167 = .005
52 12 1
32 0.04 + 0.167
= 0.5 = 0.013 0
53 12 2
0.143 0.5 .001 .013
5 3 = 0.04 0
12 3 30 2
43 0.003 + 0.04
= 0.143 = 0.001
12 5 30 3
0.056 0.143
12 4 = 0.003
30 5
54
= 0.056
30 12
30 5
x = x0 + (y y0 ) 4
| x0
| 2 x0 + (y y0 )(y y1 )(y y2 ) 4
+(y y0 )(y y1 ) 4 | 3 x0
| 4 x0
+(y y0 )(y y1 )(y y2 )(y y3 ) 4
| 5 x0
+(y y0 )(y y1 )(y y2 )(y y3 )(y y4 ) 4
= 0 + (2.2 1)(1) + (2.2 1)(2.2 2)(0) + (2.2 1)(2.2 2)(2.2 3)(0.042)
+(2.2 1)(2.2 2)(2.2 3)(2.2 5)(0.005)
= 1.2 + 0.008 + 0.003
= 1.211.
Example 20. From the given table find for what value of x when y = 13.6:
x : 30 35 40 45 50
y : 15.9 14.9 14.1 13.3 12.5
Sol. We will find the value x(13.6) by Lagranges inverse interpolation formula. Here
x0 = 30, x1 = 35, x2 = 40, x3 = 45, x4 = 50 and y0 = 15.9, y1 = 14.9, y2 = 14.1, y3 =
13.3, y4 = 12.5 and y = 13.6. Then, we have:
(y y1 )(y y2 )(y y3 )(y y4 ) (y y0 )(y y2 )(y y3 )(y y4 )
x = x0 + x1
(y0 y1 )(y0 y2 )(y0 y3 )(y0 y4 ) (y1 y0 )(y1 y2 )(y1 y3 )(y1 y4 )
(y y0 )(y y1 )(y y3 )(y y4 ) (y y0 )(y y1 )(y y2 )(y y4 )
+ x2 + x3
(y2 y0 )(y2 y1 )(y2 y3 )(y2 y4 ) (y3 y0 )(y3 y1 )(y3 y2 )(y3 y4 )
(y y0 )(y y1 )(y y2 )(y y3 )
+ x4 .
(y4 y0 )(y4 y1 )(y4 y2 )(y4 y3 )
Dr. Satish Shukla 19 of 33
Exercise (Assignment)
(Q.1) Use Newtons divided difference formula to find the form of f (x), hence find f (4):
x : 0 2 3 6
f (x) : 648 704 729 792
x : 5 7 11 13 17
f (x) : 150 392 1452 2366 5202
x : 5 6 9 11
y = f (x) : 12 13 14 16
Numerical Differentiation
dy
Suppose y = f (x) and we have to find the value of at point x. Suppose, the values of
dx
x are equally spaced. We consider the following two cases:
x x0
(i) When x is situated near to the initial value x0 . Let r = . Then, by Newtons
h
forward difference formula we know that
r(r 1) 2 r(r 1)(r 2) 3 r(r 1)(r 2)(r 3) 4
y = f (x) = f (x0 +rh) = y0 +uy0 + y0 + y0 + y0 +
2! 3! 4!
Dr. Satish Shukla 20 of 33
dr 1 dy dy dr
Since = we have = , i.e.,
dx h dx dr dx
3r2 6r + 2 3 4r3 18r2 + 22r 6 4
dy 1 2r 1 2
= y0 + y0 + y0 + y0 + (2)
dx h 2! 3! 4!
If x = x0 , i.e., r = 0 from the above equation we get
dy 1 1 2 1 3 1 4
= y0 y0 + y0 y0 + .
dx x=x0 h 2 3 4
If x 6= x0 , then we use the formula (2). Also, from (2) we have
d2 y 12r2 36r + 22 4
1 2 6r 6 3
= 2 y0 + y0 + y0 + .
dx2 h 3! 4!
If x = x0 , i.e., r = 0 from the above equation we get
2
dy 1 2 3 11 4
= 2 y0 y0 + y0 + .
dx2 x=x0 h 12
(i) When x is situated near to the last value xn . Similarly, if we use the Newtons
backward difference formula we obtain:
3r2 6r + 2 3 4r3 18r2 + 22r 6 4
dy 1 2r 1 2
= yn yn + yn yn + (3)
dx h 2! 3! 4!
If x = xn , i.e., r = 0 from the above equation we get
dy 1 1 2 1 3 1 4
= yn + yn + yn + yn + .
dx x=xn h 2 3 4
If x 6= xn , then we use the formula (3).
Similarly, we can find the second derivative of function.
Now, suppose, the values of x are unequally spaced. In such cases, we use the Newton
divided difference formula or the Lagranges interpolation formula, whichever is suitable,
and find the approximated polynomial for f (x). Now, we can obtain the derivatives of f
by differentiating this polynomial.
dy d2 y
Example 21. Find and 2 at x = 1, using:
dx dx
x: 1 3 5 7 9
y: 85.3 74.5 67.0 60.5 54.3
x y y 2 y 3 y 4 y
1 85.3
10.8
3 74.5 3.3
7.5 2.3
5 67.0 1.0 1.6
6.5 0.7
7 60.5 0.3
6.2
9 54.3
Dr. Satish Shukla 21 of 33
d2 y
1 2 3 11 4
= 2 y0 y0 + y0
dx2 h 12
2 x=x0
dy 1 11
= = 2 3.3 (2.3) + (1.6) = 1.767.
dx2 x=1 2 12
Example 22. If the value of function y = f (x) is given by the following table:
x: 0 1 2 3 4 5 6 7
y: 1 -1 1 2 12 30 45 50
dy
Then find find the value of at points x = 1 and 5.
dx
Sol. The difference table for the given function is given below. The blue boxes contain
the values of the forward difference of y, while the red boxes contain the values of the
backward difference of y.
x y y 2 y 3 y 4 y 5 y 6 y 7 y
0 1
2
1 1 4
2 5
2 1 1 15
1 10 26
3 2 9 11 27
1 1 14
10
4 12 8 10 13
18 11 14
5 30 3 4
15 7
6 45 10
5
7 50
x y y 2 y 3 y 4 y 5 y 6 y 7 y
(i) Since x = 1 is near to the initial value 0, therefore we will use the forward difference
formula. Since x = 1 is a table point, we suppose x0 = 1, then we know that
dy 1 1 2 1 3 1 4 1 5 1 6
= y0 y0 + y0 y0 + y0 y0
dx x=x0 h 2 3 4 5 6
dy 1 10 11 1 13
= =2+ + + + = 6.6167.
dx x=1 2 3 4 5 6
Dr. Satish Shukla 22 of 33
(ii) Since x = 5 is near to the last value 7, therefore we will use the backward difference
formula. Since x = 5 is a table point, we suppose xn = x6 = 1, then we know that
dy 1 1 2 1 3 1 4 1 5
= yn yn + yn yn + yn
dx x=xn h 2 3 4 5
dy 1 1 1 1
= = y6 2 y6 + 3 y6 4 y6 + 5 y6 .
dx 2 3 4 5
x=1
dy 8 1 11 26
= = 18 + = 11.2167.
dx x=1 2 3 4 5
dy d2 y
Example 23. Find and 2 at x = 4, using:
dx dx
x: 1 2 4 8 10
y: 0 1 5 21 27
Sol. In this problem, the values of x are not equally spaced. Therefore, we use the
Newtons divided difference formula to find the approximate polynomial for f (x). Then,
the divided difference table is as follows:
x y 4
| y |2y
4 | 3 f (x)
4 | 4 f (x)
4
1 0
10
=1
21
21 1
2 1 =
41 3
51 1/3 1/3
=2 =0
42 81
42 1 1/16 0
4 5 = = 1/144
82 3 10 1
21 5 1/6 1/3 1
=4 =
84 10 2 16
34 1
8 21 =
10 4 6
27 21
=3
10 8
10 27
Therefore, the Newtons divided difference approximated polynomial will be:
y = f (x0 ) + (x x0 ) 4
| f (x0 )
| 2 f (x0 ) + (x x0 )(x x1 )(x x2 ) 4
+(x x0 )(x x1 ) 4 | 3 f (x0 )
| 4 f (x0 ).
+(x x0 )(x x1 )(x x2 )(x x3 ) 4
Thus, 1 1
y = 0 + (x 1) + (x 1)(x 2) (x 1)(x 2)(x 4)(x 8)
3 144
211 2
= x4 15x3 + x + 120x + 67.
3
Differentiating two times we get:
dy 422
= 4x3 45x2 + x + 120; and
dx 3
d2 y 422
2
= 12x2 90x + .
dx 3
Dr. Satish Shukla 23 of 33
Sol. Since the values v = 2 and v = 3 are near to yhe initial point 2, therefore we will
use the forward difference formula. Then, the forward difference table is as follows:
v p p 2 p 3 p 4 p
2 105
62.3
4 42.7 44.6
17.4 35.8
6 25.3 8.8 31.9
8.6 3.9
8 16.7 4.9
3.7
10 13
v v0 21
(i) At v = 2. Here r = = = 0.5 and
h 2
3r2 6r + 2 3 4r3 18r2 + 22r 6 4
dp 1 2r 1 2
= p0 + p0 + p0 + p0 +
dv h 2! 3! 4!
3(0.5)2 6(0.5) + 2 4(0.5)3 18(0.5)2 + 22(0.5) 6
1
= 62.3 + 0 + (35.8) + (31.9)
2 6 24
1
= [62.3 + 1.4916 + 1.3291]
2
= 29.7396.
v v0 32
(ii) At v = 3. Here r = = = 0.5 and
h 2
3r2 6r + 2 3 4r3 18r2 + 22r 6 4
dp 1 2r 1 2
= p0 + p0 + p0 + p0 +
dv h 2! 3! 4!
3(0.5)2 6(0.5) + 2 4(0.5)3 18(0.5)2 + 22(0.5) 6
1
= 62.3 + 0 (44.6) (35.8) + (31.9)
2 6 12
1
= [62.3 + 0 1.4917 + 2.6583]
2
= 30.56567.
Dr. Satish Shukla 24 of 33
Exercise (Assignment)
dy
(Q.1) Values of y as plotted against x are given below, find at x = 0.5.:
dx
Ans. -0.17567
dy
(Q.2) Find at x = 1.5. from the following table:
dx
Ans. 4.75
dn y
dy
Ans. = 2.7476 and = 0.7144.
dx x=1.6 dxn x=1.6
(Q.5) Find the first and second derivatives of the function given below at the point
x = 1.2:
x: 1 2 3 4 5
y: 0 1 5 6 8
dn y
dy
Ans. = 1.673 and = 8.13.
dx x=1.2 dxn x=1.2
(Q.6) Find the value of cos 1.747 using the values as given below:
d dy
Hint. Since (sin x) = cos x, therefore, find at point x = 1.747.
dx dx
Dr. Satish Shukla 25 of 33
Numerical integration
Formulae for Numerical Integration. Suppose, we have to find the value of integral
Rb ba
a f (x)dx. Suppose h = x0 = a, xn = b, where n is any positive integer called the
n
number of division. Then, we use the following rules:
This rule is applicable for even no. of intervals only i.e., n, the no. of intervals =
even only.
This rule is applicable for n, the no. of intervals = multiple of three only.
This rule is applicable for n, the no.of intervals = multiple of six only.
Z1
1
Example 25. Find approximate value of dx by Simpsons one third, Simp-
1 + x2
0
sons three eight and Weddles rule and hence find the error each case.
1 ba 10 1
Sol. Here f (x) = , a = 0, b = 1. Take n = 6, then h = = = . The
1 + x2 n 6 6
table for the values of x and f (x) is given below:
1 2 3 4 5 6
x: x0 = 0 x1 = x2 = x3 = x4 = x5 = x6 = =1
6 6 6 6 6 6
f (x) : y0 = 1 y1 = 0.97297 y2 = 0.9 y3 = 0.8 y4 = 0.6923 y5 = 0.59016 y6 = 0.5
Dr. Satish Shukla 26 of 33
Z1
1 h
2
dx = [(y0 + y6 ) + 2(y2 + y4 ) + 4(y1 + y3 + y5 )]
1+x 3
0
1
= [(1 + 0.5) + 2(0.9 + 0.69230) + 4(0.97297 + 0.8 + 0.59016)]
18
= 0.78539.
Since
Z1
1 1 1
dx = tan x 0 = = 0.78539
1 + x2 4
0
Therefore the error:= 0.78539 0.78539 = 0 (up to the five places of decimal).
Example 26. Find the approximate value of ln(5) by calculating to four places of
Z5
1
decimal by Simpsons one third rule from dx by dividing the range into 10
4x + 5
0
equal parts.
1 50
Sol. Here f (x) = , a = 0, b = 5. Take n = 10, then h = = 0.5. The table for
4x + 5 10
the values of x and f (x) is given below:
Z5
1 h
dx = [(y0 + y10 ) + 2(y2 + y4 + y6 + y8 ) + 4(y1 + y3 + y5 + y7 + y9 )]
4x + 5 3
0
0.5
= [2.41515]
3
= 0.40253.
Since
Z1 1
1 1 1 1
dx = ln(4x + 5) = [ln(25) ln(5)] = ln(5).
4x + 5 4 0 4 4
0
Therefore, we have
1
ln(5) = 0.40253 = ln(5) = 1.61010.
4
/2
Z
Example 27. Evaluate cos d by dividing the interval into 6 equal parts. Use
0
Waddles rule.
Dr. Satish Shukla 27 of 33
/2 0
Sol. Here f () = cos , a = 0, b = /2. Take n = 6, then h = = . The table
6 12
for the values of x and f (x) is given below:
5
: 0 = 0 1 = 2 = 3 = 4 = 5 = 6 =
12 6 4 3 12 2
f () : y0 = 1 y1 = 0.9828 y2 = 0.9306 y3 = 0.8409 y4 = 0.7071 y5 = 0.5087 y6 = 0
Example 28. A river is 80 ft. wide. The depth d in feet at a distance x ft. from
one bank is given by the following table:
x: 0 10 20 30 40 50 60 70 80
d: 0 4 7 9 12 15 14 8 3
80 0
Sol. Here d(x) =area, a = 0, b = 80 and n = 8, then h = = 10. The table for the
8
values of x and d(x) is given in the question. Therefore, by Waddless rule we have: the
area of cross-section of river
3h
A = [d0 + 5d1 + d2 + 6d3 + d4 + 5d5 + 2d6 + 5d7 + d8 ]
10
3 10
= [239]
10
= 717 square units.
Example 29. The following table gives the velocity v of a particle at time t : Find
the distance moved by the particle in 12 seconds and also the acceleration at t = 2
sec.
t (seconds): 0 2 4 6 8 10 12
v (velocity): 4 6 16 34 60 94 136
Sol. Here v(t) =velocity. If s is the distance travel by particle in time t then we know
that
ds
Z
= v = s = v dt.
dt
Z2
Therefore, the distance traveled in t = 2 seconds will be s = v dt. Here a = 0, b = 12
0
12 0
and n = 6, then h = = 2. The table for the values of t and v(t) is given in the
6
Dr. Satish Shukla 28 of 33
Exercise (Assignment)
/2
Z
(Q.1) Evaluate sin x dx by Simpsons one-third rule using 11 ordinates.
0
Hint: For 11 ordinates, take n = 10. Ans. 1.0006.
Z2
dx
(Q.2) Evaluate by Simpsons rule. Hence obtain the approximate value of ln(2)..
x
1
Hint: Take n = 6. Ans. 0.6931.
0.7
Z
(Q.3) Evaluate ex x dx.
0.5
(Q.4) A reservoir discharging water through sluices at a depth h below the water surface
has a surface area A for various values of h as given below:
h (ft.): 10 11 12 13 14
A (sq. ft.): 950 1070 1200 1350 1530
dh
If t denotes the time in minutes and the rate of fall of the water surface be =
dt
48 h
. Estimate the time taken for the water level to fall from 14 to 10 ft. above
A
the sluices.
dh 48 h R 14 R 14 A
Hint: Since = therefore 10 dt = 10 . Now, let f (h) =
dt A 48 h
A R 14
and find the value of 10 f (h)dh which is the required value. Ans. -29.09.
48 h
Z6
1
(Q.5) Evaluate dx by Trapezoidal rule (ii) Simpsons one-third rule (iii) Simp-
1 + x2
0
sons three-eight rule (iv) Weddles rule. Take h = 1 and compare the result with
its actual value in each case. using 11 ordinates.
(Q.6) The following table gives the values of a function at equal intervals:
Z2
0
Evaluate (i) f (1.8) (ii) f (1, 5) (iii) f (x)dx.
0
Ans. (i) Use Backward interpolation formula:: 0.078133(ii) Use backward interpo-
lation formula with xn = 1.5:: -0.1854 (iii) Use Simpsons 1/3 rule:: 0.4772.
For each value (xi , yi ), i = 1, 2, . . . , n we draw n points Pi (xi , yi ) on with the values xi on
X and yi on Y axis, as shown in figure.
X
O x1 x2 x3 xn
The line y = ax + b
y = a + bx. (4)
Obviously, the above expression depends on the values of a and b and to minimize the
E E
value of E we use the condition of minima, i.e., = = 0. Therefore, we have
a b
n n n n
E X X X X
= (2) [yi (a + bxi )] = 0 = yi a 1b xi = 0
a i=1 i=1 i=1 i=1
n n n n
E X X X X
= (2xi ) [yi (a + bxi )] = 0 = xi yi a xi b x2i = 0.
b i=1 i=1 i=1 i=1
Remark 1. Sometimes (when the data size is big) then it is not convenient to do
the calculations with the above mentioned formulae. In such a case, we use the
scaling, i.e., we substitute
x xm y ym
u= , v=
h k
where xm is a suitable value of x (usually, the middle terms of x and y) and h is
the length of interval of x. Similarly ym and k are chosen. After this scaling, we
use same formulae to calculate a, b and c with u (in place of x) and v (in place of
y).
x1981
Sol. Suppose u = 10
and v = y. Then the straight line will be:
v = a + bu. (5)
The value of a and b can be obtained by the following equations:
X X
v = na + b u
X X X (6)
uv = a u + b u2 .
The required values are given in the following table:
Dr. Satish Shukla 31 of 33
v=y x1981
x u= 10
uv u2
1961 8 -2 -16 4
1971 10 -1 -10 1
1981 12 0 0 0
1991 10 1 10 1
2001 16 2 32 4
u2 = 10
P P P P
Total v = 56 u=0 uv = 16
56 = 5a + 0 b
16 = 0 a + 10b.
y = 305.76 + (0.16)x.
x 2.5
Sol. Suppose u = = 2x 5 and v = y, then the best fitted parabola will be:
0.5
v = a + bu + cu2 . (7)
x v=y u = 2x 5 uv u2 v u2 u3 u4
1 1.1 -3 -3.3 9.9 9 -27 81
2.5 2 0 0 0 0 0 0
u2 v = 69.9 u2 = 28 u3 = 0 u4 = 196
P P P P P P P
Total v = 16.2 u=0 uv = 14.3
16.2 = 7a + 0 b + 28c
14.3 = 0 a + 28b + 0 c
69.9 = 28a + 0 b + 196c.
On solving we get a = 2.07, b = 0.51 and c = 0.06. Therefore, the parabola will be:
v = 2.07 + (0.51)u + (0.06)u2 , i.e.,
Example 32. Fit a curve of the type y = axb to the following data:
x: 1 2 3 4 5
y: 0.5 2 4.5 8 12.5
Sol. We have to fit the curve y = axb . Taking logarithm the required curve will be
ln y = ln a + b ln x. Putting ln y = v, ln x = u and ln a = A, the required curve will be:
v = A + bu. (9)
x y u = ln x v = ln y uv u2
1 0.5 0 -0.6931 0 0
u2 = 6.1993
P P P P
Total u = 4.7874 v = 6.1092 uv = 9.0803
y = e0.6931 x2 .
Exercise (Assignment)
(Q.1) Find the parabola of the form y = a + bx + cx2 which fits most closely with the
x : -3 -2 -1 0 1 2 3
table given below: .
y : 4.63 2.11 0.67 .09 0.63 2.25 4.58
Ans. y = 0.13286 0.0039x + 0.4975x2 .
(Q.2) Find the least square fit y = a + bx + cx2 for the following data:
x : -3 -1 1 3
y : 15 5 1 3
x : 1 2 3 4 5 6 7 8 9
y : 2 6 7 8 10 11 11 10 9
x : 1 2 3 4 5
y : 0.5 2 4.5 8 12.5
Hint: Take log of the given curve we get: ln y = ln a + (ln b)x, i.e., v = A + Bx,
where A = ln a, v = ln y, B = ln b. Now apply the procedure for fitting a line.