0% found this document useful (0 votes)
31 views19 pages

Unit V Notes Numerical Methods II 2

This document discusses numerical methods, particularly focusing on interpolation and finite differences, which are essential in engineering and applied sciences. It explains concepts such as forward and backward differences, their tables, and provides examples of evaluating differences of functions. Additionally, it introduces Newton's Forward and Backward Interpolation formulas for estimating function values at specific points.

Uploaded by

Aarsh Bajaj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
31 views19 pages

Unit V Notes Numerical Methods II 2

This document discusses numerical methods, particularly focusing on interpolation and finite differences, which are essential in engineering and applied sciences. It explains concepts such as forward and backward differences, their tables, and provides examples of evaluating differences of functions. Additionally, it introduces Newton's Forward and Backward Interpolation formulas for estimating function values at specific points.

Uploaded by

Aarsh Bajaj
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 19

Department of Mathematics

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:


Interpolationis 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 nthforward differences is defined by the equation, ∆𝑛 𝑦𝑖 = ∆𝑛−1 𝑦𝑖+1 − ∆𝑛−1 𝑦𝑖

Second Semester Differential Equations and Numerical Methods(21MA21)


Department of Mathematics

Forward Difference Table:

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

Backward Difference Table:

x y=f(x) ∇𝑦 ∇2 𝑦 ∇3 𝑦 ∇4 𝑦 ∇5 𝑦
𝑥0 𝑦0   

𝑥1 = 𝑥0 + ℎ 𝑦1
∇𝑦1
∇2 𝑦2   
∇𝑦2  ∇2 𝑦3  
𝑥2 = 𝑥0 + 2ℎ 𝑦2 ∇2 𝑦3  ∇4 𝑦4  
∇𝑦3   ∇ 𝑦4 
3
 ∇5 𝑦5
𝑥3 = 𝑥0 + 3ℎ 𝑦3  ∇2 𝑦4 
∇4 𝑦5
∇𝑦4   ∇3 𝑦5
𝑥4 = 𝑥0 + 4ℎ 𝑦4  ∇2 𝑦5
∇𝑦5
𝑥5 = 𝑥0 + 5ℎ 𝑦5

NOTE: Only the notations are changed not the differences.


(i) Relation between forward and backward operators: ∆𝑛 𝑦𝑟 = ∇𝑛 𝑦𝑛+𝑟
(ii) f(x) = f(x+h) – f(x)

Second Semester Differential Equations and Numerical Methods(21MA21)


Department of Mathematics
(iii) f(x) = f(x) – f(x – h)
Problems:
1. Evaluate tan-1 x
Solution:tan-1 x = tan-1 (x + h) – tan-1 x
𝑥+ℎ−𝑥 ℎ
= tan-1 {1+(𝑥+ℎ)𝑥} =tan-1 {1+ℎ𝑥+𝑥 2}

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 nthdifferences 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)
and then for higher orders ∆𝑛+1 𝑓(𝑥)=∆𝑛+2 𝑓(𝑥 ) = . . . = 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)

2. Construct the forward difference table, given that

x 5 10 15 20 25 30
y 9962 9848 9659 9397 9063 8660

and find the values of∆2 𝑦10 , ∆3 𝑦5 , ∆4 𝑦5 .


Solution:
x y ∆𝑦 ∆2 𝑦 ∆3 𝑦 ∆4 𝑦
5 9962
  
10 9848
  
15 9659 
 
20 9397  
 
25 9063

30 8660  

Second Semester Differential Equations and Numerical Methods(21MA21)


Department of Mathematics

Now ∆2 𝑦10 = - 73 which is second element for the column∆2 𝑦.


∆3 𝑦5 = 2 which is the first element of the column ∆3 𝑦.Similarly ∆4 𝑦5 = - 1.

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.

Interpolation with equal intervals:


Newton’s Forward Interpolation Formula:
Let the function y = f(x) takes the values𝑦0, 𝑦1 ......., 𝑦𝑛 at the points𝑥0 , 𝑥1 .......,𝑥𝑛 where𝑥𝑖 =
𝑥0 + ih. Then Newton’s Forward Interpolation polynomial is given by,
𝑝(𝑝−1) 𝑝(𝑝−1)(𝑝−2) 𝑝(𝑝−1)……..(𝑝−𝑛−1)
𝑦𝑝 = f(x) = 𝑦0 + 𝑝∆y0 + ∆2 y0 + ∆3 y0 +........... ∆𝑛 𝑦0 ,
2! 3! 𝑛!
where x= 𝑥0 + ph

