Interpolation Part1

18

Transcript of Interpolation Part1

Page 1: Interpolation Part1
Page 2: Interpolation Part1

A polynomial p(x) of degree less than or equal to n is an interpolating polynomial for f(x) on the interval [x0,xn] if it satisfies the condition

NodesInterpolation points or Knots or Data Points

p(x) interpolates f(x)

iii yxpxf )()( ni ,...,2,1,0

nxxxx ,...,,, 210

),(),...,,(),,(),,( 221100 nn yxyxyxyx

Page 3: Interpolation Part1

Consider the following data points (0,-1), (1,2),(2,7) for a

function f(x). Let . Show that p(x) interpolates f(x).

Let f(x)=sinx. Show that the polynomial

interpolates f at nodes .

12)( 2 xxxp

xxxp44

)( 22

,2,0

Page 4: Interpolation Part1

where

Note:

Remark

n

iii xLyxp

0

)()(

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

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

)(

)()(

1110

1110

,0

niiiiii

nii

n

jij ji

ji

xxxxxxxxxx

xxxxxxxxxx

xx

xxxL

1)( ii xL jixL ji ,0)(

)( ii xfy

Page 5: Interpolation Part1

Using the nodes x0=2, x1=2.5, x2=4, find the second degree interpolating polynomial for the function f(x)=1/x. Use the interpolating polynomial to approximate f(3).

Page 6: Interpolation Part1
Page 7: Interpolation Part1

Since

Solve the unknowns by Gauss Jordan Elimination Method.

nnxaxaxaaxp ...)( 2

210

nixpxf ii ,...,2,1,0),()(

naaaa ,...,,, 210

Page 8: Interpolation Part1

Use the method of undetermined coefficients to find an interpolating polynomial for the function that passes through the points (-1,8),(0,5), (1,2) and (2,5).

33

2210)( xaxaxaaxp

Page 9: Interpolation Part1

Augmented Matrix

3

3210

45)(

1,0,4,5

xxxp

aaaa

Page 10: Interpolation Part1

Consider an interpolating polynomial of the form

NEWTON’S FORMDivide successively p(x) by the linear factors

Then work backwards to express it in

nnxaxaxaaxp ...)( 2

210

))...((...

))(()()(

10

102010

nn xxxxc

xxxxcxxccxp

))...((),(),( 1210 nxxxxxxxx

Page 11: Interpolation Part1

Find the Newton’s Form of the interpolating polynomial

obtained from the interpolation points (0,-1),(1,2) and (2,7).

Solution: We divide successively by (x-0) and (x-1). To get

12)( 2 xxxp

Page 12: Interpolation Part1

Working backwards, we write

The coefficients ck are called divided differences.

Page 13: Interpolation Part1

Zero-th Divided Differences are the corresponding function values of the nodes.

First Divided Differences wrt to and

Kth divided difference relative to nodes

ii

iiii xx

xfxfxxf

1

11

][][,

)(][ ii xfxf

ix 1ix

kiii xxx ,...,, 1

iki

kikiiikikiiikikiii xx

xxxxfxxxxfxxxxf

],,...,,[],,...,,[,,...,, 11111111

nk xxxxfc ,...,,, 210

Page 14: Interpolation Part1

When we have nodes

If nodes are re-ordered as , then we can write

the interpolating polynomial as

))...((,...,,,...

))((,,)(,)(

0210

102100100

nn xxxxxxxxf

xxxxxxxfxxxxfxfxp

nk xxxxfc ,...,,, 210

))...((,...,,,...

))((,,)(,)(

0210

1121

xxxxxxxxf

xxxxxxxfxxxxfxfxp

nn

nnnnnnnnn

nxxxx ...,,, 210

021 ...,,, xxxx nnn

Page 15: Interpolation Part1
Page 16: Interpolation Part1

Example: Take as the function to be interpolated, using the nodes

xxf 2log)(

.4,2,1 210 xxx

kkx kxf

0

1

2 4

2

1

1

2 2

1

0

1

6

1

)8)(1(6

1)2)(1(

6

1)1)(1(0)(2 xxxxxxp

1, kk xxf 21,, kkk xxxf

Page 17: Interpolation Part1

Table of Divided Difference Method

Example: Take as the function to be interpolated, using the nodes

xxf 2log)(

.4,2,1 210 xxx

kkx

0

1

2 4

2

1

1

01

22

16

1

)8)(1(6

1)2)(4(

6

1)4(

2

12)(2

xxxxxxp

kxf 1, kk xxf 21,, kkk xxxf

Page 18: Interpolation Part1

EXAMPLEGiven the divided difference table below, find

the interpolating using Newton’s interpolatory divided difference formula and use this to approximate f(1.5)

f(1.5)~p4(1.5)=.511820