Sei sulla pagina 1di 33

Dr.

Satish Shukla 1 of 33

Engg. Math. II (Unit-IV)

Numerical Analysis

Syllabus. Interpolation and Curve Fitting: Introduction to Interpolation; Calcu-


lus of Finite Differences; Finite Difference and Divided Difference Tables; Newton-
Gregory Polynomial Form; Lagrange Polynomial Interpolation; Theoretical Errors
in Interpolation; Spline Interpolation; Approximation by Least Square Method.
Numerical Differentiation and Integration: Discrete Approximation of Deriva-
tives: Forward, Backward and Central Finite Difference Forms, Numerical Integra-
tion, Simple NewtonCotes Rules: Trapezoidal and Simpsons (1/3) Rules; Weddles
Rule, Gaussian Quadrature Rules: Gauss-Legendre, Gauss-Laguerre, GaussHer-
mite, Gauss-Chebychev.

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

where yi = f (xi ), i = 0, 1, 2, . . . , n. Then, the values of x, i.e., x0 , x1 , x2 , . . . , xn are called


the argument of function and the corresponding values y0 , y1 , y2 , . . . , yn of y are called the
entries. We assume that the arguments are equally spaced with space h, i.e., x1 = x0 + h,
x2 = x1 + h . . . , xn = xn1 + h. In general, xi = xi1 + h = x0 + ih, i = 1, 2, . . . , n.

The forward difference operator . It is denoted by and defined by

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:

y0 = f (x0 ) = f (x0 + h) f (x0 ) = f (x1 ) f (x0 ) = y1 y0 .

Similarly, y1 = y2 y1 , . . . , yn1 = yn yn1 . The higher order differences are defined


as follows:

2 f (x) = (f (x)) = [f (x + h) f (x)] = f (x + h) f (x)


= f (x + 2h) f (x + h) [f (x + h) f (x)]
= f (x + 2h) 2f (x + h) + f (x).

Similarly, 3 f (x) and other higher order differences can be obtain.


The differences of y = f (x) for tabular value of y can be obtained by the following
forward difference table.
Dr. Satish Shukla 2 of 33

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 backward difference operator . The backward difference operator is denoted by


and defined by
f (x) = f (x) f (x h).
It is clear that

y1 = f (x1 ) f (x1 h) = f (x1 ) f (x0 ) = y1 y0 .

Similarly, y2 = y2 y1 , . . . , yn = yn yn1 . Also, it is obvious that

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

The shifting operator E. It is denoted by E and defined by

Ef (x) = f (x + h).

The higher order shifting is defined by

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;

E 1 f (x) = f (x h) and E n f (x) = f (x nh).

Relation between , , E and D.


Dr. Satish Shukla 3 of 33

Example 1. Prove the following relations:

(a) E 1 (b) 1 E 1 (c) E (d) (1 + )(1 ) 1


1 1
(e) (f) D ln(1 + ) (g) D ln(1 ).
h h

Sol. (a) By definition we have

f (x) = f (x + h) f (x) = Ef (x) f (x) = (E 1)f (x).

Therefore
E1 or E 1+.
(b)By definition we have

f (x) = f (x) f (x h) = f (x) E 1 f (x) = (1 E 1 )f (x).

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.

(d) By (a) and (b) we have

(1 + )(1 ) EE 1 1.

(e) By (a) and (b) we have

(E 1)(1 E 1 ) E EE 1 1 + E 1 E 2 + E 1 .

Similarly, we have E 2 + E 1 . Therefore .


(f) By Taylor series we know that
h2 00 h3 000
f (x + h) = f (x) + hf 0 (x) + f (x) + f (x) +
2! 3!
h2 2 h3 3
= Ef (x) = f (x) + hD [f (x)] + D [f (x)] + D [f (x)] +
2! 3!
h2 2 h3 3
 
= Ef (x) = 1 + hD + D + D + f (x)
2! 3!
= Ef (x) = ehD f (x).

Therefore, E ehD , i.e., 1 + ehD or

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.

Example 4. Prove that: [eax ln(bx)] .

Sol. We know that

[eax ln(bx)] = (E 1) [eax ln(bx)]


= E[eax ln(bx)] eax ln(bx)
= ea(x+h) ln[b(x + h)] eax ln(bx)
Dr. Satish Shukla 5 of 33

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)

