Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
318 views

Interpolation Numerical Methods

Interpolation is a method for estimating values within a range of known values. It involves replacing an unknown function with a simpler function that matches the known values. Newton-Gregory forward difference formula is used for interpolation, where the difference between successive y-values are calculated and used to estimate values between known x-values. The document provides an example of using this method to find the visible horizon distance for given heights above the earth's surface.

Uploaded by

Awais Anwar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
318 views

Interpolation Numerical Methods

Interpolation is a method for estimating values within a range of known values. It involves replacing an unknown function with a simpler function that matches the known values. Newton-Gregory forward difference formula is used for interpolation, where the difference between successive y-values are calculated and used to estimate values between known x-values. The document provides an example of using this method to find the visible horizon distance for given heights above the earth's surface.

Uploaded by

Awais Anwar
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 22

Interpolation

The word interpolation denotes the method of computing the value of the function y =
f(x) for any given value of x when a set (x0, y0), (x1, y1),(xn, yn) are given.
Note:
Since in most of the cases the exact form of the function is not known. In such cases the
function f(x) is replaced by a simpler function (x) which has the same values as f(x) for
x0, x1, x2.,xn.

( x ) y 0 u y 0

u (u 1) 2
u (u 1) (u 2) 3
y0
y 0 ....
2!
3!

u (u 1) (u 2) ...(u n 1) n
y0
n!

is called the Newton Gregory forward difference formula

Note :
1. Newton forward interpolation is used to interpolate the values of y near the beginning
of a set of tabular values.
2. y0 may be taken as any point of the table but the formula contains those values of y
which come after the value chosen as y0.
The table gives the distances in nautical miles of the visible horizon for the given heights
in feet above the earths surface.
x = height
y = distance

100

150

200

250

300

350

400

10.63

13.03

15.04

16.81

18.42

19.90

21.27

Find the values of y when i) x = 120, ii) y =218

x
100

y
10.63

150

13.03

2.40
-0.39
2.01
200

15.04

0.15
-0.24

1.77
250

16.81
18.42
19.90

400

21.27

-0.05
0.03

0.02
0.04

-0.13
1.48

350

0.02

-0.16
1.61

300

-0.07
0.08

-0.01
0.02

-0.11
1.37

Choose x0 = 100
i) x 120, u

120 100
0 .4
50

f (120 ) 10.63

(0.4)(0.4 1)
0.4
(2.40 )
(0.39)
1!
2!

(0.4) (0.4 1)(0.4 2)


(0.15 )
3!

(0.4) (0.4 1) (0.4 2) (0.4 3)


(0.07)
4!

(0.4) (0.4 1) (0.4 2) (0.4 3) (0.4 4)


(0.02)
5!

(0.4) (0.4 1) (0.4 2) (0.4 3) (0.4 4) (0.4 5)


(0.02) 11.649
6!

ii) Let x = 218, x0 = 200, u

218 200 18

0.36
50
50

f (218 ) 15.04 0.36(1.77)

0.36 (0.64)
(0.16)
2

0.36 (0.64) (1.64)


(0.03) ...
6

= 15.7

2. Find the value of f(1.85)


x
1.7

y
5.474

1.8

6.049

2y

3y

4y

5y

6y

0.575
0.062
0.637
1.9

0.004

6.686

0.066
0.703

2.0

7.389

0.074
0.777

2.1

23

9.974

0.082
0.859

9.025

-0.004

0.008

8.166

2.2

0.004
0.008

0.004
0

0
0.008

0.090
0.949

Choose x 0 1.8, x 1.85 u

x x 0 1.85 1.8

0 .5
h
0 .1

f (1.85) 6.049 (0.5) (0.637 )

(0.5)(0.5)
(0.066)
2

(0.5)(0.5) (1.5)
(0.008 )
6

6.049 0.3185 - 0.0008 0.0005

= 6.359

4. Given sin 45o = 0.7071, sin 50o = 0.7660, sin 55o =0.8192, sin 60o = 0.8660. Find sin
48o.

45

0.7071

0.589
50

0.7660

-0.0057
0.0532

55

0.8192

0.0007
-0.0064

0.0468
60

0.8660

x 48, x 0 45; h 5 u

x x0
0 .6
h

sin 48 o 0.7071 (0.6) (0.0589)

(0.6)(0.4)
(0.0057)
2

(0.6) (0.4) (1.4)


