Вы находитесь на странице: 1из 18

NUMERICAL ANALYSIS

Lecture -11+12

Dr. Muhammad Rafiq


Assistant Professor
University of Central Punjab
Lahore Pakistan

Page 1 of 18
INTERPOLATION:
Suppose we are given a data :
x: 𝑥0 𝑥1 𝑥2 ……… 𝑥𝑛
f(x): f(𝑥0 ) f(𝑥1 ) f( 𝑥2 ) ……….f(𝑥𝑛 )

Then process of finding the values of f(x) corresponding to any value of ‘ x’ between 𝑥0 and 𝑥𝑛
is called interpolation.

Extrapolation:
The process of finding the values of f(x) corresponding to any value of ‘x’ outside the given range is
called extrapolation.

Page 2 of 18
NEWTON’S FORWARD DIFFERENCE FORMULA FOR
INTERPOLATION:
𝑥(𝑥 − 1) 2 𝑥 (𝑥 − 1)(𝑥 − 2) 3
𝑓(𝑎 + 𝑥ℎ) = 𝑓(𝑎) + 𝑥∆𝑓(𝑎) + ∆ 𝑓(𝑎) + ∆ 𝑓(𝑎) + ⋯
2! 3!
Proof:
𝑓(𝑎 + 𝑥ℎ) = 𝐸 𝑥 𝑓(𝑎)
= (1 + ∆)𝑥 f(a)
𝑥(𝑥−1) 𝑥(𝑥−1)(𝑥−2)
= [1+ x∆ + ∆2 + ∆3 +………….]f(a)
2! 3!

𝑥(𝑥 − 1) 2 𝑥 (𝑥 − 1)(𝑥 − 2) 3
𝑓(𝑎 + 𝑥ℎ) = 𝑓(𝑎) + 𝑥∆𝑓(𝑎) + ∆ 𝑓(𝑎) + ∆ 𝑓(𝑎) + ⋯
2! 3!
Here,
𝑡−𝑎
h=step size a=1st argument a+xh= t(say) x=

In summation form

𝑥
𝑓(𝑎 + 𝑥ℎ) = ∑ ( ) ∆𝑟 𝑓(𝑎)
𝑟
𝑟=0

Page 3 of 18
Example: 1
Construct a polynomial for the data point
(0,5),(1,3),(2,3)and(3,5).

Solution: x: 0 1 2 3

f(x): 5 3 3 5
𝑡−𝑎 𝑡−0
Here ;a=0 ; h=1 ; a+xh=t x= = =t
ℎ 1

Forward Difference Table


x f(x) ∆f(x) ∆2 f(x) ∆3 f(x)
0 5
−2
1 3 2
0 0
2 3 2
2
3 5

Page 4 of 18
As we know that
𝑥(𝑥 − 1) 2 𝑥 (𝑥 − 1)(𝑥 − 2) 3
𝑓(𝑎 + 𝑥ℎ) = 𝑓(𝑎) + 𝑥∆𝑓(𝑎) + ∆ 𝑓(𝑎) + ∆ 𝑓(𝑎) + ⋯
2! 3!
𝑡(𝑡−1) 𝑡(𝑡−1)(𝑡−2)
f(t)=5+t(-2)+ (2)+ (0)
2! 3!

f(t)=5-2t+𝑡 2 -t

𝑓(𝑡) = 𝑡 2 − 3𝑡 + 5 Ans

Example: 2
Given the data
x: 0.5 0.6 0.7 0.8
f(x)=coshx 1.127626 1.185465 1.255169 1.337425
then estimate cosh (0.56) =?

Solution:
Here ;
a=0.5 ;

Page 5 of 18
h=0.1 ;
a+xh=0.56
x=0.6

Forward Difference Table


x f(x) ∆f(x) ∆2 f(x) ∆3 f(x)
0.5 1.127626
0.057839
0.6 1.185465 0.011865
0.069704 0.000697
0.7 1.255169 0.012566
0.082256
0.8 1.337425