Newton’s Backward Interpolation Formula:


Let the function y = f(x) takes the values𝑦0 , 𝑦1, .......,𝑦𝑛 at the points 𝑥0 , 𝑥1 ......., 𝑥𝑛 ,

where 𝑥𝑖 = 𝑥0 + 𝑖ℎ. The Newton’s Backward Interpolation polynomial is given by,


𝑝(𝑝+1) 𝑝(𝑝+1)(𝑝+2) 𝑝(𝑝+1)……..(𝑝+𝑛−1)
𝑦𝑝 = f(x) = 𝑦𝑛 + p∇𝑦𝑛 + ∇2 𝑦𝑛 + ∇3 𝑦𝑛 +........... ∇𝑛 𝑦𝑛 ,
2! 3! 𝑛!
where𝑥 = 𝑥𝑛 + 𝑝ℎ

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.

Second Semester Differential Equations and Numerical Methods(21MA21)


Department of Mathematics

Examples:
1. Find a cubic polynomial which takes the following data

x 0 1 2 3
f(x) 1 2 1 10

Solution: The forward difference table is given by,


x y = f(x) ∆𝑦 ∆2 𝑦 ∆3 𝑦
0 1
1
1 2 -2
-1 12
2 1 10
9
3 10

𝑥−𝑥0 𝑥−0
Here, 𝑥0 = 0, h = 1, p= = = x, ∆𝑦0 =1,∆2 𝑦0 = -2, ∆3 𝑦0 =12,
ℎ 1

By Newton-Gregory forward interpolation formula we have

𝑝(𝑝−1) 𝑝(𝑝−1)(𝑝−2)
f(x) = y0 + p𝑦0 + ∆𝑦0 + ∆𝑦0 + ......
2! 3!

