interpolation functions

44
Interpolation produces a function that matches the given data exactly. The function then can be utilized to approximate the data values at intermediate points.

Upload: tarun-gehlot

Post on 01-Nov-2014

540 views

Category:

Education


2 download

DESCRIPTION

Interpolation functions

TRANSCRIPT

Page 1: Interpolation functions

Interpolation produces a function that matches the given data exactly. The function then can be utilized to approximate the data values at intermediate points.

Page 2: Interpolation functions

Interpolation may also be used to produce a smooth graph of a function for which values are known only at discrete points, either from measurements or calculations.

Page 3: Interpolation functions

Given data points

Obtain a function, P(x)

P(x) goes through the data points

Use P(x)

To estimate values at intermediate points

Page 4: Interpolation functions

Given data points:

At x0 = 2, y0 = 3 and at x1 = 5, y1 = 8

Find the following:

At x = 4, y = ?

Page 5: Interpolation functions

x

y

2 5

3

8

?

4

P(x)

Page 6: Interpolation functions

P(x) should satisfy the following conditions:

P(x = 2) = 3 and P(x = 5) = 8

xLxLxP 10 83

P(x) can satisfy the above conditions if

at x = x0 = 2, L0(x) = 1 and L1(x) = 0 and

at x = x1= 5, L0(x) = 0 and L1(x) = 1

Page 7: Interpolation functions

The conditions can be satisfied if L0(x) and L1(x) are defined in the following way.

25

2and

52

510

x

xLx

xL

At x = x0 = 2, L0(x) = 1 and L1(x) = 0 and

at x = x1= 5, L0(x) = 0 and L1(x) = 1

01

01

10

10 and

xx

xxxL

xx

xxxL

Page 8: Interpolation functions

xLxLxP 10 83

1100 yxLyxLxP

1100 xfxLxfxLxP

Lagrange Interpolating Polynomial

Page 9: Interpolation functions

1100 xfxLxfxLxP

825

23

52

5

xx

xP

3

15 x

xP

33363

1454 .P

Page 10: Interpolation functions

The Lagrange interpolating polynomial passing through three given points; (x0, y0), (x1, y1) and (x2, y2) is:

22

1100

xfxL

xfxLxfxLxP

221100 yxLyxLyxLxP

Page 11: Interpolation functions

2010

210 xxxx

xxxxxL

At x0, L0(x) becomes 1. At all other given data points L0(x) is 0.

Page 12: Interpolation functions

2101

201 xxxx

xxxxxL

At x1, L1(x) becomes 1. At all other given data points L1(x) is 0.

Page 13: Interpolation functions

1202

102 xxxx

xxxxxL

At x2, L2(x) becomes 1. At all other given data points L2(x) is 0.

Page 14: Interpolation functions

nn yxL...........

yxLyxLyxLxP

221100

nn xfxL...........xfxL

xfxLxfxLxP

22

1100

General form of the Lagrange Interpolating Polynomial

