mat 4725 numerical analysis section 3.1 interpolation and the lagrange polynomial
TRANSCRIPT
MAT 4725Numerical Analysis
Section 3.1
Interpolation and the Lagrange Polynomial
http://myhome.spu.edu/lauw
MCM Monday
Non-class members are invited Please share! Office names and $100
HW 7b (d)
HW 7b (e)
Material Temperature.Temp
x
Material Temperature.Temp
x5
?
Interpolation
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
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.
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?
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?
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
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
Example 1
Find the 2nd Lagrange Polynomial P(x)
0 1 2
1( ) ; 2, 2.5, 4f x x x x
x
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
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
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?
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
Classwork 1, 2
Write a program to compute the 2nd Lagrange Polynomial
INPUT: (xi,f(xi)) i=0,1,2 OUTPUT: P(x)
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]);
Hints
Hints are provided in the handout.
Homework
Download Homework from the web. Read the first 4 pages of 3.5 for
Wednesday