(0.0007) 0.7431
6

From the following data find the number of students who have obtained 45 marks. Also
find the number of students who have scored between 41 and 45 marks.
Marks
No. of students

0 - 40

41 - 50

51 - 60

61 -70

71 - 80

31

42

51

35

31

40

31

42
50

73

9
51

60

124

-25
-16

35
70

159

37
12

-4
31

80

190

f (45) 31 (0.5) (42)

(0.5) (0.5) 9
2

(0.5) (0.5) (1.5) (25)


3!

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


(37) 47.8672 48
4!

f(45) - f(40) = 70 = Number of students who have scored between 41 and 45.

Find the interpolating polynomial for the following data:


f(0) = 1, f(1) = 0, f(2) = 1, f(3) = 10. Hence evaluate f(0.5)

-1
1

2
1

6
8

9
3

10

x0
x
1

f ( x ) 1 x (1)

x ( x 1)
( 2)
2!

x ( x 1) ( x 2)
6 x 3 2x 2 1
3!

6. Find the interpolating polynomial for the following data:


x:

f(x) :

11

18

27

x
0

y
3

3
2
5
2

11

0
2

7
3

18

0
0

2
9

27

x0
x
1

f ( x ) 3 x (3)

x ( x 1)
( 2)
2

x ( x 1)
( 0)
x!

3 2x x 2

Newton Gregory Backward Interpolation formula


y y n u y n
where u

u (u 1) (u 2) 3
u (u 1) 2
yn
y n ....
2!
3!

x xn
h

2. The values of tan x are given for values of x in the following table. Estimate tan (0.26)

0.10

0.15

0.20

0.25

0.30

0.1003

0.1511

0.2027

0.2553

0.3093

x
0.10

y
0.1003

0.15

0.1511

0.0508
0.0008
0.0516
0.20

0.2027

0.0002
0.0010

0.0526
0.25

0.2553

0.0002
0.0004

0.0014
0.0540

0.30
u

0.3093

0.26 0.3
0 .8
0.05

f (0.26) 0.3093 (0.8)(0.054)

(0.8)
(0.2) (0.0014)
2

(0.8) (0.2) (1.2)


(0.0004) 0.2659
6

3. The deflection d measured at various distances x from one end of a cantilever is given
by the following table. Find d when x = 0.95

x
0

d
0

0.2

0.0347

0.0347
0.0479
0.0826
0.4

0.1173

-0.0318
0.0161

0.0003

0.0987
0.6

-0.0321

0.2160

-0.016

0.0827
0.8

0.2987

-0.0003

-0.032
-0.0481

0.0346
1.0
u

0.3333

0.95 1
0.25
0 .2

d 0.3308 when x 0.95

4. The area y of circles for different diameters x are given below:


x:

80

85

90

95

100

y:

5026

5674

6362

7088

7854

Calculate area when x = 98


x
80

y
5026

2y

3y

4y

648
85

5674

40
688

90

6362

-2
38

726
95

7088

40
766

100

7854

Answer:
u

x xn
0 .4
n

y = 7542

4
2

Find the interpolating polynomial which approximates the following data.

-5

-10

-9

35

x
0

y
-5

-5
1

-10

6
1

-9

6
12

13
3

6
18

31
4
u

35
x4
1

f ( x ) 35 ( x 4) (31) ( x 4) ( x 3)

18
2!

( x 4) ( x 3) ( x 2) (6)
3!

x 3 2x 2 6x - 5

Central difference interpolation formula


X

x-3

y-3

y-3
x-2

2y-3

y-2
y-2

x-1

3y-3
2y-2

y-1
y-1

x0

3y-2
2y-1

y0
y-0

x1

5y-3
4y-2

3y-1
2y0

y1
y1

x2

4y-3
6y-3
5y-2
4y-1
3y0

2y1

y2
y2

x3

y3

a) Stirlings formula

u (u 2 1) 3 y 2 3 y 1
y y 1 u 2 2
y y0 u 0

2
2
3!
2

u 2 (u 2 1) 4
u (u 2 1) (u 2 4)
y 2
4!
5!

where u

5 y 3 5 y 2

....
2

x x0
h

b) Bessel's formula
1
(p ) p(p 1)
2
2

y
p (p 1)
1
0
2
y y 0 p y 0
3 y 1

2 !
2
3!

(p 1) p(p 1) (p 2) 4 y 2 4 y 1