Theorem 1. Prove that the nth difference of a polynomial of degree n is constant


and all higher order differences are zero..

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
 

= a0 [(x + h)n xn ] + a1 [(x + h)n1 xn1 ] + + an1 [(x + h) x] + [an an ]


= a0 nhxn1 + b1 xn2 + b2 xn3 + + bn1 .

Similarly 2 f (x) = [f (x)]


= [a0 nhxn1 + b1 xn2 + b2 xn3 + + bn ]
= a0 n(n 1)h2 xn2 + c1 xn3 + c2 xn4 + + cn2 .

Thus, we obtain n f (x) = a0 n(n 1)(n 2) 1 hn = constant.

Therefore

n+1 f (x) = [a0 n(n 1)(n 2) 1 hn ] = (constant) = 0.


Dr. Satish Shukla 6 of 33

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).

Theorem 2 (Fundamental theorem of finite difference calculus). Let g(x) be an


antiderivative of f (x). Then:
b
X
f (x) = g(b + h) g(a).
x=a

Proof. By definition we have


b
X b
X b
X b
X b
X
f (x) = g(x) = [g(x + h) g(x)] = g(x + h) g(x)
x=a x=a x=a x=a x=a
= g(a + h) + g(a + 2h) + + g(b + h) [g(a) + g(a + h) + + g(b)]
= g(b + h) g(a)

which proves the theorem.


Next, we collect some tools for finding anti-difference of a function.
Factorial Notation or Falling Powers: Suppose n be any integer, then the factorial power
of x is denoted by x(n) and it is defined by:

x(n) = x(x h)(x 2h) (x n 1h).

If the length of interval is assumed h = 1, then

x(n) = x(x 1)(x 2) (x n 1).

Example 6. Prove that: x(n) = nx(n1) , where h = 1.


Dr. Satish Shukla 7 of 33

Sol. By definition, we have

x(n) = (x + 1)(n) x(n)


= (x + 1)(x)(x 1) (x n 2) x(x 1)(x 2) (x n 1)
 
= x(x 1) (x n 2) (x + 1) (x n 1)
= nx(x 1) (x n 2)
= nx(n1) .

Example 7. Express y = 2x3 3x2 + 3x 10 in a factorial notation and hence show


that 3 y = 12.

Sol. Suppose

y = 2x3 3x2 + 3x 10 = Ax(3) + Bx(2) + Cx(1) + D.

To find the constants A, B, C, D, we use the synthetic division as follows:


x3 x2 x constant
1 2 -3 3 -10=D
0 2 -1
2 2 -1 2=C
0 4
3 2 3=B
0
2=A

Therefore
y = 2x3 3x2 + 3x 10 = 2x(3) + 3x(2) + 2x(1) 10.
Also,

3 y = 3 [2x(3) + 3x(2) + 2x(1) 10]


= 2 [6x(2) + 6x(2) + 2]
= [12x(1) + 12x(1) ]
= 12.

Example 8. Find the function whose first forward difference is 6x2 + 2.

Sol. Suppose f (x) is the function whose first forward difference is 6x2 + 2, i.e.,

f (x) = 6x2 + 2 = Ax(2) + Bx(1) + C.

To find the constants A, B, C, we use the synthetic division as follows:


x2 x constant
1 6 0 2=C
0 6
2 6 6=B
0
3 6=A
Dr. Satish Shukla 8 of 33

Therefore
f (x) = 6x(2) + 6x(1) + 2.
Integrating the above we obtain:,

f (x) = 2x(3) + 3x(2) + 2x(1) + c.

Exercise (Assignment)

(Q.1) Prove that 3 yi = yi+3 3yi+2 + 3yi+1 yi .


Hint: Use the relation E 1 and E n yi = yi+n , n = 1, 2, 3.
 
1 f (x)
(Q.2) Prove that = , assume h = 1.
f (x) f (x)f (x + 1)
Hint: Think.
 
5x + 12
(Q.3) Evaluate 2 , assume h = 1.
x + 5x + 6
10x+32
Ans: (x+2)(x+3)(x+4)(x+5)
.


(Q.4) Prove that + = .

Hint: Use the relations between , and E.

(Q.5) Construct the table of differences for the data below:

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

Example 9. Find the missing values in table given below:


x: 0 1 2 3 4
y: 1 3 9 ? 81

Explain why the value differ from 33 or 27.

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 .