Using Newton’s forward difference formula for interpolation:


𝑥(𝑥 − 1) 2 𝑥 (𝑥 − 1)(𝑥 − 2) 3
𝑓(𝑎 + 𝑥ℎ) = 𝑓(𝑎) + 𝑥∆𝑓(𝑎) + ∆ 𝑓(𝑎) + ∆ 𝑓(𝑎) + ⋯
2! 3!
(0.011865) (0.6)(0.6−1)(0.6−2)
f(0.56)=1.127626+(0.6)(0.057839)+(0.6)(0.6-1) + (0.000697)
2! 3!

=1.160944632 Ans
Page 6 of 18
Example: 3
The amount ‘A’ of a substance remaining in the reacting system after an interval of line ‘t’ in a
certain chemical experiment is tabulated below:
t(sec): 2 5 8 11
A(gram): 94.8 87.9 81.3 75.1
Estimate the value of ‘A’ at t=3
3−2 1
Solution:Here a=2 ; h=3 ; a+xh=3 x =
3
=
3

Forward Difference Table


x f(x) ∆f(x) ∆2 f(x) ∆3 f(x)
2 94.8
−6.9
5 87.9 0.3
-6.6 0.1
8 81.3 0.4
-6.2
11 75.1

Page 7 of 18
Using Newton’s forward difference formula for interpolation:
𝑥(𝑥 − 1) 2 𝑥 (𝑥 − 1)(𝑥 − 2) 3
𝑓(𝑎 + 𝑥ℎ) = 𝑓(𝑎) + 𝑥∆𝑓(𝑎) + ∆ 𝑓(𝑎) + ∆ 𝑓(𝑎) + ⋯
2! 3!
f(3)=92.4728gm Ans

Example: 4
Find the polynomial which takes the following values.
x: 1 3 5 7 9 11
f(x): 3 14 19 21 23 28

Solution:
Here a=1, h=2
a+xh=t
𝑡−𝑎
→ x=

Putting values we get


x=(t-1)/2

Page 8 of 18
Forward Difference Table
x f(x) ∆ f(x) ∆2 f(x) ∆3 (x) ∆4 f(x)
1 3
11
3 14 −6
5 3
5 19 -3 0
2 3
7 21 0 0
2 3
9 23 3
5
11 28

As we know that
𝑥(𝑥 − 1) 2 𝑥 (𝑥 − 1)(𝑥 − 2) 3
𝑓(𝑎 + 𝑥ℎ) = 𝑓(𝑎) + 𝑥∆𝑓(𝑎) + ∆ 𝑓(𝑎) + ∆ 𝑓(𝑎) + ⋯
2! 3!
Putting the values from the table we get

Page 9 of 18
𝑡−1 𝑡−1 𝑡−1 𝑡−1 𝑡−1
(𝑡−1) ( 2 )( 2 −1) ( 2 )(( 2 −1)( 2 −2))
f(t)=3+ (11)+ (−6)+ (3)
2 2! 3!

11 𝑡 2 −3𝑡−𝑡+3 (𝑡 2 −3𝑡−𝑡+3)(𝑡−5)
f(t)=3+F(a + xh) = − + (−6)+ (3)
2 2!∗4 3!∗8
11𝑡 11 9 1
f(t)=3+ − -3𝑡 2 + 3𝑡 − + [𝑡 3 − 4𝑡 2 + 23𝑡 − 15]
2 2 4 16
1 9 23 11𝑡 11 9 15
f(t)= 𝑡3 − 𝑡2 + 𝑡 + 3𝑡 + − +3− −
16 16 16 2 2 4 16

By solving it we get
1
f(t)= [𝑡 3 − 21𝑡 2 + 159𝑡 − 91] Ans.
16

Example: 5
Find a cubic polynomial which takes the following values
(0,1),(1,2),(2,1),(3,10)
Solution:
x: 0 1 2 3
f(x): 1 2 1 10
Here a=0 , h=1

