Lagrange interpolation Gives the same results as Newton, but different method
Formal definition for nth order interpolating polynomial L is defined as
Example: interpolate exp(2) using exp(1), exp(1.5) and exp(2.5)
Same as with Newton interpolation Matlab code for it
How to get the coefficients of the interpolating polynomial (not just single points)? i.e. what are the a’s in Use second order example with data points
Substitute the data points into the equation or a Vandermonde matrix
Can solve with any matrix method - but- matrix is often ill-conditioned, esp. for large n not fastest means of getting a’s (special methods for Vandermonde matrices) Getting coefficients is generally not a good idea
Inverse interpolation Given x’s, f(x)’s - interpolation lets us get new f(x) for new x. What about new x from new f(x)?
A number of methods 1) Switch x and f(x) and do new interpolation I.e. f(x)=1/x Instead of usinguse
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!
Example: Given f(x)=1.4, what is x? Find interpolating polynomial (quadratic) Gauss elimination
After backsubstitution Use a root finding method for f(x)=1.4
Actually, in this case can’t use quadratic formula
Equally spaced data There are special algorithms for equally spaced data If then
So If
then Why bother? Useful later for numerical integration Just use Newton or Lagrange interpolation now
Extrapolation Basically don’t Example:
Use x=2,4,6 and estimate f(3) by interpolatio n and f(8) by extrapolation Interpolating function