1 Chapter 3 INTERPOLATION. 2 WHAT IS INTERPOLATION? Given (x 0,y 0 ), (x 1,y 1 ), …, (x n,y n ),...

Post on 15-Jan-2016

248 views 1 download

Tags:

Transcript of 1 Chapter 3 INTERPOLATION. 2 WHAT IS INTERPOLATION? Given (x 0,y 0 ), (x 1,y 1 ), …, (x n,y n ),...

1

Chapter 3

INTERPOLATION

2

WHAT IS INTERPOLATION?

Given (x0,y0), (x1,y1), …, (xn,yn), finding the value of

‘y’ at a value of ‘x’ in (x0, xn) is called interpolation.

3

INTERPOLANTS

Polynomials are the most common choice of interpolants because they are easy to:

Evaluate,Differentiate, and Integrate.

4

LAGRANGIAN INTERPOLATION

Lagrangian interpolating polynomial is given by

n

iiin xfxLxf

0

)()()(

where ‘ n ’ in )(xf n stands for the thn order polynomial that approximates the function )(xfy

given at )1( n data points as nnnn yxyxyxyx ,,,,...,,,, 111100 , and

n

ijj ji

ji xx

xxxL

0

)(

)(xLi is a weighting function that includes a product of )1( n terms with terms of ij

omitted.

5

Example

A manufacturer of thermistors makes the following observations on a thermistor. Determine the temperature corresponding to 754.8 ohms using the Lagrangian method for interpolation.

R T

Ohm C

1101.0

911.3

636.0

451.1

25.113

30.131

40.120

50.128

6

Solution

We are interpolating using a cubic polynomial

3

0

)()()(i

ii RTRLRT

)()()()()()()()( 33221100 RTRLRTRLRTRLRTRL

7

Solution

400 500 600 700 800 900 1000 1100 120025

30

35

40

45

50

5550.128

25.113

y s

f range( )

f x desired

1.101 103451.1 x s range x desired

32232432632832103225

30

35

40

45

50

55

y

f range( )

f xdesired

x range xdesired

113.25,0.1101 oo RTR 131.30,3.911 11 RTR

120.40,0.636 22 RTR 128.50,1.451 33 RTR

3

00 0

0 )(

jj j

j

RR

RRRL

30

3

20

2

10

1

RR

RR

RR

RR

RR

RR

3

10 1

1 )(

jj j

j

RR

RRRL

31

3

21

2

01

0

RR

RR

RR

RR

RR

RR

3

20 2

2 )(

jj j

j

RR

RRRL

32

3

12

1

02

0

RR

RR

RR

RR

RR

RR

3

30 3

3 )(

jj j

j

RR

RRRL

23

2

13

1

03

0

RR

RR

RR

RR

RR

RR

8

Solution

)()(

)()()(

323

2

13

1

03

02

32

3

12

1

02

0

131

3

21

2

01

00

30

3

20

2

10

1

RTRR

RR

RR

RR

RR

RRRT

RR

RR

RR

RR

RR

RR

RTRR

RR

RR

RR

RR

RRRT

RR

RR

RR

RR

RR

RRRT

)128.50()0.6361.451)(3.9111.451)(0.11011.451(

)0.6368.754)(3.9118.754)(0.11018.754(

)120.40()1.4510.636)(3.9110.636)(0.11010.636(

)1.4518.754)(3.9118.754)(0.11018.754(

)131.30()1.4513.911)(0.6363.911)(0.11013.911(

)1.4518.754)(0.6368.754)(0.11018.754(

)113.25()1.4510.1101)(0.6360.1101)(3.9110.1101(

)1.4518.754)(0.6368.754)(3.9118.754()8.754(

T

)128.50)(11639.0()120.40)(69517.0()131.30)(51972.0()113.25)(098494.0(

35.242 C= °

9

NEWTONS DIVIDED DIFFERENCE

What is divided difference?

f[x0,x1,x2] =

f[x0,x1] =

f[x1,x2] – f[x0,x1]

x2 – x1

f[x0, x1, …, xk-1, xk] = 1 2 k 0 k-1

k 0

f[x ,x - x ] - f[x ,...,x ]

x - xfor k = 3, 4, ….. n.

These Ist, IInd... and kth order differences are denoted by f, 2f, …, kf.

f[x1] – f[x0]

x1 – x0

10

INTERPOLATION USING DIVIDED DIFFERENCE

The divided difference interpolation polynomial is:

P(x) = f(x0) + (x – x0) f [x0, x1] + + (x – x0) (x – xn-1) f[x0, x1, …, xn]

11

Example

For the data

x: –1 0 2 5

f(x) : 7 10 22 235 Find the divided difference polynomial and estimate

f(1).

12

Solution

X f f 2f 3f -1 7

3

0 10 6

1

13 2

2 22 71

5 235

P(x) = f(x0) + (x – x0) f[x0, x1] + (x – x0) ( x – x1) f [x0, x1, x2] + (x – x0) (x – x1) (x – x2) f [x0, x1, x2, x3]

= 7 + (x +1) 3 + (x +1) (x – 0) 1 + (x +1) (x –0) (x – 2) 2

= 2x3 – x2 + 10

P (1) = 11

13

INTERPOLATION FOR EQUALLY SPACED POINTS

Let (X0,,Y0), (X1,,Y1), …, (Xn,,Yn) be the given points withXi+1 = Xi +h,i = 0,1,2,…, (n-1).

Finite Difference Operators

● Forward difference operatorf(xi) = f (xi + h) – f (xi)

● Backward difference operatorf(xi) = f (xi) – f (xi – h)

● Central difference operator

f(xi) = f - f

2

hx i

2

hx i

14

INTERPOLATION FOR EQUALLY SPACED POINTS

● Shift operators

● Averaging operator

E f(xi) = f(xi +h) Er f(xi) = f (xi +rh)

f(xi) = 2

1 [ f

2

hx i + f

2

hx i ]

15

RELATION BETWEEN OPERATORS

fi = fi+1 = fi+ ½

= E – 1, = 1 – E-1 = E½ – E-½

= ( E½ + E- ½)

16

NEWTON GREGORY FORWARD INTERPOLATION

- -D D D 2 3

0 o 0 0 0

p(p – 1) p(p 1)(p 2)P(x + ph) = y + p y + y + y + +

2! 3!

0x - x

hFor convenience we put p = and f0 = y0. Then we have

- - -Dn

0

p(p 1)(p 2)L (p n + 1)y

n!

17

Example

Estimate f (3.17)from the data using Newton Forward Interpolation.

x: 3.1 3.2 3.3 3.4 3.5

f(x): 0 0.6 1.0 1.2 1.3

18

Solution

First let us form the difference table

x y y 2y 3y 4y 3.1 0

0.6 3.2 0.6 - 0.2

0.4 0 3.3 1.0 - 0.2 0.1

0.2 0.1 3.4 1.2 -0.1

0.1 3.5 1.3

Here x0 = 3.1, x = 3.17, h = 0.1.

19

Solution

p = h

xx 0 = 1.0

07.0 = 0.7

Newton forward formula is:

P(x) = y0 + py0+ !2

)1( pp 2y0+ !3

)2p)(1p(p 3y0+ !4

)3p)(2p)(1p(p 4y0

P(3.17)=0+0.70.6+ 2

)17.0(7.0 (-0.2)+ 6

)27.0)(17.0(7.0 0+ 24

)37.0)(27.0)(17.0(7.0 0.1

= 0.4384

Thus f(3.17) = 0.4384.

20

NEWTON GREGORY BACKWARD INTERPOLATION FORMULA

Taking p = h

xx n , we get the interpolation formula as:

P(xn+ph) = y0 + pyn + !2

)1p(p 2yn + !3

)2p)(1p(p 3yn + +

!n

1)n (p 2) (p 1)(p p nyn

21

Estimate f(42) from the following data using newton backward interpolation.

x: 20 25 30 35 40 45

f(x): 354 332 291 260 231 204

Example

22

SolutionThe difference table is:

x f f 2f 3f 4f 5f 20 354

- 22 25 332 - 19

- 41 29 30 291 10 -37

- 31 - 8 45 35 260 2 8

- 29 0 40 231 2

- 27 45 204

Here xn = 45, h = 5, x = 42

and p = - 0.6

23

Solution

Newton backward formula is:

P(x) = yn+pyn+p(p +1)

2!2yn+

p(p +1)(p + 2)

3!3yn+

p(p +1)(p + 2)(p + 3)

4!4yn +

p(p +1)(p + 2)(p + 3)(p + 4)

5!5yn

P(42)=204+(-0.6)(-27)+ (-0.6)(0.4)

22+ (-0.6)(0.40(1.4)

60+ (-0.6)(0.4)(1.4)(2.4)

24 8 +

(-0.6)(0.4)(1.4)(2.4)(3.4)

120 45 = 219.1430

Thus, f(42) = 219.143

24

INTERPOLATION USING CENTRAL DIFFERENCES

Suppose the values of the function f (x) are known at the points a -3h, a – 2h, a – h, a, a +h, a + 2h, a + 3h, ... etc. Let these values be y-3, y-2, y-1, y0, y1, y2, y3 ..., and so on. Then we can form the central difference table as:

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

a-3h y-3

y-3

a-2h y-2 2y-3

y-2 3y-3

a-h y-1 2y-2 4y-3

y-1 3y-2 5y-3

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

y0 3y-1 5y-2

a+h y1 2y0 4y-1

y1 3y0

a+2h y2 2y1 y2

a+3h y3

We can relate the central difference operator with and E using the operator relation = E½.

25

GAUSS FORWARD INTERPOLATION FORMULA

P(x) = y0+

1

py0+

2

p2y-1+

3

1p3y-1+

4

1p4y-2 +

5

2p5y-2 + where

p = 0x-xh

and ( )pr = p( p-1) ( p-2) ( p-r+1)

r!

26

GAUSS FORWARD INTERPOLATION FORMULA

• The value p is measured forwardly from the origin and 0<p<1.

• The above formula involves odd differences below the central horizontal line and even differences on the line. This is explained in the following figure.

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

y0 3y-1 5y-2

27

Example

Find f(30) from the following table values using Gauss forward difference formula:

x: 21 25 29 33 37

F(x): 18.4708 17.8144 17.1070 16.3432 15.5154

28

Solution

The difference table is

x f f 2f 3f 4f

21 18.4708

-0.6564

25 17.8144 - 0.0510

-0.7074 - 0.0054

29 17.1070 0.0564 - 0.0022

-0.7638 - 0.0076

33 16.3432 - 0.0640

-0.8278

37 15.5154

P(x) = y0 +

1

py0 +

2

p2y-1 +

3

1p3y-1 +

4

1p4y-2 +

f (30) = 16.9217

29

GAUSS BACKWARD INTERPOLATION FORMULA

This formula is used to interpolate the value of the function for a negative value of p and – 1<p<0. By substituting for y0, 2y0, 3y0 , ....... in terms of central difference in the Newton Forward Difference formula, we get

P(x) = y0 +

1

p y-1 +

2

1p 2y-1 +

3

1p 3y-2 +

4

2p 4y-2 +…

30

GAUSS BACKWARD INTERPOLATION FORMULA

This formula involves odd differences above the central

horizontal line and even differences on the central line.

y-1 3y-2 5y-3

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

31

Example

Estimate cos 51 42' by Gauss backward interpolation from the following data:

x: 50 51 52 53 54

cos x: 0.6428 0.6293 0.6157 0.6018 0.5878

32

Solution

x0 = 52, x = 51 42' = 51.7 , h = 1

P = h

xx 0 = 1

527.51 = -0.3

The difference table is

X y y 2y 3y 4y

50 0.6428

- 0.0135

51 0.6293 - 0.0001

- 0.0136 - 0.0002

x0 = 52 0.6157 - 0.0003 0.0004

- 0.0139 - 0.0002

53 0.6018 - 0.0001

- 0.0140

54 0.5878

33

Solution

The Gauss backward formula is:

P(x) = y0 +

1

p y-1 +

2

1p 2y-1 +

3

1p 3y-2 +

3

2p 4y-2

P(51.7) = 0.6198

34

STIRLING’S FORMULA

This formula gives the average of the values obtained by Gauss forward and backward interpolation formulae. For using this formula we should have – ½ < p< ½.

We can get very good estimates if - ¼ < p < ¼.The formula is:

P(x) = y0+p

2

yy 10 +!2

p 2

2y-1+ !3

)1p(p 2

2

yy 23

13

+!4

)1p(p 2 4y-2 + ...

35

Example

Using Sterling Formula estimate f (1.63) from the following table:

x: 1.50 1.60 1.70 1.80 1.90

f(x):17.609 20.412 23.045 25.527 27.875

Solution

1.63 – 1.60p = = 0.3

0.1

X0 = 1.60, x = 1.63, h = 0.1

36

Solution

Difference table

x y y 2y 3y 2y 1.50 17.609 2.803

x0= 1.60 20.412 -0.170 2.633 0.019 1.70 23.045 -0.151 -0.02 2.482 0.017 1.80 25.527 -0.134 2.348 1.90 27.875

37

BESSELS’ INTERPOLATION FORMULA

This formula involves means of even difference on and below the central line and odd difference below the line.

The formula is

P(x) =

2 20 1 1 0

0

y y 1 p (p – 1)p – y

2 2 2! 2

y y-æ ö+ D + Dæ ö+ D +ç ÷ ç ÷è ø è ø

+

1 p (p – 1)2

3!

pæ ö-ç ÷è ø

3y-1 +

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

4! 2

æ ö+ D + Dç ÷è ø

38

Note When p = 1/2 , the terms containing odd differences vanish. Then we get the formula in a more simple form:

2 20 1 1 0y y p (p – 1)

P(x)2 2! 2

y y-æ ö+ D +D= + ç ÷è ø

BESSELS’ INTERPOLATION FORMULA

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

4! 2

æ ö+ D +D+ +ç ÷è ø

39

ExampleUse Bessels’ Formula to find (46.24)1/3 from the following table of x1/3.

X: 41 45 49 53 X1/3: 3.4482 3.5569 3.6593 3.7563

40

Solution

x0 = 45, x = 46.24, h = 4 p = 0.31

Difference table is: x Y y 2y 3y

41 3.4482

0.1087

x0 = 45 3.5569 -0.0063

0.1024 -0.00091

49 3.6593 -0.0054

0.0970

53 3.7563 Applying Bessels’ formula, we get

(46.24)1/3 = 3.5893