𝑥(𝑥−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.

x=height: 100 150 200 250 300 350 400

y=distance: 10.63 13.03 15.04 16.81 18.42 19.90 21.27

Find the values of y when x=160ft and x=410ft.

Solution:

The difference table is

Second Semester Differential Equations and Numerical Methods(21MA21)


Department of Mathematics

x y First Second Thirddiffe Fourth


difference difference rence difference
100 10.63
2.40
150 13.03 -0.39
2.01 0.15
200 15.04 -0.24 -0.07
1.77 0.08
250 16.81 -0.16 -0.05
1.61 0.03
300 18.42 -0.13 -0.01
1.48 0.02
350 19.90 -0.11
1.37
400 21.27

(i) 𝑥0=160, 𝑦0 =13.03,∆𝑦0 =2.01, ∆2 𝑦0 = -0.24, ∆3 𝑦0 =0.08,∆4 𝑦0 =-0.05 , h=50


𝑥−𝑥0 10
𝑝= ℎ
= 50
=0.2

Using Newton’s forward interpolation formula we get


𝑝(𝑝−1) 𝑝(𝑝−1)(𝑝−2)
f(160) =𝑦0 + p∆𝑦0 + ∆2 𝑦0 + ∆3 𝑦0 +…….
2! 3!

f(160)=13.03+0.402+0.0192+0.00384+0.00168

=13.46 nautical miles.

(ii) x=410,𝑥𝑛 =400,𝑦𝑛 =21.27,∇𝑦𝑛 =1.37,∇2 𝑦𝑛 =-0.11,∇3 𝑦𝑛 =0.02,h=50


𝑥−𝑥𝑛 10
𝑝= ℎ
= 50
=0.2

Using Newton’s backward interpolation formula we get,

𝑝(𝑝+1) 𝑝(𝑝+1)(𝑝+2)
f(410) = 𝑦𝑛 + p∇𝑦𝑛 + ∇2 𝑦𝑛 + ∇3 𝑦𝑛 …….
2! 3!

0.2(1.2)
f(410)=21.27+0.2(1.37)+ 2
(-0.11)+…………….

=21.53 nautical miles.

3. From the following table, estimate the number of students who obtained marks between 40 and
45:

Marks (x): 30-40 40-50 50-60 60-70 70-80

No. of students(y): 31 42 51 35 31

Second Semester Differential Equations and Numerical Methods(21MA21)


Department of Mathematics
Solution: we prepare cumulative frequency table as follows:

Marks less than(x): 40 50 60 70 80

No. of students(y): 31 73 124 159 190

Solution:Now the difference table is:

x y y y y y


40 31 
 
50 73 
 
60 124  

70 159  

80 190

To find y(45) i.e. number of students with marks less than 45.
𝑥−𝑥0 5
Taking𝑥0 = 40, x=45, h=10, p = = = 0.5
ℎ 10

Using Newton’s Forward Interpolation formula we get,


𝑝(𝑝−1) 𝑝(𝑝−1)(𝑝−2)
y(45) = 𝑦40 + 𝑝∆𝑦40 + 2
∆2 𝑦40 + 6
∆3 𝑦40 + ⋯ … … … … …

0.5(−0.5) 0.5(0.5)(−1.5) 0.5(−0.5)(−1.5)(−2.5)


=31+0.5(42)+ 2
(9)+ 6
(-25)+ 24
(37)

= 47.87

The number of students with marks less than 45 is 47.87 ≅48.

But the number of students with marks less than 40 is 31.

Hence the number of students getting marks between 40 and 45 =48-31=17.

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.

x 0.10 0.15 0.20 0.25 0.30


f(x) 0.1003 0.1511 0.2027 0.2553 0.3093

3. Apply Newton’s backward difference interpolation formula to find f(7.5) from the
following table:

Second Semester Differential Equations and Numerical Methods(21MA21)


Department of Mathematics
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

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 , etc. for some particular value of x is called Numerical Differentiation.
𝑑𝑥 𝑑𝑥 2

Derivatives using Newton’s forward interpolation formula:

By Newton’s Interpolation Formula, we have


𝑃 (𝑃−1) 𝑃 (𝑃−1)(𝑃−2)
y = 𝑦0 + P∆𝑦0 + 2!
∆2 𝑦0 + 3!
∆3 𝑦0+ ……….. (1)

𝑥− 𝑥0
where, x = 𝑥0 + Ph (or) P= ………. (2)

Differentiating (1) w.r.t. P, we get

𝑑𝑦 (2𝑃−1) 3𝑃2 +6𝑃+2 (4𝑃3 −18𝑃2 +22𝑃−6)


𝑑𝑃
= ∆𝑦0+ 2!
∆2 𝑦0+ 3!
∆3 𝑦0 + 4!
∆4 𝑦0 + ……. (3)

Differentiating (2) w.r.t. x, we get


𝑑𝑃 1 𝑑𝑦 𝑑𝑦 𝑑𝑃
𝑑𝑥
= ℎ……….. (4) But, 𝑑𝑥 = 𝑑𝑃 . 𝑑𝑥

Using (3) and (4) the above equation becomes,

𝑑𝑦 1 (2𝑃−1) (3𝑃2 −6𝑃+2) (4𝑃3−18𝑃2 +22𝑃−6)


(𝑑𝑥 )𝑥=𝑥0+𝑃ℎ =ℎ [∆𝑦0 + 2!
∆2 𝑦0 + 3!
∆3 𝑦0 + 4!
∆4 𝑦0 + ⋯ ] …. (5)

At x =𝑥0 , P= 0, the above equation becomes,


𝑑𝑥 1 1 1 1
(𝑑𝑦)𝑥=𝑥0 =ℎ [∆𝑦0 − 2
∆2 𝑦0 + 3
∆3 𝑦0 − 4
∆4 𝑦0 + ⋯ ] …. (6)

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

Second Semester Differential Equations and Numerical Methods(21MA21)


Department of Mathematics
𝑑2 𝑦 1 11 5
and(𝑑𝑥 2)𝑥=𝑥0 =ℎ 2 [∆2 𝑦0 − ∆3 𝑦0 + 12
∆4 𝑦0 − 6 ∆5 𝑦0 + ⋯ ] …. (8)

The formula (7) is used to compute y'' at any point x = 𝑥0+Phwhereas formula (8) is used to
compute y'' at any value of x where y is specified.

Derivatives using Newton’s backward interpolation formula:


By Newton’s Backward Interpolation Formula, we have

𝑃 𝑃 (𝑃+1) 𝑃 (𝑃+1)(𝑃+2)
y = 𝑦𝑛 + 1! ∇𝑦𝑛 + 2!
∇2 𝑦𝑛 + 3!
∇3 𝑦𝑛 + …… ……… (1)

𝑥−𝑥𝑛
Where, x = 𝑥𝑛 + Ph (or) P = ……… (2)

Differentiating (1) w.r.t. P, we get

𝑑𝑦 (2𝑃+1) (3𝑃2+6𝑃+2)
𝑑𝑃
= ∇𝑦𝑛 + 2!
∇2 𝑦𝑛 + 3!
∇3 𝑦𝑛+ …… ……… (3)

Differentiating (2) w.r.t. x, we get


𝑑𝑃 1 𝑑𝑦 𝑑𝑦 𝑑𝑃
𝑑𝑥
= ℎ …. (4) But, 𝑑𝑥 = 𝑑𝑃 . 𝑑𝑥

Using (3) and (4) the above equation becomes,

𝑑𝑦 1 (2𝑃+1) (3𝑃2 +6𝑃+2)


(𝑑𝑥 )𝑥=𝑥𝑛+𝑃ℎ =ℎ [𝛻𝑦𝑛 + 2!
𝛻 2 𝑦𝑛 + 3!
𝛻 3 𝑦𝑛 + … ] …. (5)

At x =𝑥𝑛 , P = 0, the above equation becomes,


𝑑𝑦 1 1 1 1
(𝑑𝑥 )𝑥=𝑥𝑛 =ℎ [𝛻𝑦𝑛 + 2
𝛻 2 𝑦𝑛 + 3
𝛻 3 𝑦𝑛 + 4
𝛻 4 𝑦𝑛 + ⋯ ] …. (6)

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 𝑦𝑛 + 𝛻 3 𝑦𝑛 + 𝛻 4 𝑦𝑛 + 𝛻 5 𝑦𝑛 + 𝛻 6 𝑦𝑛 + ⋯ ] …. (8)
𝑑𝑥 2 𝑥=𝑥𝑛 ℎ 12 6 180