Example 10. Find the missing values in table given below:


x: 0 1 2 3 4 5 6 7
y: 1 -1 1 -1 1 ? ? ?

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

Since the fifth difference must be zero, we have


a 31 = 0, b 5a + 26 = 0, c 5b + 10a 16 = 0.
On solving we get:
a = 31, b = 129, c = 351.

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 .

Sol. Given that the fifth difference of yx is constant, so, 6 y1 = 0, i.e.,


6 y1 = 0
= (E 1)6 y1 = 0
= (E 6 6E 5 + 15E 4 20E 3 + 15E 2 6E + 1)y1 = 0
= y7 6y6 + 15y5 20y4 + 15y3 6y2 + y1 = 0
= (y7 + y1 ) 6(y6 + y2 ) + 15(y5 + y3 ) 20y4 = 0
1
= y4 = [(y7 + y1 ) 6(y6 + y2 ) + 15(y5 + y3 )]
20
1
= y4 = [7845 6 686 + 15 1088]
20
= y4 = 571.
Interpolation. The interpolation is a technique with the help of which we can construct
the new data points within the range of given discrete data points. In other words, if
a function f (x) is unknown, but the values of this function at some discrete points, say
x0 , x1 , . . . , xn are known, then we can find the find the value of f (x) at a point x [x0 , xn ].
For this, we approximate the function f (x) by a polynomial of degree maximum n (since
the value of function is known at n + 1 points). This process is called the Polynomial
interpolation.
According to the nature of points x0 , x1 , . . . , xn the process of interpolation is divided
into the following:
(I) Interpolation for equally spaced intervals. In this case, the values x0 , x1 , . . . , xn are
equally spaced, i.e., xi = xi1 + h for i = 1, 2, . . . , n and h is the space or length of the
interval. For such case, we will use Newtons Forward interpolation formula or Newtons
backward interpolation formula. If the point at which the value is to interpolated lies in
the upper half of the difference table then we use Newtons Forward interpolation formula.
Newtons Backward interpolation formula is used when the point at which the value is to
interpolated lies in the Lower half of the difference table.
(II) Interpolation for unequally spaced intervals. In this case, the values x0 , x1 , . . . , xn
are not equally spaced. For such cases Newtons Divided difference formula or Lagranges
interpolation formula is used.

Newtons Forward 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
x x0
x = x0 + rh, i.e., r = . Then we know that
h
y = f (x) = f (x0 + rh)
= E r f (x0 ) = E r y0
= (1 + )r y0
= 1 +r C1 +r C2 2 +r C3 3 + +r Cr r y0 .
 
Dr. Satish Shukla 11 of 33

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

Find the area of circle of diameter 82.

Sol. The forward difference table is as follows:


x y y 2 y 3 y 4 y
80 5026
648
85 5674 40
688 2
90 6362 38 4
726 2
95 7088 40
766
100 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:

r(r 1) 2 r(r 1)(r 2) 3


y(82) = y0 + ry0 + y0 + y0 +
2! 3!
0 4(0 4 1) 0 4(0 4 1)(0 4 2)
= 5026 + (0 4)(648) + (40) + (2)
2 6
0 4(0 4 1)(0 4 2)(0 4 3)
+ (4)
24
= 5280.1056sq. units.
Dr. Satish Shukla 12 of 33

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

Sol. We construct the cumulative table which is as follows:

Marks less than y y 2 y 3 y 4 y


(x)
40 31
42
50 73 9
51 25
60 124 16 37
35 12
70 159 4
31
80 190

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:

r(r 1) 2 r(r 1)(r 2) 3


y(45) = y0 + ry0 + y0 + y0 +
2! 3!
0 5(0 5 1) 0 5(0 5 1)(0 5 2)
= 31 + (0 5)(42) + (9) + (25)
2 6
0 5(0 5 1)(0 5 2)(0 5 3)
+ (37)
24
= 47.87
48.

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:

y(45) y(40) = 48 31 = 17.

Example 14. Find a polynomial which takes the following values:


x: 0 1 2 3
y: 1 2 1 10

Hence or otherwise, evaluate f (4).

Sol. The difference table for the given function is as follows:


Dr. Satish Shukla 13 of 33

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.

Now, putting x = 4 in the above formula for y = f (x) we obtain:

f (4) = 2(43 ) 7(42 ) + 6(4) + 1


= 41.