....
4!
2

where p

x x0
h

1. Apply sterling's formula to find f(14.2) from the following table:


x

10

0.24

0.041
12

0.281

-0.004
0.037

14

0.318

0.001
-0.003

0.034
16

0.352

0.001
-0.002

0.032
18
u

0.384
x x 0 14.2 14

0 .1
h
2

2
0.037 0.034 (0.1)
y 0.318 0.1
{0.003}

2
2

(0.1) ((0.1) 2 1) 0.001 0.001

6
2

= 0.3215

2.Apply stirling's formula to find a polynomial f(x) of degree 4 that approximates the
following data and hence find f(2.5)
x

f(x)

-2
2

-1

4
2

-8

-4
-2

18
8

-1

4
2

1
x 3
x 3
1

2
( x 3)
2 (2) ( x 3)
8 8
f ( x ) 1 ( x 3)
( 4 )
{( x 3) 2 1}

2
3!
2
2

( x 3) 2

( x 3) 2 1 16
4!

1
2 x 4 24 x 3 100 x 2 168x 93
3

f (2.5) 0.375

3. Using Bessels formula find f(12.5) for the data:


x

f(x)

12

1
10

13

0
1

15

14

1
1

2
20

16
x x 0 12.5 10

0 .5
h
5

f (12.5) 13 (0.5) (1)

(0.5) (0.5)
(0.5) 0
2

=13.4375
4. Using Bessel's formula find 3rd degree polynomial that approximates the following
data:
f(0) = 2, f(1) = 3, f(2) = 8, f(3)=23
x

1
1

4
5

10
15

23
x 1
x 1
1

1
( x 1 ) ( x 1) ( x 2)
( x 1) ( x 2) 4 10
2
f ( x ) 3 ( x 1) 5
6

2!
3!
2
x3 x2 x 2

Interpolation with unequal intervals


Newton backward and forward interpolation is applicable only when x 0, x1,,xn-1 are
equally spaced.

Now we use two interpolation formulae for unequally spaced values of x.

i) Lagranges formula for unequal intervals:


If y = f(x) takes the values y0, y1, y2,.,yn corresponding to x = x0, x1, x2,,xn then

f (x)

( x x 1 ) ( x x 2 )...( x x n )
f (x 0 )
( x 0 x 1 ) ( x 0 x 2 )...( x 0 x n )

( x x 0 ) ( x x 2 ) ( x x 3 )...( x x n )
f (x1 )
( x 1 x 0 ) ( x 1 x 2 ) ( x 1 x 3 )...( x 1 x n )

( x x 0 ) ( x x 1 ) ( x x 3 )...( x x n )
f ( x 2 ) ....
( x 2 x 0 ) ( x 2 x 1 ) ( x 2 x 3 )...( x 2 x n )

( x x 0 ) ( x x 1 ) ( x x 2 )...( x x n 1 )
f (x n )
( x n x 0 ) ( x n x 1 ) ( x n x 2 )...( x n x n 1 )

is known as the lagrange's interpolation formula

ii) Divided differences ()

f ( x 0 ) y 0
y1

y1 y 0
[ x 0 , x1 ]
x1 x 0

y 2 y1
[x 2 , x1 ]
x 2 x1

y n 1

y n y n 1
[ x n 1 , x n ]
x n x n 1

second divided difference

2 f ( x 0 ) 2 y 0

y1 y 0
x2 x0

[x 2 , x1 ] [x1 , x 0 ]
[x 0 , x1 , x 2 ]
x2 x0

|| ly 2 y1

y 2 y1 [ x 3 , x 2 ] [ x 2 , x 1 ]

[x1 , x 2 , x 3 ]
x 3 x1
x 3 x1

similarly 3 y 0 ,.... can be defined


Newton's divided difference interpolation formula

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

... ( x x 0 ) ( x x 1 ) ...( x x n ) n y 0
is called the Newton's divided difference formula.

Note:
Lagrange's formula has the drawback that if another interpolation value were inserted,
then the interpolation coefficients need to be recalculated.

Inverse interpolation: Finding the value of y given the value of x is called interpolation
where as finding the value of x for a given y is called inverse interpolation.

Since Lagrange's formula is only a relation between x and y we can obtain the inverse
interpolation formula just by interchanging x and y.

( y y1 ) ( y y 2 )....( y y n )
.x 0
( y 0 y1 ) ( y 0 y 2 )...( y 0 y n )