The formula (7) is used to compute y'' at any point x = 𝑥𝑛 +Ph whereas formula (8) is used
tocompute y'' at any of the values of x when y is specified.

Second Semester Differential Equations and Numerical Methods(21MA21)


Department of Mathematics
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

Find 𝑦 ′ and 𝑦 ′′ at x = 1.2.

Solution: Here, the step-length is h = 0.2. We first form the following difference table.

first Second Third Fourth


x y differences differences differences differences

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,

∆𝑦0 = 0.74, ∆2 𝑦0 = 0.16, ∆3 𝑦0 = 0.03, ∆4 𝑦0 = 0.03


Using the formula we have,
𝑑𝑥 1 1 1 1
(𝑑𝑦 )𝑥=𝑥0 =ℎ [∆𝑦0 − ∆2 𝑦0 + ∆3 𝑦0 − ∆4 𝑦0 + ⋯ ]
2 3 4

𝑑𝑦 1 1 1 1
Then, (𝑑𝑥 ) = [(0.74) − (0.16) + (0.03) − (0.03)] = 3.3125
(1.2) (0.2) 2 3 4

Using the formula we have,


𝑑2 𝑦 1 11 5
(𝑑𝑥 2 )𝑥=𝑥0 =ℎ2 [∆2 𝑦0 − ∆3 𝑦0 + ∆4 𝑦0 − 6 ∆5 𝑦0 + ⋯ ]
12

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

First Second Third


x y differences differences differences

Second Semester Differential Equations and Numerical Methods(21MA21)


Department of Mathematics
1 4
8
2 12 0
8 8
3 20 8
16
4 36

Here 𝑥𝑛 = 4, 𝛻𝑦𝑛 = 16,𝛻 2 𝑦𝑛 = 8, 𝛻 3 𝑦𝑛 = 8 and h=1


1 1 1 1 1 1
Then, 𝑦 ′ (4) = [(∇𝑦𝑛 ) + (∇2 𝑦𝑛 ) + (∇3 𝑦𝑛 )] = [16 + ( 8) + ( 8)]
ℎ 2 3 1 2 3

8
= 16+4+ = 22.667
3

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

t 0 0.2 0.4 0.6 0.8 1.0 1.2

𝜃 0 0.12 0.49 1.12 2.02 3.20 4.67

To compute velocity = dθ/dt and Acceleration = d2θ/dt2 at t = 0.4sec


The finite difference table is given by

First second Third Fourth


x 𝜃 differences differences differences differences

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 t 0 = 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

Second Semester Differential Equations and Numerical Methods(21MA21)


