Presentation is loading. Please wait.

Presentation is loading. Please wait.

Lagrange interpolation Gives the same results as Newton, but different method.

Similar presentations


Presentation on theme: "Lagrange interpolation Gives the same results as Newton, but different method."— Presentation transcript:

1 Lagrange interpolation Gives the same results as Newton, but different method

2 Formal definition for nth order interpolating polynomial L is defined as

3 Example: interpolate exp(2) using exp(1), exp(1.5) and exp(2.5)

4 Same as with Newton interpolation Matlab code for it

5 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

6 Substitute 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 a’s (special methods for Vandermonde matrices) Getting coefficients is generally not a good idea

8 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)?

9 A number of methods 1) Switch x and f(x) and do new interpolation I.e. f(x)=1/x Instead of usinguse

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!

11 Example: Given f(x)=1.4, what is x? Find interpolating polynomial (quadratic) Gauss elimination

12 After backsubstitution Use a root finding method for f(x)=1.4

13 Actually, in this case can’t use quadratic formula

14 Equally spaced data There are special algorithms for equally spaced data If then

15 So If

16 then Why bother? Useful later for numerical integration Just use Newton or Lagrange interpolation now

17 Extrapolation Basically don’t Example:

18 Use x=2,4,6 and estimate f(3) by interpolatio n and f(8) by extrapolation Interpolating function

19


Download ppt "Lagrange interpolation Gives the same results as Newton, but different method."

Similar presentations


Ads by Google