Page 10 of 18
a+xh=t
→x=(t-0)/1=t
Forward Difference Table
x f(x) ∆ f(x) ∆2 f(x) ∆3 f(x)
0 1
1
1 2 −2
-1 12
2 1 10
9
3 10
As we know that
𝑥(𝑥 − 1) 2 𝑥 (𝑥 − 1)(𝑥 − 2) 3
𝑓(𝑎 + 𝑥ℎ) = 𝑓(𝑎) + 𝑥∆𝑓(𝑎) + ∆ 𝑓(𝑎) + ∆ 𝑓(𝑎) + ⋯
2! 3!
(𝑡)(𝑡−1) (𝑡)(𝑡−1)(𝑡−2)
f(t)=1+(t)(1)+ (−2) + (12)
2! 3!

𝑡 2 −𝑡 (𝑡 2 −𝑡)(𝑡−2)
f(t)=1+t+ (-2)+ (12)
2! 3!

𝑡 3 −2𝑡 2 −𝑡 2 +2𝑡
f(t)=1+t+(𝑡 2 − 𝑡)(−1) + (12)
3!

Page 11 of 18
f(t)=1+t-𝑡 2 + 𝑡 + 2𝑡 3 − 4𝑡 2 − 2𝑡 2 + 4𝑡
f(t)=2𝑡 3 − 7𝑡 2 + 6𝑡 + 1 Ans.

Example: 6
The following table gives the values of density of saturated water for various temperatures of
standard steam
temp:t(c°) 100 150 200 250 300
density:d(g/cm) 958 917 865 799 712
Find by interpolating density where t=130℃

Solution:
x: 100 150 200 250 300
f(x): 958 917 865 799 712
here
a=100, h=50, t=130℃ a+xh=t →x=(t-a)/h
x=(130-100)/50→x=30/50 or x=3/5

Page 12 of 18
Forward Difference Table
x f(x) ∆ f(x) ∆2 f(x) ∆3 f(x) ∆4 f(x)
100 958
-41
150 917 -11
-52 -3
200 865 -14 -4
-66 -7
250 799 -21
-87
300 712

As we know that
𝑥(𝑥 − 1) 2 𝑥 (𝑥 − 1)(𝑥 − 2) 3
𝑓(𝑎 + 𝑥ℎ) = 𝑓(𝑎) + 𝑥∆𝑓(𝑎) + ∆ 𝑓(𝑎) + ∆ 𝑓(𝑎) + ⋯
2! 3!
by putting the values we get
3 3 3 3 3 3 3 3 3
3 (5) (5−1) (5) (5−1)(5−2) (5) (5−1)(5−2)(5−3)
f(130)=958+ (−41) + (−11) + (−3) + (−4)
5 2! 3! 4!
3 3−5 3 3−5 3−10 3 3−5 3−10 3−15
123 ( ) ( ) (5) ( 5 )( 5 ) (5) ( 5 )( 5 )( 5 )
f(130)=958- + 5 5 (−11) + (−3) + (−4)
5 2! 3! 4!

Page 13 of 18
3 −2 3 −2 −7 3 −2 −7 −12
123 ( ) ( ) (5) ( 5 )( 5 ) (5) ( 5 )( 5 )( 5 )
f(130)=958- + 5 5 (−11) + (−3) + (−4)
5 2! 3! 4!
6 42 504
123 (25) (125) (625)
f(130)=958- + (11) + (−3) + (4)
5 2! 3! 4!
123 6 42 504
f(130)=958- + (11) − (3) + (4)
5 2!∗25 3!∗125 4!∗625
123 66 126 2016
f(130)=958- + − +
5 2!∗25 3!∗125 4!∗625

f(130)=958-24.6+1.32-0.160+0.1344
f(130)=934.6944≈935

NEWTON’S BACKWARD DIFFERENCE FORMULA FOR