Department of Mathematics
𝑑𝜃 1 1 1
( 𝑑𝑡 ) = [(0.63) − (0.27) + (0.01)] = 2.49
(0.4) 0.2 2 3

And using the formula,

𝑑2 𝜃 1 11 5
( 𝑑𝑡 2 )𝑥=𝑥0 =ℎ2 [∆2 𝑦0 − ∆3 𝑦0 + ∆4 𝑦0 − 6 ∆5 𝑦0 + ⋯ ]
12

𝑑2𝜃 1
( 2
) = [(0.27) − 0.01] = 6.5
𝑑𝑡 (0.4) (0.2)

4. The following table gives the temperature θ (in degree Celsius) of a cooling body at different

instants of time t (in seconds)

T 1 3 5 7 9

𝜃 85.3 74.5 67.0 60.5 54.3

Find approximately the rate of cooling at t = 8 seconds.

Solution: Rate of cooling = dθ/dt

The backward difference table is given by,

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

Here, to compute dθ/dt at t = 8 sec., which is not the specified value of t

We have, 𝑡𝑛 = 𝑡4 = 9, 𝜃𝑛 =𝜃4 = 54.3

∇𝜃4 = -6.2, ∇2 𝜃4 = 0.3, ∇3 𝜃4 = -0.7,∇4 𝜃4 = 1.6

P = (t –𝑡4 ) / h = -0.5

Using the formula, we have


𝑑𝑦 1 2𝑝+1 3𝑝2 +6𝑝+2 4𝑝3 +18𝑝2 +22𝑝+6
(𝑑𝑥 )𝑥=𝑥𝑛 =ℎ [𝛻𝑦𝑛 + 2!
𝛻 2 𝑦𝑛 + 3!
𝛻 3 𝑦𝑛 + 4!
𝛻 4 𝑦𝑛 + ⋯ ]

Second Semester Differential Equations and Numerical Methods(21MA21)


Department of Mathematics
2
𝑑𝜃 1 2(−.05) + 1 3(−0.5) + 6(. 5) + 2
( ) = [−6.2 + (0.3) + (−0.7)
𝑑𝑡 (𝑡=8) 2 2 6
4(−0.5)3 + 18(−0.5)2 + 22(−.05) + 6
+ (1.6)]
24
1
= [−6.2 + 0 + 0.029166 − 0.066666] = −3.11875
2
Thus the body cools at the rate of 3.11875 degree/second.

Exercise:

1. Given that,

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

𝑑𝑦 𝑑2 𝑦
Find𝑑𝑥 , 𝑑𝑥 2 at x = 1.1 and x = 1.6.

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 1.0 1.2 1.4 1.6 1/8 2.0


f(x) 0 0.128 -.544 1.296 2.432 4.00

4. Compute 𝑦 ′ (0) and 𝑦 ′′ (0) from the following table:

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

Second Semester Differential Equations and Numerical Methods(21MA21)


Department of Mathematics

Interpolation with unequal intervals

Lagrange’s formula for unequal intervals:


Let y = f(x) be a function whose values are 𝑦0 , 𝑦1 , 𝑦2 ,......., 𝑦𝑛 corresponding to 𝑥0 ,
𝑥1 , 𝑥2 ,......., 𝑥𝑛 not necessarily equally spaced.

(𝑥−𝑥1 )(𝑥−𝑥2 )………..(𝑥−𝑥𝑛 ) (𝑥−𝑥0 )(𝑥−𝑥2 )…………(𝑥−𝑥𝑛 )


y or f (x) = (𝑥 𝑦0 + (𝑥 𝑦1 +
0 −𝑥1)(𝑥0−𝑥2 )………(𝑥0 −𝑥𝑛 ) 1−𝑥0 )(𝑥1−𝑥2 )……….(𝑥1 −𝑥𝑛 )

(𝑥−𝑥0 )(𝑥−𝑥1)……….(𝑥−𝑥𝑛−1 )
……..+(𝑥 𝑦𝑛
𝑛 −𝑥0)(𝑥𝑛 −𝑥1)………..(𝑥𝑛 −𝑥𝑛−1 )

This formulais known asLagrange’sInterpolation formula.

Inverseinterpolation:
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.

(𝑦−𝑦1 )(𝑦−𝑦2 )………….(𝑦−𝑦𝑛 ) (𝑦−𝑦0 )(𝑦−𝑦2 )……..(𝑦−𝑦𝑛 )


