Unit V Numerical Methods II
Unit V Numerical Methods II
UNIT-V
NUMERICAL METHODS-II
Introduction:
Numerical analysis plays a great role in engineering and in the quantitative parts of pure and
applied science. Interpolation, the computing of values for a tabulated function at points not
in the table, is historically a most important task. Many famous mathematicians have their
names associated with procedures for interpolation: Gauss, Newton, Bessel, Stirling. The need
to interpolate began with the early studies of astronomy when the motion of heavenly bodies
was to be determined from periodic observations. Interpolation methods demonstrate some
important theory about polynomials and the accuracy of numerical methods. Interpolating
with polynomials serves as an excellent introduction to some techniques for drawing smooth
curves. These methods are the basis of many other procedures. Among these procedures, we
will focus on numerical differentiation and integration in this unit.
Interpolation and Extrapolation:
Interpolation is the technique of estimating the value of a function for any intermediate value of
the independent variable while the process of computing the value of the function outside the
given range is called Extrapolation.
Finite Differences:
The finite difference deals with the changes in the value of the function (dependent variable)
due to the changes in the values of independent variable. The values of the independent
variable x are called Arguments and the corresponding values of dependent variables y are
called Entries.
Forward difference:
If 𝑦0 , 𝑦1 , 𝑦2 ,…… 𝑦𝑛 denote the set of values of the function y=f(x).Then 𝑦0 =𝑦1 - 𝑦2 , 𝑦1 =𝑦2 -
𝑦1 ........., 𝑦𝑛−1 =𝑦𝑛 -𝑦𝑛−1 are called the First Forward Differences of the function y=f(x) where
∆ is called the forward difference operator. The differences are called first forward differences
denoted by 𝑦0 , 𝑦1 𝑦𝑛 second forward differences and are denoted by 𝑦0 ,
𝑦1 ,......, 𝑦𝑛−1 . i.e. 𝑦0 = 𝑦1 - 𝑦0 , 𝑦1 = 𝑦2 - 𝑦1 , ..., 𝑦𝑛−1 = 𝑦𝑛 - 𝑦𝑛−1
Similarly we can define third, fourth forward differences etc.
In general the nth forward differences is defined by the equation, ∆𝑛 𝑦𝑖 = ∆𝑛−1 𝑦𝑖+1 − ∆𝑛−1 𝑦𝑖
x y=f(x) ∆𝑦 ∆2 𝑦 ∆3 𝑦 ∆4 𝑦 ∆5 𝑦
𝑥0 𝑦0
Δ𝑦0
𝑥1 = 𝑥0 + ℎ 𝑦1 Δ2 𝑦0
Δ𝑦1 Δ3 𝑦0
𝑥2 = 𝑥0 + 2ℎ 𝑦2 2
Δ 𝑦1 Δ4 𝑦0
Δ𝑦2 3
Δ 𝑦1 Δ5 𝑦0
𝑥3 = 𝑥0 + 3ℎ 𝑦3 2
Δ 𝑦2 4
Δ 𝑦1
Δ𝑦3 3
Δ 𝑦2
𝑥4 = 𝑥0 + 4ℎ 𝑦4 Δ2 𝑦3
Δ𝑦4
𝑥5 = 𝑥0 + 5ℎ 𝑦5
Here 𝑦0 is called the First Entry and ∆𝑦0 , ∆2 𝑦0 , ∆3 𝑦0 ,...... ∆5 𝑦0 are called the Leading
Differences.
Backward Difference:
Consider the function y = f(x). If 𝑦0 , 𝑦1 , 𝑦2 ,...., 𝑦𝑛 denote the set of values of y.
Then ∇𝑦1=𝑦1− 𝑦0, ∇𝑦2 = 𝑦2 − 𝑦1 , .........,∇𝑦𝑛 = 𝑦𝑛 − 𝑦𝑛−1 are called the First Backward
Differences and is called the backward difference operator.
The second backward difference of the function is given by,
∇2 𝑦2 = ∇𝑦2 − ∇𝑦1, ∇2 𝑦3 = ∇𝑦3 − ∇𝑦2 , …….., ∇𝑛 𝑦𝑛 = ∇𝑦𝑛 − ∇𝑦𝑛−1
Similarly we can define higher order differences.
In general the nth backward difference is given by ∇𝑛 𝑦𝑖 = ∇𝑛−1 𝑦𝑖 − ∇𝑛−1 𝑦𝑖−1
x y=f(x) ∇𝑦 ∇2 𝑦 ∇3 𝑦 ∇4 𝑦 ∇5 𝑦
𝑥0 𝑦0
∇𝑦1
𝑥1 = 𝑥0 + ℎ 𝑦1 ∇2 𝑦2
∇𝑦2 ∇2 𝑦3
𝑥2 = 𝑥0 + 2ℎ 𝑦2 ∇2 𝑦3 ∇4 𝑦4
3
∇𝑦3 ∇ 𝑦4 ∇5 𝑦5
𝑥3 = 𝑥0 + 3ℎ 𝑦3 ∇2 𝑦4 ∇4 𝑦5
∇𝑦4 ∇3 𝑦5
𝑥4 = 𝑥0 + 4ℎ 𝑦4 ∇2 𝑦5
∇𝑦5
𝑥5 = 𝑥0 + 5ℎ 𝑦5
2. Evaluate cos 2x
cos 2x = {cos 2 (𝑥 + ℎ) − cos 2𝑥}
= cos 2 (x + h) − cos 2x
= [cos2(x + 2h) – cos 2 (x + h)] – [cos 2 (x + h) – cos 2x]
= - 2 sin (2x + 3h) sin h + 2 sin (2x + h) sin h
= - 2 sin h [sin (2x + 3h) – sin (2x + h)]
= - 2 sin h [2 cos (2x + 2h) sin h] = -4 sin2 h cos (2x + 2h)
Differences of a Polynomial:
The nth differences of a polynomial of the nth degree are constant and all higher order
differences are zero.
Let f(x) =𝑎0 𝑥 𝑛 + 𝑎1 𝑥 𝑛−1 +. . . +𝑎𝑛 , then
n f(x) = 𝑎0 n (n - 1) (n - 2) … 1. ℎ𝑛 =𝑎0 n! ℎ𝑛 ........………………….(1)
𝑛+1 𝑛+2
and then for higher orders ∆ 𝑓(𝑥)=∆ 𝑓(𝑥) = . . . = 0. …….……….(2)
Problems:
1. Evaluate 10 [(1 – ax) (1 – b𝑥 2 ) (1 – c𝑥 3 ) (1 – d𝑥 4 )] with h=1, h=2.
Solution: Given,
∆10 [(1 – ax) (1 – b𝑥 2 ) (1 – c𝑥 3 ) (1 – d𝑥 4 )] = ∆10 [abcd 𝑥10 + ( ) 𝑥 9 + ( ) 𝑥 8 + ......+1]
= abcd ∆10 (𝑥10 ) [∆10 (𝑥 𝑛 ) = 0 or n<10]
= abcd (10 !) (for h = 1)
10
Similarly for h =2, = abcd (10!) (2)
x 5 10 15 20 25 30
y 9962 9848 9659 9397 9063 8660
3. Construct the finite difference table for the function f(x) = 𝑥 3 +x+1 where x takes the values
0,1,2,3,4,5,6. Identify the leading forward and backward differences. Hence find ∆2 𝑦1, ∇3 𝑦5.
Solution:
x y First Second Third Fourth
difference difference difference difference
0 1
1 3
6
2 11
6
3 31
6
4 69
6
5 131
6 223
The leading forward differences are 2, 6, 6 and leading backward differences are 92, 30, 6.
∆2 𝑦1 = 12, ∇3 𝑦5 = 6 .
Note: Third differences are constants and higher order differences are zero as f(x) is a
polynomial of third degree.
Remark:
Newton’s Forward Interpolation Formula is used to interpolate the values of y near the
beginning of the set of tabulated values or for extrapolating values of y to the left of the
beginning. Newton’s Backward Interpolation Formula is used to interpolate the values of y
near the end of the set of tabulated values or for extrapolating values of y to the right of the last
tabulated value y.
x 0 1 2 3
f(x) 1 2 1 10
𝑥−𝑥0 𝑥−0
Here, 𝑥0 = 0, h = 1, p= = = x, ∆𝑦0 =1, ∆2 𝑦0 = -2, ∆3 𝑦0 =12,
ℎ 1
𝑥(𝑥−1) 𝑥(𝑥−1)(𝑥−2)
f(x) = 1+x(1)++ (-2)+ (12) = 2x3 – 7x2 + 6x +1 is the required polynomial.
2! 3!
2. The table gives the distance in nautical miles of the visible horizon for the given heights
in feet above the earth’s surface.
Solution:
3. From the following table, estimate the number of students who obtained marks between 40 and
45:
No. of students(y): 31 42 51 35 31
To find y(45) i.e. number of students with marks less than 45.
𝑥−𝑥0 5
Taking 𝑥0 = 40, x=45, h=10, p = ℎ
= 10 = 0.5
= 47.87
Exercise:
1. Fit a cubic polynomial to the following data using suitable interpolation formula.
x 0 1 2 3
f(x) -2 2 12 34
2. Using Newton-Gregory Interpolation formulae, estimate f (0.12) from the following data.
3. Apply Newton’s backward difference interpolation formula to find f(7.5) from the
following table:
x 1 2 3 4 5 6 7 8
f(x) 1 8 27 64 125 216 343 512
4. Using Newton -Gregory Interpolation formulae, find tan170 from the following data.
x 0 4 8 12 16 20 24
f(x) 0 0.0699 0.1405 0.2126 0.2867 0.3640 0.4452
Second Semester 7 Vector calculus and computational methods (22MA21B)
Department of Mathematics
Inverse interpolation:
The process of estimating the value of x for a given value of y is called Inverse interpolation.
So far given a table of values of x and y, using one of the interpolation formulae we find the value
of y corresponding to some value of x which is not in the table. On the other hand the process of
estimating the value of x for some value of y which is not in the table is called inverse interpolation.
This method is used when the values of x are not necessarily equally spaced. Lagrange’s
interpolation formula can be simply viewed as a relation between two variables and any one of the
variable can be taken as an independent variable. Therefore inverse interpolation formula can be
obtained by interchanging the variables x and y in Lagrange’s formula, we get.
Problems:
1. By using the Lagrange’s interpolation formula to fit a polynomial to the data given
x 0 1 3 4
y -12 0 6 12
= 2-12+20+64 = 74
But actual values of f(5) and f(6) are f(5) = 25 = 32 and f(6) = 26 = 64.
The difference in values of f(5) and f(6) are due to the assumption of f(x) as a polynomial,
when it is an exponential function of the form 2𝑥 .
3. Find x for y = 7
x 1 3 4
y 4 12 19
Solution:
𝑥0 =1 𝑥1 =3 𝑥2 =4, 𝑦0 = 4 𝑦1 = 12 𝑦2 = 14
(𝑦−𝑦1 )(𝑦−𝑦2 ) (𝑦−𝑦0 )(𝑦−𝑦2 ) (𝑦−𝑦0 )(𝑦−𝑦1 )
x = (𝑦 𝑥0 + (𝑦 𝑥1 + 𝑥2
0 −𝑦1 )(𝑦0 −𝑦2 ) 1 −𝑦0 )(𝑦1 −𝑦2 ) (𝑦2 −𝑦0 )(𝑦2 −𝑦1 )
at y=7
60 108 60
x = 120 + - 105
56
= 1.85714
Numerical Differentiation:
Let the function y = f(x) is given by a table of values (x , y) then the process of computing the
𝑑𝑦 𝑑 2 𝑦
derivatives 𝑑𝑥 , 𝑑𝑥 2 etc. for some particular value of x is called Numerical Differentiation.
Derivatives using Newton’s forward interpolation formula:
𝑥− 𝑥0
where, x = 𝑥0 + Ph (or) P = ………. (2)
ℎ
Formula (5) is used to compute 𝑦 ′ at any point x =𝑥0 + Ph , whereas formula (6) is used to
compute 𝑦 ′ at any of the value of x when y is specified.
Similarly,
𝑑2 𝑦 1 (6𝑃2 −18𝑃+11)
(𝑑𝑥 2 )𝑥=𝑥0+𝑃ℎ =ℎ2 [∆𝑦0 + (𝑃 − 1)∆3 𝑦0 + ∆4 𝑦0 + ⋯ ] …. (7)
12
𝑑2𝑦 1 11 5
and(𝑑𝑥 2)𝑥=𝑥0 = ℎ2 [∆2 𝑦0 − ∆3 𝑦0 + 12
∆4 𝑦0 − 6 ∆5 𝑦0 + ⋯ ] …. (8)
𝑃 𝑃 (𝑃+1) 𝑃 (𝑃+1)(𝑃+2)
y = 𝑦𝑛 + 1! ∇𝑦𝑛 + 2!
∇2 𝑦𝑛 + 3!
∇3 𝑦𝑛 + …… ……… (1)
𝑥−𝑥𝑛
Where, x = 𝑥𝑛 + Ph (or) P = ……… (2)
ℎ
Formula (5) is used to compute y ' at any point x =𝑥𝑛 + Ph whereas formula (6) is used to
compute 𝑦 ′ at any of the values of x when y is specified.
Similarly
𝑑2 𝑦 1 (6𝑃2 +18𝑃+11)
(𝑑𝑥 2 )𝑥= 𝑥𝑛+𝑃ℎ = ℎ2 [𝛻 2 𝑦𝑛 + (𝑃 + 1)𝛻 3 𝑦𝑛 + 12
𝛻 4 𝑦𝑛 + ⋯ ] …. (7)
𝑑2 𝑦 1 11 5 137
(𝑑𝑥 2 )𝑥=𝑥𝑛 = ℎ2 [𝛻 2 𝑦𝑛 + 𝛻 3 𝑦𝑛 + 12
𝛻 4 𝑦𝑛 + 6 𝛻 5 𝑦𝑛 + 180 𝛻 6 𝑦𝑛 + ⋯ ] …. (8)
The formula (7) is used to compute y'' at any point x =𝑥𝑛 + P h whereas formula (8) is used to
compute y'' at any of the values of x when y is specified.
Problems:
1. Given
x 1.0 1.2 1.4 1.6 1.8 2.0
y 2.72 3.32 4.06 4.96 6.05 7.39
1.0 2.27
0.60
1.2 3.32 0.14
0.74 0.02
1.4 4.06 0.16 0.01
0.90 0.03
1.6 4.96 0.19 0.03
1.09 0.06
1.8 6.05 0.25
1.34
2.0 7.39
We have to compute 𝑦 ′ and 𝑦 ′′ at x = 1.2, which is a specified value of x, for this purpose, we
take 𝑥0 = 1.2. Then we find from the table that,
𝑑𝑦 1 1 1 1
Then, (𝑑𝑥 ) = [(0.74) − (0.16) + (0.03) − (0.03)] = 3.3125
(1.2) (0.2) 2 3 4
𝑑2 𝑦 1 11
And (𝑑𝑥 2 )(1.2) = [(0.16) − (0.03) + (0.03)] = 3.39375
(0.2)2 12
2. Using appropriate interpolation formulas, find the values of 𝑦 ′ 𝑎𝑛𝑑 𝑦 ′′ when x = 4 using the
following table.
x 1 2 3 4
y 4 12 20 36
Solution: Here x = 4 is a specified value of x which is at the end of the given table.
For this purpose we take 𝑥𝑛 = 4.
The difference table is given by,
1 4
8
2 12 0
8 8
3 20 8
16
4 36
8
= 16+4+ 3 = 22.667
1 1 1
And 𝑦 ′′ (4) = [ (∇2 𝑦𝑛 ) + (∇3 𝑦𝑛 )] = [8 + 8] = 16
ℎ2 2 12
3. A rod is rotating in a plane, the following table gives the angle θ (in radians) through which the
rod is turned for various values of time t (in seconds): Find the angular velocity and angular
acceleration at t = 0.4 sec.
Solution: Given
0 0
0.12
0.2 0.12 0.25
0.37 0.01
0.4 0.49 0.26 0.00
0.63 0.01
0.6 1.12 0.27 0.00
0.90 0.01
0.8 2.02 0.28 0.00
1.18 0.01
1.0 3.20 0.29
1.47
1.2 4.67
To compute (dθ/dt) and (d2θ/dt2) at t = 0.4 sec, which is specified value of t. We take t0 = 0.4
∆θ0 = 0.63, ∆2θ0 = 0.21, ∆3θ0 = 0.01, ∆4θ0 = 0.00
Using the formula,
𝑑𝜃 1 1 1 1
( 𝑑𝑡 )𝑥=𝑥0 = [∆𝑦0 − ∆2 𝑦0 + ∆3 𝑦0 − ∆4 𝑦0 + ⋯ ]
ℎ 2 3 4
𝑑𝜃 1 1 1
( 𝑑𝑡 ) = [(0.63) − (0.27) + (0.01)] = 2.49
(0.4) 0.2 2 3
4. The following table gives the temperature θ (in degree Celsius) of a cooling body at different
T 1 3 5 7 9
T 𝜃 θ θ θ θ
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
P = (t –𝑡4 ) / h = -0.5
1. Given that,
𝑑𝑦 𝑑2 𝑦
Find , at x = 1.1 and x = 1.6.
𝑑𝑥 𝑑𝑥 2
2. A slider in a machine moves along a fixed straight rod. Its distance x cm along the rod is
given below for various values of the time ‘t’ seconds. Find the velocity of the slider and its
acceleration when t = 0.1 second.
t 0 1.0 1.2 1.4 1.6 1.8 2.0
x 30.13 31.62 32.87 33.64 33.95 33.81 33.24
𝑑𝑥 𝑑2 𝑦
3. Find 𝑑𝑦 and at x =1.1 of the function tabulated below:
𝑑𝑥 2
x 0 1 2 3 4 5
y 4 8 15 7 6 2
5. Find 𝑓 ′ (1.5) using the differentiation formula based on Newton’s interpolation for the
following data:
x 1 2 3 4 5 6
f(x) 4 9 16 25 36 49
3. Weddle’s rule:
By taking n = 6 in the general Quadrature formula
0𝑥 +𝑛ℎ 3ℎ
∫𝑥0 𝑓(𝑥) 𝑑𝑥 = 10 [(𝑦0 + 𝑦𝑛 ) + 5(𝑦1 + 𝑦5 + ⋯ + 𝑦𝑛−5 + 𝑦𝑛−1 ) + (𝑦2 + 𝑦4 + ⋯ +
𝑦𝑛−4 + 𝑦𝑛−2 ) + 2(𝑦6 + 𝑦12 + ⋯ + 𝑦𝑛−6 ) + 6(𝑦3 + 𝑦9 + ⋯ + 𝑦𝑛−3 )]
5.2
2. Calculate ∫4 logx dx using (a) Simpson’s 1/3rd rule (b) Simpson’s 3/8th rule (c)
Weddle’s rule.
Solution:
Dividing the interval (0, 6) into six equal parts of width h = 6−0
6
=1
x 0 1 2 3 4 5 6
f(x) 1 0.5 0.2 0.1 0.0588 0.0385 0.027
Exercise:
5 𝑑𝑥
1. By using Simpson’s 1/3rd rule evaluate ∫0 4𝑥+5 by dividing range into 10 equal parts.
Hence find an approximate value of log5.
2
2. By Simpson’s 1/3 rule evaluate ∫0 𝑓(𝑥)𝑑𝑥, given
3. The following tables gives six values of an independent variable x and the corresponding
values of y
x 0.0 1 2 3 4 5 6
f(x) 0.46 0.161 0.176 0.190 0.204 0.217 0.230