INTERPOLATION:
𝑥(𝑥 + 1) 2 𝑥 (𝑥 + 1)(𝑥 + 2) 3
𝑓(𝑥𝑛 + 𝑥ℎ) = 𝑓(𝑥𝑛 ) + 𝑥∇𝑓(𝑥𝑛 ) + ∇ 𝑓(𝑥𝑛 ) + ∇ 𝑓(𝑥𝑛 ) + ⋯
2! 3!
Proof:
𝑓(𝑥𝑛 + 𝑥ℎ) = 𝐸 𝑥 𝑓(𝑥𝑛 )
= (1 − ∇)−𝑥 𝑓(𝑥𝑛 )

Page 14 of 18
(−𝑥)(−𝑥−1) (−𝑥)(−𝑥−1)(−𝑥−2)
= [1+ (−𝑥 )(−∇) + (−∇)2 + ∇3 +…]𝑓(𝑎)
2! 3!

𝑥(𝑥 + 1) 2 𝑥 (𝑥 + 1)(𝑥 + 2) 3
𝑓(𝑥𝑛 + 𝑥ℎ) = 𝑓(𝑥𝑛 ) + 𝑥∇𝑓(𝑥𝑛 ) + ∇ 𝑓(𝑥𝑛 ) + ∇ 𝑓(𝑥𝑛 ) + ⋯
2! 3!
𝑡−𝑥𝑛
Here, h=step size 𝑥𝑛 =last argument 𝑥𝑛 + 𝑥ℎ = t(say) 𝑥=

Example: 7Given that: t(sec): 2 5 8 11

A(gram): 94.8 87.9 81.3 75.1


Estimate the value of ‘A’ at t=9

Backward Difference Table


x f(x) ∇(x) ∇2 f(x) ∇f(x)
11 75.1
−6.2
8 81.3 0.4
-6.6 0.1
5 87.9 0.3
−6.9
2 94.8
9−11 2
Here h=3 𝑥𝑛 =11 𝑓 (𝑥𝑛 ) = 75.1 𝑥𝑛 + 𝑥ℎ = 9 𝑥= =−
3 3

Page 15 of 18
Using Newton’s Backward Difference formula for interpolation:
𝑥(𝑥 + 1) 2 𝑥 (𝑥 + 1)(𝑥 + 2) 3
𝑓(𝑥𝑛 + 𝑥ℎ) = 𝑓(𝑥𝑛 ) + 𝑥∇𝑓(𝑥𝑛 ) + ∇ 𝑓(𝑥𝑛 ) + ∇ 𝑓(𝑥𝑛 ) + ⋯
2! 3!
2 2 2 2 2
2 (− ) (− + 1) (− ) (− + 1) (− + 2)
𝑓 (9) = 75.1 + (− ) (−6.2) + 3 3 (0.4) + 3 3 3 (0.1)
3 2! 3!
= 79.18

Note: Newton’s forward difference formula is used mainly to interpolate the values of
the function near the beginning of a set of tabulated values while Newton’s backward
difference formula is used to interpolate the values of the function near the end of a set
of tabulated values.

Page 16 of 18
Exercise
Q1. Find the polynomial which takes the following values.
x: 1 3 5 7 9 11
f(x): 2 15 23 27 30 32
Q2. The following table gives the values of density of saturated water for
various temperatures of standard steam
temp:t(c°) 100 150 200 250 300
density:d(g/cm) 942 907 860 739 710
Find by interpolating density where t=120℃
Q3. Find a cubic polynomial which takes the following values
(0,0),(1,1),(2,8),(3,27)

Page 17 of 18
Q4.The following are data points from steam table
Temp(𝑐 0 ): 140 150 160 170 180
𝑁
Presssure ( ): 3.685 4.804 6.302 8.067 10.225
𝑚3

Find the pressure of the steam for temperatures 1420 𝑎𝑛𝑑 1750 .
Q5. Given that: 𝑠𝑖𝑛450 = 0.7071 , 𝑠𝑖𝑛500 = 0.7660
𝑠𝑖𝑛550 = 0.8192, 𝑠𝑖𝑛600 = 0.8660
Compute 𝑠𝑖𝑛520 and compare your result with value obtained by calculator.

Page 18 of 18

Вам также может понравиться