x = (𝑦 𝑥 +
) 0
𝑥
(𝑦1 −𝑦0 )(𝑦1 −𝑦2 )………..(𝑦1 −𝑦𝑛 ) 1
+
0 −𝑦1 )(𝑦0 −𝑦2 )……….(𝑦0 −𝑦𝑛

(𝑦−𝑦0 )(𝑦−𝑦1 )………(𝑦−𝑦𝑛−1 )


…….+(𝑦 𝑥𝑛
𝑛 −𝑦0 )(𝑦𝑛 −𝑦1 )……..(𝑦𝑛 −𝑦𝑛−1 )

Problems:
1.ByusingtheLagrange’s interpolation formula to fit a polynomial to the data given

Second Semester Differential Equations and Numerical Methods(21MA21)


Department of Mathematics
x 0 1 3 4
y -12 0 6 12

Hence, find y when x = 2


Solution:
𝑥0 = 0 𝑥1 = 1 𝑥2 = 3 𝑥3 = 4
𝑦0 = −12 𝑦1 = 0 𝑦2 = 6 𝑦2 = 12
By Lagrange’s formula
(𝑥−1)(𝑥−3)(𝑥−4) (𝑥−0)(𝑥−3)(𝑥−4) (𝑥−0)(𝑥−1)(𝑥−4) (𝑥−0)(𝑥−1)(𝑥−3)
y = (0−1)(0−3)(0−4) (−12) + (1−0)(1−3)(1−4) (0) + (3−0)(3−1)(3−4) (6) + (4−0)(4−1)(4−3) (12)

y = (x-1) (x-3)(x-4) – (x) (x-1) (x-4) + x (x-1) (x-3)


= (x-1) [𝑥 2 - 7x +12 - 𝑥 2 + 4x + 𝑥 2 - 3x]
= (x-1) (𝑥 2 - 6x + 12)
y =𝑥 3 - 7𝑥 2 + 18 x – 12
for x = 2, we get y = 4

2.Apply Lagrange’s formula to find f(5) and f(6) given that f(1) =2, f(2)=4,f(3)=8,f(7)=128
and explain why the results differ from those obtained by f(x) = 2𝑥 .
Solution: 𝑥0 = 1𝑥1= 2 𝑥 2 = 2 𝑥3 = 7
By Lagrange’s formula, we have
(𝑥−2)(𝑥−3)(𝑥−7) (𝑥−1)(𝑥−3)(𝑥−7)
f (x) = (1−2)(1−3)(1−7) 𝑓(𝑥0) + (2−1)(2−3)(2−7) 𝑓(𝑥1) +
(𝑥−1)(𝑥−3)(𝑥−17) (𝑥−1)(𝑥−2)(𝑥−3)
(3−1)(3−2)(1−7)
𝑓(𝑥2 ) + (7−1)(7−2)(7−3)
𝑓(𝑥3)
(𝑥−2)(𝑥−3)(𝑥−7) (𝑥−1)(𝑥−3)(𝑥−7)
f (x) = (2) + (4) +
−12 5
(𝑥−1)(𝑥−2)(𝑥−17) (𝑥−1)(𝑥−2)(𝑥−3)
(8) + (128)
−8 120
(3)(2)(−2) (4)(2)(−2) (4)(3)(−2) (4)(3)(2)
f (5) = (2) + (4) + (8) + (128)
−12 5 −8 120

= 2 – 12.8 + 24 + 25.6 = 38.8


(4)(3)(−1) (5)(3)(−1) (5)(4)(−1) (5)(4)(3)
f (6) = (2) + (4) + (8) + (128)
−12 5 −8 120

= 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𝑥 .

Second Semester Differential Equations and Numerical Methods(21MA21)


Department of Mathematics

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 )

(𝑦−12)(𝑦−19) (𝑦−4)(𝑦−19) (𝑦−4)(𝑦−12)


= (4−12)(4−19)
(1) + (12−4)(12−19) (3) + (19−4)(19−12) (4)

at y=7
60 108 60
x = 120 + - 105
56

