mat 4725 numerical analysis section 3.1 interpolation and the lagrange polynomial

21
MAT 4725 Numerical Analysis Section 3.1 Interpolation and the Lagrange Polynomial http://myhome.spu.edu/lauw

Upload: alice-simpson

Post on 31-Dec-2015

233 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: MAT 4725 Numerical Analysis Section 3.1 Interpolation and the Lagrange Polynomial

MAT 4725Numerical Analysis

Section 3.1

Interpolation and the Lagrange Polynomial

http://myhome.spu.edu/lauw

Page 2: MAT 4725 Numerical Analysis Section 3.1 Interpolation and the Lagrange Polynomial

MCM Monday

Non-class members are invited Please share! Office names and $100

Page 3: MAT 4725 Numerical Analysis Section 3.1 Interpolation and the Lagrange Polynomial

HW 7b (d)

Page 4: MAT 4725 Numerical Analysis Section 3.1 Interpolation and the Lagrange Polynomial

HW 7b (e)

Page 5: MAT 4725 Numerical Analysis Section 3.1 Interpolation and the Lagrange Polynomial

Material Temperature.Temp

x

Page 6: MAT 4725 Numerical Analysis Section 3.1 Interpolation and the Lagrange Polynomial

Material Temperature.Temp

x5

?

Interpolation

Page 7: MAT 4725 Numerical Analysis Section 3.1 Interpolation and the Lagrange Polynomial

3.1 Goal

Find a polynomial P(x) that passes through all the data points (xi,yi), i=0,1,2,…,n

Use P(x) to estimate the function values

Page 8: MAT 4725 Numerical Analysis Section 3.1 Interpolation and the Lagrange Polynomial

A Simple Situation

Suppose there are only 2 data points:

(x0,f(x0)), (x1,f(x1))

Let us find a degree one poly. P(x) that passes through them.

Page 9: MAT 4725 Numerical Analysis Section 3.1 Interpolation and the Lagrange Polynomial

A Simple Situation

Suppose there are only 2 data points:

(x0,f(x0)), (x1,f(x1))

Let us find a degree one poly. P(x) that passes through them

Q: Why degree one?

Page 10: MAT 4725 Numerical Analysis Section 3.1 Interpolation and the Lagrange Polynomial

A Simple Situation

Suppose there are only 2 data points:

(x0,f(x0)), (x1,f(x1))

Let us find a degree one poly. P(x) that passes through them

Q: We know easier way to find a straight line through two points. Why the trouble?

Page 11: MAT 4725 Numerical Analysis Section 3.1 Interpolation and the Lagrange Polynomial

In General…

Suppose there are (n+1) data points:

(xi,f(xi)) i=0,1,2,…,n

Let us find a degree n poly. P(x) that passes through them

Page 12: MAT 4725 Numerical Analysis Section 3.1 Interpolation and the Lagrange Polynomial

n-th Lagrange Interpolating Poly.

0

0 0 1 1

( ) ( ) ( )

( ) ( ) ( ) ( ) ( ) ( )

n

k kk

n n

P x f x L x

f x L x f x L x f x L x

Page 13: MAT 4725 Numerical Analysis Section 3.1 Interpolation and the Lagrange Polynomial

Example 1

Find the 2nd Lagrange Polynomial P(x)

0 1 2

1( ) ; 2, 2.5, 4f x x x x

x

Page 14: MAT 4725 Numerical Analysis Section 3.1 Interpolation and the Lagrange Polynomial

Example 1 0 1 2

1( ) ; 2, 2.5, 4f x x x x

x

20

21

22

2

( ) 6.5 10

4( ) 6 8

31

( ) 4.5 53

( ) 0.05 0.425 1.15

L x x x

L x x x

L x x x

P x x x

Page 15: MAT 4725 Numerical Analysis Section 3.1 Interpolation and the Lagrange Polynomial

Example 1 0 1 2

1( ) ; 2, 2.5, 4f x x x x

x

1y

x

20.05 0.425 1.15y x x

Page 16: MAT 4725 Numerical Analysis Section 3.1 Interpolation and the Lagrange Polynomial

Example 1 0 1 2

1( ) ; 2, 2.5, 4f x x x x

x

1y

x

20.05 0.425 1.15y x x

Q: For what range will P(x) give good estimations?

Page 17: MAT 4725 Numerical Analysis Section 3.1 Interpolation and the Lagrange Polynomial

Error Formula

We will skip the error analysis (similar to Taylor poly.)

We will see this again in section 4.1

( 1)

0 1

( ( ))( ) ( ) ( )( ) ( )

( 1)!

where [a,b], ( ) ( , )

n

n

i

f xf x P x x x x x x x

n

x x a b

Page 18: MAT 4725 Numerical Analysis Section 3.1 Interpolation and the Lagrange Polynomial

Classwork 1, 2

Write a program to compute the 2nd Lagrange Polynomial

INPUT: (xi,f(xi)) i=0,1,2 OUTPUT: P(x)

Page 19: MAT 4725 Numerical Analysis Section 3.1 Interpolation and the Lagrange Polynomial

Remark #1

(xi,f(xi)) are passed into the program as two arrays:xx=[x0,x1,x2], yy=[y0,y1,y2]

>xx:=array(0..2,[2, 2.5, 4]);

yy:=array(0..2,[0.5, 0.4, 0.25]);

Page 20: MAT 4725 Numerical Analysis Section 3.1 Interpolation and the Lagrange Polynomial

Hints

Hints are provided in the handout.

Page 21: MAT 4725 Numerical Analysis Section 3.1 Interpolation and the Lagrange Polynomial

Homework

Download Homework from the web. Read the first 4 pages of 3.5 for

Wednesday