( y y 0 ) ( y y 0 ) ( y y 2 ) ( y y 3 )...( y y n )
x 1 ...
( y1 y 0 ) ( y1 y 2 ) ( y1 y 3 ) ...( y1 y n )

...

( y y 0 ) ( y y1 )...( y y n 1 )
.x n
( y n y 0 ) ( y n y1 )...( y n y n 1 )

is the Lagranges formula for inverse interpolation

5. The following table gives the values of x and y


x:

1.2

2.1

2.8

4.1

4.9

6.2

y:

4.2

6.8

9.8

13.4

15.5

19.6

Find x when y = 12 using Lagranges inverse interpolation formula.


Using Langrages formula

( y y1 ) ( y y 2 ) ( y y 3 ) ( y y 4 ) ( y y 5 )
x0
( y 0 y1 ) ( y 0 y 2 ) ( y 0 y 3 ) ( y 0 y 4 ) ( y 0 y 5 )
....

( y y 0 ) ( y y1 ) ( y y 2 ) ( y y 3 ) ( y y 4 )
x4
( y 5 y 0 ) ( y 5 y1 ) ( y 5 y 2 )...( y 5 y 4 )

0.022 0.234 1.252 3.419 0.964 0.055

= 3.55

1. Given the values


x:

11

13

17

f(x) :

150

392

1452

2366

5202

Evaluate f(9) using (i) Lagrange's formula (ii) Newton's divided difference formula.

i) Lagranges formula
f (9)

(9 7) (9 11) (9 13) (9 17)


(9 5) (9 11) (9 13) (9 17)
(150)
.392
(5 7) (5 11) (5 13) (5 17)
(7 5) (7 11) (7 13) (7 17)

(9 5) (9 7) (9 13) (9 17)
(9 5) (9 7) (9 11) (9 17)
(1452)
(2366)
(11 5) (11 7) (11 13) (11 17)
(13 5) (13 7) (13 11) (13 17)

(9 5) (9 7) (9 11) (9 13)
(5202) 810
(17 5) (17 7) (17 11) (17 13)

f(9) = 810

ii)
5

150
121

392

24
265

11

1452

32

457
13

2366

42
709

17

5202

f(9) = 150 + 121 (9 - 5) + 24 (9 - 5) (9 - 7) + 1(9 - 5) (9 - 7) (9 - 11) = 810

2. Using I) Langranges interpolation and ii) divided difference formula. Find the value of
y when x = 10.
x:

11

y:

12

13

14

16

Lagranges formula
y f (10)

(10 6) (10 9) (10 11)


(10 5)(10 9)(10 11)
12
13
(5 6) (5 9) (5 11)
(6 5)(6 9)(6 11)

(10 5)(10 6)(10 11)


(10 5)(10 6)(10 9)
14
16
(9 5)(9 6)(9 11)
(11 5)(11 6)(11 9)

44
3

Divided difference
x

12

1
6

13

2 / 3 1

4
6

1
3

2 1 27

15 6 90 3 / 10 1
11 5
6
6
20

14

2/3 2

5
15
2
1
2

11

16

1
1
f (10) 12 (10 5) (10 5)(10 6). (10 5)(10 6)(10 9)
6
20

44
3

3. If y(1) = -3, y(3) = 9, y(4) =30, y(6) = 132 find the lagranges interpolating polynomial
that takes the same values as y at the given points.
Given:
x

-3

30

132

f (x)

( x 3) ( x 4) ( x 6)
( x 1)( x 4)( x 6)
. (3)
.9
(1 3)(1 4)(1 6)
(3 1)(3 4)(3 6)

( x 1)( x 3)( x 6)
( x 1)( x 3)( x 4)
.30
.132
(4 1)(4 3)(4 6)
(6 1)(6 3)(6 4)

= x3 - 3x2 + 5x - 6

4. Find the interpolating polynomial using Newton divided difference formula for the
following data:
x

12

147

2
1

4
9

12

1
9

45
5

147

F(x) = 2 + (x - 0)(1) + (x - 0) (x - 1) (4) + (x - 0) (x - 1) (x - 2) 1


= x3 + x2 - x + 2

Try this
5. Using Lagranges interpolation formula find a polynomial which passes through the
points (0, -12), (1, 0) (3, 6). (4, 12)
Answer: x3 - 7x2 +18x - 12

You might also like