= 1.85714
Numerical Integration:
Numerical integration is a process of evaluating a definite integral from a set of tabulated
values of the integrand f(x).If the integrand is a function of a single-valued, then the
numerical integration is known as Quadrature.
Newton – Cote’s Quadrature formula:
Let
𝑏
I=∫𝑎 𝑓(𝑥)dx,
where f (x) takes the value 𝑦0, 𝑦1 , 𝑦2 ……..,𝑦𝑛 for x = 𝑥0 ,𝑥1 ,𝑥2 ….,𝑥𝑛 .Divide the interval (a, b)
into n sub-intervals of width h, so that
𝑥0 = a, 𝑥1 =𝑥0 +h , 𝑥2 = 𝑥0 +2h,…..,𝑥𝑛 = 𝑥0 + nh = b
𝑥 +𝑛ℎ
Now, I = ∫𝑥 0 𝑓(𝑥) dx.
0
Let x=𝑥0 +rh then dx = h dr. Also when x =𝑥0 , r = 0 and when
x = 𝑥0 + nh, r = n,
𝑛
I=∫0 𝑓( 𝑥0 +rh) h dr.
Now by Newton’s forward interpolation formula, we have
𝑛 𝑟(𝑟−1) 𝑟(𝑟−1)(𝑟−2)
I = h∫0 [ 𝑦0 + r 𝛥 𝑦0 + 𝛥2 𝑦0 + 𝛥3 𝑦0 +……] dr
2! 3!
Integrating terms by terms, we get
𝑟2 1 𝑟3 𝑟2 1 𝑟4
I = h[𝑦0 r + 𝛥𝑦0 + ( - )𝛥2 𝑦0 + 3! ( 4 - 𝑟 3 + 𝑟 2 ) 𝛥3 𝑦0 +……]𝑛0
2 2! 3 2
𝑛 1 𝑛2 𝑛 1 𝑛2
I = nh [𝑦0 + (𝛥𝑦0 ) + ( - ) (𝛥2 𝑦0 ) + ( − 𝑛2 + 𝑛 ) (𝛥3 𝑦0 ) +….].
2 2! 3 2 3! 4

Second Semester Differential Equations and Numerical Methods(21MA21)


Department of Mathematics
This formula is known as Newton-Cote’s Quadrature formula or a general Quadrature
formula.
Taking n=1,2,3, 6 in Quadrature formula, we have
n=1 Trapezoidal rule
n=2 Simpson’s 1/3rd rule
n=3 Simpson’s 3/8thrule
n=6 Weddle’s rule

1. Simpson’s 1/3rdrule:
By taking n = 2 in the general Quadrature formula and neglecting terms containing𝛥3 𝑦0 , 𝛥4 𝑦0
, … then we get

I = 3 [(𝑦0 + 𝑦𝑛 ] + 4 (𝑦1 + 𝑦3 +……. +𝑦𝑛−1 )+ 2 (𝑦2 +𝑦4 …..+ 𝑦𝑛−2 )]

This formula is known as Simpson’s one-third rule


Note: Thisformula is applicable only when n is a multiple of 2.

2. Simpson’s 3/8thrule:
By taking n = 3 in the general Quadrature formula and neglecting terms containing𝛥4 𝑦0 , 𝛥5 𝑦0
,……we get
3ℎ
I= [(𝑦0 +𝑦𝑛 ) + 3(𝑦1 + 𝑦2 + 𝑦4 +𝑦5 + ⋯ + 𝑦𝑛−1 ) + 2 ( 𝑦3 +𝑦6 + ⋯ + 𝑦𝑛−3 ) ]
8

This formula is known as Simpson’s three-eight rule


Note: This formula is applicable only when n is a multiple of 3

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

This formula is known as Weddle’s rule.


In particular, taking n = 6 in Weddle’s rule
3ℎ
I = 10 (𝑦0 +5𝑦1 + 𝑦2 + 6𝑦3 +𝑦4 + 5𝑦5 + 𝑦6 )

Note: This formula is applicable only when n is a multiple of 6.


Problems:

Second Semester Differential Equations and Numerical Methods(21MA21)


Department of Mathematics
1. A solid of revolution is formed by rotating about the x-axis, the area between the x-axis,
the line x=0 and x=1 and a curve through the points with the following coordinates.
x 0.00 0.25 0.50 0.75 1.00
y 1.0000 0.9896 0.9589 0.9089 0.8415
Solution:
The volume of the solid generated is given by
1
∫0 𝜋 𝑦 2 dx
1
By Simpson’s 3 rule, we have (here h = 0.25)
1 ℎ
∫0 𝜋 𝑦 2 dx = 𝜋 3 [(𝑦0 2 + 𝑦4 2 ) + 4(𝑦1 + 𝑦3 2 ) + 2(𝑦2 2 )]
0.25
= 𝜋 {1+ (0.8415)2 + 4[ (0.9896)2 + (0.9089)2 ] + 2(0.9589)2 }
3
(0.25)(3.1416)
= [1.7081 + 4(0.9793 + 0.8261) + 1.8389]
3
= (0.2618)[1.7081 + 7.2216 + 1.8389]
= (0.2618) (10.7686) = 2.8192.