Page 15: Interpolation functions

))...()()...()((

))...()()...()(()(

nkkkkkkk

nkkk xxxxxxxxxx

xxxxxxxxxxxL

1110

1110

n

kii ik

ik xx

xxxL

0 )(

)()(

Page 16: Interpolation functions

0 1 2

1 1

1

k k

n n

x x x x x x

x x x x

x x x x

Numerator of kL x

Page 17: Interpolation functions

Denominator of

0 1 2

1 1

1

k k k

k k k k

k n k n

x x x x x x

x x x x

x x x x

kL x

Page 18: Interpolation functions

Find the Lagrange Interpolating Polynomial using the three given points.

2504

4052

502

22

11

00

.,y,x

.,.y,x

.,y,x

Page 19: Interpolation functions

2010

210 xxxx

xxxxxL

1056

42522

452

2

0

x.x

.

x.xxL

Page 20: Interpolation functions

750

86

452252

42

2

1

.

xx

..

xxxL

2101

201 xxxx

xxxxxL

Page 21: Interpolation functions

3

554

52424

522

2

2

x.x

.

.xxxL

1202

102 xxxx

xxxxxL

Page 22: Interpolation functions

22

1100

xfxL

xfxLxfxLxP

Page 23: Interpolation functions

2503

554

40750

86

501056

2

2

2

.x.x

..

xx

.x.xxP

Page 24: Interpolation functions

1514250050 2 .x.x.xP

The three given points were taken from the function

x

xf1

Page 25: Interpolation functions

325.0

15.13425.0305.032

P

333.03

13 f

An approximation can be obtained from the Lagrange Interpolating Polynomial as:

Page 26: Interpolation functions

Newton’s Interpolating Polynomials

Newton’s equation of a function that passes through two points

00 y,x and 11 y,x is

010 xxaaxP

Page 27: Interpolation functions

Set0xx

0 0 0P x y a

Set1x x

1 1 0 1 1 0P x y a a x x

010 xxaaxP

Page 28: Interpolation functions

01

011 xx

yya

Newton’s equation of a function that passes through three points

00 y,x and 11 y,xis

2 2x , y

Page 29: Interpolation functions

0 1 0

2 0 1

P x a a x x

a x x x x

To find

2a , set2xx

2 0 1 2 0

2 2 0 2 1

P x a a x x

a x x x x

Page 30: Interpolation functions

1 02 1

2 1 1 02

2 0

y yy yx x x x

ax x

Page 31: Interpolation functions

Newton’s equation of a function that passes through four points can be written by adding a fourth term .

0 1 0

2 0 1

P x a a x x

a x x x x

3 0 1 2 a x x x x x x

Page 32: Interpolation functions

0 1 0

2 0 1

3 0 1 2

P x a a x x

a x x x x

a x x x x x x

The fourth term will vanish at all three previous points and, therefore, leaving all three previous coefficients intact.

Page 33: Interpolation functions

Divided differences and the coefficientsf

ix if xThe divided difference of a function,

with respect to is denoted as

It is called as zeroth divided difference and is simply the value of the function, fat ix

ii xfxf

Page 34: Interpolation functions

1i if x , x

fThe divided difference of a function,

called as the first divided difference, is denoted ixwith respect to and 1ix

11

1

i ii i

i i

f x f xf x , x

x x

Page 35: Interpolation functions

fThe divided difference of a function,

called as the second divided difference, is denoted as

ixwith respect to and1ix , 2ix

1 2i i if x , x , x

1 2 11 2

2

i i i ii i i

i i

f x , x f x , xf x , x , x

x x

Page 36: Interpolation functions

1 2 3

1 2 3 1 2

3

i i i i

i i i i i i

i i

f x , x , x , x

f x , x , x f x , x , x

x x

The third divided difference with respect to

ix 1ix 2ix 3ix , and ,

Page 37: Interpolation functions

The coefficients of Newton’s interpolating polynomial are:

00 xfa

101 x,xfa

2102 x,x,xfa

32103 x,x,x,xfa

432104 x,x,x,x,xfa and so on.

Page 38: Interpolation functions

x xf First

divided differences

Second

divided differences

Third

divided differences

0x 0xf

01

0110 xx

xfxfx,xf

1x 1xf 02

1021210 xx

x,xfx,xfx,x,xf

12

1221 xx

xfxfx,xf

03

2103213210 xx

x,x,xfx,x,xfx,x,x,xf

2x 2xf 13

2132321 xx

x,xfx,xfx,x,xf

23

2332 xx

xfxfx,xf

14

3214324321 xx

x,x,xfx,x,xfx,x,x,xf

3x 3xf 24

3243432 xx

x,xfx,xfx,x,xf

34

3443 xx

xfxfx,xf

25

4325435432 xx

x,x,xfx,x,xfx,x,x,xf

4x 4xf 35

4354543 xx

x,xfx,xfx,x,xf

45

4554 xx

xfxfx,xf

5x 5xf

Page 39: Interpolation functions

ExampleFind Newton’s interpolating polynomial to approximate a function whose 5 data points are given below.

f x

2.0 0.85467

2.3 0.75682

2.6 0.43126

2.9 0.22364

3.2 0.08567

x

Page 40: Interpolation functions

i ix ixf ii x,xf 1 iii x,x,xf 12 ii x,,xf 3 ii x,,xf 4

0 2.0 0.85467

-0.32617

1 2.3 0.75682 -1.26505

-1.08520 2.13363

2 2.6 0.43126 0.65522 -2.02642

-0.69207 -0.29808

3 2.9 0.22364 0.38695

-0.45990

4 3.2 0.08567

Page 41: Interpolation functions

The 5 coefficients of the Newton’s interpolating polynomial are:

0 0 0 85467a f x .

1 0 1 0 32617a f x , x .

2 0 1 2 1 26505a f x , x , x .

3 0 1 2 3 2 13363a f x , x , x , x .

4 0 1 2 3 4 2 02642a f x , x , x , x , x .

Page 42: Interpolation functions

0 1 0

2 0 1

3 0 1 2

4 0 1 2 3

P x a a x x

a x x x x

a x x x x x x

a x x x x x x x x

Page 43: Interpolation functions

0 85467 0 32617 2 0

-1.26505 2 0 2 3

2 13363 2 0 2 3 2 6

2 02642 2 0 2 3 2 6 2 9

P x . . x .

x . x .

. x . x . x .

. x . x . x . x .

P(x) can now be used to estimate the value of the function f(x) say at x = 2.8.

Page 44: Interpolation functions

2 8 0 85467 0 32617 2 8 2 0

-1.26505 2 8 2 0 2 8 2 3

2 13363 2 8 2 0 2 8 2 3 2 8 2 6

2 02642 2 8 2 0 2 8 2 3 2 8 2 6 2 8 2 9

P . . . . .

. . . .

. . . . . . .

. . . . . . . . .

2 8 2 8 0 275f . P . .