Example 15. Evaluate f (3.75) from the table given below:

x: 2.5 3 3.5 4 4.5 5


y: 24.145 22.043 22.225 18.644 17.262 16.047

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

Now by backward interpolation formula we have:

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

Sol. The difference table is given below:


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

Now use the forward interpolation for f (1.5) and backward interpolation for f (5.5).

Exercise (Assignment)

(Q.1) Find the missing term from the following table:

x: 2.0 2.1 2.2 2.3 2.4 2.5 2.6


y = f (x): 0.135 - 0.111 0.1000 - 0.082 0.074

Ans. f (2.1) = 0.123 and f (2.4) = 0.0904.

(Q.2) Fit a polynomial to the given data:


Dr. Satish Shukla 15 of 33

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

Ans. f (x) = x3 2x2 + 7x 3.


(Q.6) The pressure p of wind corresponding to velocity v is given by the following data.
Estimate p when v = 15:

v : 10 20 30 40
p : 1.1 2.0 4.4 7.9

Ans. p(15) = 1.325.


(Q.7) Find f (42) from the following data:

x : 20 25 30 35 40 45
f (x) : 354 332 291 260 231 204

Ans. f (42) = 219.

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

Therefore, the Newtons divided difference approximated polynomial will be:

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).

Thus, f (x) = 48 + 52(x 4) + 15(x 4)(x 5) + (x 4)(x 5)(x 7). (1)


Dr. Satish Shukla 17 of 33

Putting x = 8 in (1) we get


f (8) = 48 + 52(8 4) + 15(8 4)(8 5) + (8 4)(8 5)(8 7) = 448.
Similarly, f (9) = 648 and f (15) = 3150.

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).

Sol. Here x0 = 0, x1 = 1, x2 = 3, x3 = 5, x4 = 6, x5 = 9. Therefore, the points are


unequally spaced. We shall use the Newtons divided interpolation formula for the calcu-
lation of f (x). Then, the divided difference table is as follows:
x y 4
| f (x) | 2 f (x)
4 | 3 f (x)
4 | 4 f (x)
4 | 5 f (x)
4

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

Therefore, the Newtons divided difference approximated polynomial will be:

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

Therefore, by Newtons divided difference formula we have

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

Putting all the values we get:


(13.6 14.9)(13.6 14.1)(13.6 13.3)(13.6 12.5)
x = 30
(15.9 14.9)(15.9 14.1)(15.9 13.3)(15.9 12.5)
(13.6 15.9)(13.6 14.1)(13.6 13.3)(13.6 12.5)
+ 35
(14.9 15.9)(14.9 14.1)(14.9 13.3)(14.9 12.5)
(13.6 15.9)(13.6 14.9)(13.6 13.3)(13.6 13.6)
+ 40
(14.1 15.9)(14.1 14.9)(14.1 13.3)(14.1 13.6)
(13.6 15.9)(13.6 14.9)(13.6 14.1)(13.6 13.6)
+ 45
(13.3 15.9)(13.3 14.9)(13.3 14.1)(13.3 13.6)
(13.6 15.9)(13.6 14.9)(13.6 14.1)(13.6 13.6)
+ 50
(12.5 15.9)(12.5 14.9)(12.5 14.1)(12.5 13.6)
= 43.195.

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

Ans. f (x) = x2 + 30x + 648.


(Q.2) Given log(654) = 2.8156, log(658) = 2.8182, log(659) = 2.8189 and log(661) =
2.8202. Find log(656).
Ans. Use Lagranges interpolation formula log(656) = 2.8169.
(Q.3) Use Lagranges formula to find the value of f (9), where:

x : 5 7 11 13 17
f (x) : 150 392 1452 2366 5202

Ans. f (9) = 810.


(Q.4) Apply Lagranges formula and find the value of x when f (x) = 15

x : 5 6 9 11
y = f (x) : 12 13 14 16

Ans. Use Lagranges inverse interpolation formula x(15) = 9.125.

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

Sol. The difference table for the given values is as follows:

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

Since x = 1 is the initial point, we have


   
dy 1 1 2 1 3 1 4
= y0 y0 + y0 y0
dx x=x0 h 2 3 4
   
dy 1 1 1 1
= = 10.8 (3.3) + (2.3) (1.6) = 6.808.
dx x=1 2 2 3 4

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

Putting x = 4 in the above equations we get:


   2 