5.2
2.Calculate ∫4 logx dx using (a) Simpson’s 1/3rd rule (b) Simpson’s 3/8th rule (c) Weddle’s
rule.
5.2−4 1.2
Solution: h= = =0.2
6 6

x 4 4.2 4.4 4.6 4.8 5.0 5.2


y 1.386 1.43508 1.48160 1.52605 1.5686 1.6094 1.6486

(a) By Simpson’s 1/3rd rule

I=ℎ3⌊[(𝑦0 + 𝑦6 ) + 4(𝑦1 + 𝑦3 + 𝑦5 ) + 2(𝑦2 + 𝑦4 )]⌋


=0.2
3
[(1.38629 + 1.6486) + 4(1.43508 + 1.52605 + 1.60943) + 2(1.48160 + 1.56861)]
0.2
= [3.034953 + 18.28224 + 6.10042]
3
0.2
= 3 (27.41761)
=1.82784

(b) Simpson’s 3/8th Rule


3ℎ
[(𝑦0 + 𝑦6 ) + 3(𝑦1 + 𝑦2 + 𝑦4 + 𝑦5 ) + 2𝑦3 )]
8
3(.2)
[(1.38629 + 1.64865) + 3(1.43508 + 1.48160 + 1.56861 + 1.60943)
8
+ 2(1.52605)]
0.6
[3.034953 + 18.28416 + 3.052]
8
0.6
[24.371213]=1.82784
8

Second Semester Differential Equations and Numerical Methods(21MA21)


Department of Mathematics

(c) Weddle’s Rule


y =3ℎ
10
[(𝑦0 + 𝑦6 ) + 5𝑦1 + 𝑦2 + 6𝑦3 + 𝑦4 + 5𝑦5 ]
3(0.2)
= [(1.38629 + 5(1.43508) + 1.48160 + 6(1.52605) + 1.56861 + 5(1.60943) +
10
1.64865]
.6
=10 [1.38629 + 7.1754 + 1.48160 + 9.1563 + 1.5686 + 8.04715 + 1.64865]
.6
=10 [30.464]
= 1.82784

6 𝑑𝑥
3. Evaluate ∫0 using (a) Simpsons 1/3rd rule (b) Simpsons 3/8th rule(c)Weddle’s rule
1+𝑥 2

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

(a) Simpson’s 1/3rd rule


6
1 ℎ
∫ 𝑑𝑥 = [(𝑦 + 𝑦6 ) + 4(𝑦1 + 𝑦3 + 𝑦5 ) + 2(𝑦2 + 𝑦4 )]
0 1+𝑥
2 3 0
1
= [(1 + 0.027) + 4(0.5 + 0.1 + 0.0385) + 2(0.2 + 0.0588)]
3
1
= [1.027 + 2.554 + 0.5176]
3
=1.3662
(b) Simpson’s 3/8th Rule
6
1 3ℎ
∫ 2
𝑑𝑥 = [(𝑦0 + 𝑦6 ) + 3(𝑦1 + 𝑦2 + 𝑦4 + 𝑦5 ) + 2𝑦3 )]
0 1+𝑥 8
3(1)
= [(1 + 0.027) + 3(0.5 + 0.2 + 0.0588 + 0.0385) + 2(0.1))]
8
3
= [1.027 + 2.3919 + 0.2)]
8
=1.3571
(c) Weddle’s Rule
6
1 3ℎ
∫ 𝑑𝑥 = [(𝑦 + 5𝑦1 + 𝑦2 + 6𝑦3 + 𝑦4 + 5𝑦5 + 𝑦6 ))]
0 1+𝑥
2 10 0
3(1)
= [(1 + 5(0.5) + 0.2 + 6(0.1) + 0.0588 + 5(0.385) + 6.027]
10
= 1.3735

Second Semester Differential Equations and Numerical Methods(21MA21)

You might also like