Title: Lagrange interpolation
1Lagrange interpolation Gives the same results as
Newton, but different method
2Formal definition for nth order interpolating
polynomial
L is defined as
3Example interpolate exp(2) using exp(1),
exp(1.5) and exp(2.5)
4Same as with Newton interpolation
Matlab code for it
5How to get the coefficients of the interpolating
polynomial (not just single points)? i.e. what
are the as in
Use second order example
with data points
6Substitute the data points into the equation
or
a Vandermonde matrix
7- Can solve with any matrix method
- - but-
- matrix is often ill-conditioned, esp. for large
n - not fastest means of getting as (special
methods for Vandermonde matrices) - Getting coefficients is generally not a good idea
8Inverse interpolation Given xs, f(x)s -
interpolation lets us get new f(x) for new
x. What about new x from new f(x)?
9A number of methods 1) Switch x and f(x) and do
new interpolation I.e. f(x)1/x
Instead of using
use
10- This may not be best way
- ill conditioned problem
Another method - fit low-order polynomial to a
few points and use root finding Still beware of
ill-conditioning!
11Example
Given f(x)1.4, what is x?
Find interpolating polynomial (quadratic)
Gauss elimination
12After backsubstitution
Use a root finding method for f(x)1.4
13Actually, in this case cant use quadratic formula
14Equally spaced data There are special algorithms
for equally spaced data If
then
15So
If
16then
Why bother?
Useful later for numerical integration Just use
Newton or Lagrange interpolation now
17Extrapolation
Basically dont Example
18Use x2,4,6 and estimate f(3) by interpolatio n
and f(8) by extrapolation
Interpolating function
19(No Transcript)