dy dy
= 252.8, = 27.33.
dx x=4 dx2 x=4

Example 24. Find the rate of change of

(i) Pressure (p) w. r. t. volume for v = 2.

(ii) Pressure w. r. t. volume for v = 3.

from the table given below:


v: 2 4 6 8 10
p: 105 42.7 25.3 16.7 13

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

x: 0.5 0.75 1.00 1.25 1.50


y: 0.3521 0.3011 0.2420 0.1827 0.1295

Ans. -0.17567
dy
(Q.2) Find at x = 1.5. from the following table:
dx

x: 1.5 2.0 2.5 3.0 3.5 4.0


y: 3.375 7.0 13.625 24.0 38.875 59.0

Ans. 4.75

(Q.3) Find f 0 (x) and f 00 (x) at x = 6 from the following table:

x: 4.5 5.0 5.5 6.0 6.5 6.5 7.0


f (x) : 9.65 12.90 16.71 21.18 ; 26.37 32.34 ; 39.15

Ans. f 0 (6) = 9.64 and f 00 (6) = 2.88.


dy d2 y
(Q.4) Find and 2 at x = 1.6 from the following table:
dx dx

x: 1.0 1.1 1.2 1.3 1.4 1.5 1.6


y: 7.989 8.403 8.781 9.129 ; 9.451 9.750 ; 10.031

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:

x: 1.70 1.74 1.78 1.82 1.86


sin x: 0.9916 0.9857 0.9781 0.9691 0.9584

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:

(i) The Trapezoidal Rule.


Zxn
h
f (x)dx = [(y0 + yn ) + 2(y1 + y2 + y3 + + yn1 )] .
2
x0

This rule is applicable for any no of intervals i.e., n = even or odd.

(ii) The Simplsons one-third rule.


Zxn
h
f (x)dx = [(y0 + yn ) + 4(y1 + y3 + ) + 2(y2 + y4 + )] .
3
x0

This rule is applicable for even no. of intervals only i.e., n, the no. of intervals =
even only.

(iii) The Simplsons three-eight rule.


Zxn
3h
f (x)dx = [(y0 + yn ) + 2(y3 + y6 + y9 + ) + 3(y1 + y2 + y4 + )] .
8
x0

This rule is applicable for n, the no. of intervals = multiple of three only.

(iv) The Weddles rule.


Zxn
3h
f (x)dx = [y0 + 5y1 + y2 + 6y3 + y4 + 5y5 + 2y6 + 5y7 + y8 + ] .
10
x0

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

Therefore, by Simpsons rule we have

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:

x: x0 = 0 x1 = 0.5 x2 = 1 x3 = 1.5 x4 = 2 x5 = 2.5


f (x) : y0 = 0.2 y1 = 0.14286 y2 = 0.11111 y3 = 0.09091 y4 = 0.07692 y5 = 0.06667
x: x6 = 3 x7 = 3.5 x8 = 4 x9 = 4.5 x10 = 5
f (x) : y6 = 0.05882 y7 = 0.05263 y8 = 0.04762 y9 = 0.04348 y10 = 0.04

Therefore, by Simpsons rule we have

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

Therefore, by Waddless rule we have


/2
Z 3h
cos d = [y0 + 5y1 + y2 + 6y3 + y4 + 5y5 + 2y6 ]
10
0

= [15.1408]
40
= 1.1892.

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

Find approximately the area of the cross-section of the river.

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

question. Therefore, by Simpsons rule we have:


h
s = [(v0 + v6 ) + 2(v2 + v4 ) + 4(v1 + v3 + v5 )]
3
2
= [(4 + 136) + 2(16 + 60) + 4(6 + 34 + 94)]
3
= 552 metres.
velocity v 6
Now acceleration a = = . Therefore, for t = 2 the acceleration a = = 3.
time t 2

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.

Ans. (i) 1.4108 (ii) 1.3662 (iii) 1.3571 (iv) 1.3735.


Dr. Satish Shukla 29 of 33

(Q.6) The following table gives the values of a function at equal intervals:

x: 0.0 0.5 1.0 1.5 2.0


f (x): 0.3989 0.3521 0.2420 0.1295 0.0540

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.

Approximation by Least Square Method

Suppose, y denotes a quantity which depends on another quantity x. Suppose, an explicit


relation between x and y is not known, but the value of y for some values of x are known
and given in the following table:
x: x1 x2 x3 x4 xn
y: y1 y2 y3 y4 yn

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

Suppose, we want to represent the relation between x and y by a linear relation

y = a + bx. (4)

The differences ei = yi (a + bxi ), i = 1, 2, . . . , n are called the error at point Pi . We


find the relation (4) in such a way that the total error E = e1 + e2 + + en becomes
minimum. Note that due to sign of error the total error may be less (ever zero sometimes)
than the actual error. To avoid such confusions we do not minimize the total error, but
we minimize the sum of squares of error, i.e., the total of square of error:
n
X n
X
E= e2i = [yi (a + bxi )]2
i=1 i=1
Dr. Satish Shukla 30 of 33

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

For notational convenience, write x instead xi and others we get:


X X
y = na + b x
X X X
xy = a x+b x2 .
Now a and b can be obtained by solving the above two equations.
Similarly, if we fit a quadratic polynomial or a parabola
y = a + bx + cx2
to the given data, then the values of a b and c are given by the following equations:
X X X
y = na + b x+c x2
X X X X
xy = a x+b x2 + c x3
X X X X
x2 y = a x2 + b x3 + c x4 .

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).

Example 30. Fit a straight line with the following data:

Year x : 1961 1971 1981 1991 2001


Production y : 8 10 12 10 16

And hence, find the expected production in the year 2006.

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

On putting the values with n = 5 in (6) we get:

56 = 5a + 0 b
16 = 0 a + 10b.

On solving a = 11.2 and b = 1.6. On putting


 thesevalues in (5), the straight line will be
x 1981
v = 11.2 + (1.6)u, i.e., y = 11.2 + (1.6) or
10

y = 305.76 + (0.16)x.

Putting x = 2006 we get the expected production in the year 2006

= (0.16)(2006) 305.76 = 15.2.

Example 31. Fit a second degree parabola to the following data:

x: 1 1.5 2.0 2.5 3.0 3.5 4


y: 1.1 1.3 1.6 2 2.7 3.4 4.1

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)

The value of a, b and c can be obtained by the following equations:


X X X
v = na + b u + c u2
X X X X
uv = a u + b u2 + c u3 (8)
X X X X
u2 v = a u2 + b u3 + c u4 .

The required values are given in the following table:


Dr. Satish Shukla 32 of 33

x v=y u = 2x 5 uv u2 v u2 u3 u4
1 1.1 -3 -3.3 9.9 9 -27 81

1.5 1.3 -2 -2.6 5.2 4 -8 16

2 1.6 -1 -1.6 1.6 1 -1 1

2.5 2 0 0 0 0 0 0

3 2.7 1 2.7 2.7 1 1 1

3.5 3.4 2 6.8 13.6 4 8 16

4 4.1 3 12.3 36.9 9 27 81

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

On putting these values with n = 7 in (8) we get:

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.,

y = 2.07 + (0.9428)(2x 5) + (0.06)(2x 5)2 .

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)

The value of a and b can be obtained by the following equations:


X X
v = nA + b u
X X X (10)
uv = A u + b u2 .

The required values are given in the following table:


Dr. Satish Shukla 33 of 33

x y u = ln x v = ln y uv u2
1 0.5 0 -0.6931 0 0

2 2 0.6931 0.6931 0.4804 0.4804

3 4.5 1.0986 1.5041 1.6524 1.2069

4 8 1.3863 2.0794 2.8826 1.9218

5 12.5 1.6094 2.5257 4.0648 2.5901

u2 = 6.1993
P P P P
Total u = 4.7874 v = 6.1092 uv = 9.0803

On putting the values with n = 5 in (6) we get:


6.1092 = 5A + 4.7874b
9.0803 = 4.7874A + 6.1993b.
On solving A = 0.6931 and b = 2. On putting these values in (5), the straight line will
be v = 0.6931 + 2u, i.e., ln y = 0.6931 + 2 ln x or

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

Ans. y = 2.25 2x + 0.75x2 .


(Q.3) Fit a second degree parabola for the table given below:

x : 1 2 3 4 5 6 7 8 9
y : 2 6 7 8 10 11 11 10 9

Hint: Put u = x 5, v = y 8. Ans. y = 0.267x2 + 3.52x 0.923.


(Q.4) Fit a curve of the type y = abx to the following data:

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.

Potrebbero piacerti anche