Title: Lecture 14 Interpolation Methods
1Lecture 14 - Interpolation Methods
2Lectures Goals
- Interpolation methods
- Lagranges Interpolation
- Newtons Interpolation
- Hermites Interpolation
- Rational Function Interpolation
- Spline (Linear,Quadratic, Cubic)
- Interpolation of 2-D data
3Interpolation Methods
Why would we be interested in interpolation
methods?
- Interpolation method are the basis for other
procedures that we will deal with
- Numerical differentiation
- Numerical integration
- Solution of ODE (ordinary differential equations)
and PDE (partial differential equations)
4Interpolation Methods
Why would we be interested in interpolation
methods?
- These methods demonstrate some important theory
about polynomials and the accuracy of numerical
methods. - The interpolation of polynomials serve as an
excellent introduction to some techniques for
drawing smooth curves.
5Interpolation Methods
Interpolation uses the data to approximate a
function, which will fit all of the data points.
All of the data is used to approximate the values
of the function inside the bounds of the data.
We will look at polynomial and rational function
interpolation of the data and piece-wise
interpolation of the data.
6Polynomial Interpolation Methods
- Lagrange Interpolation Polynomial - a
straightforward, but computational awkward way to
construct an interpolating polynomial. - Newton Interpolation Polynomial - there is no
difference between the Newton and Lagrange
results. The difference between the two is the
approach to obtaining the coefficients.
7Lagrange Interpolation
This method is generally the easiest to work.
The data does not have to be equally spaced and
is useful for finding the points between
quadratic and cubic methods. However, it does
not provide an accurate model for large sets of
terms.
8Lagrange Interpolation
The function can be defined as
where,
9Lagrange Interpolation
The function can be defined as
where, the coefficients are defined as
10Lagrange Interpolation
The method works for quadratic and cubic
polynomials. As you add additional points in the
degree of the polynomial increases. So if you
have n points it will fit a (n-1)th degree
polynomial.
11Example of Lagrange Interpolation
What are the coefficients of the polynomial and
what is the value of P2(2.3)?
12Example of Lagrange Interpolation
- The values are evaluated
- P(x) 9.2983(x-1.7)(x-3.0)
- - 19.4872(x-1.1)(x-3.0)
- 8.2186(x-1.1)(x-1.7)
- P(2.3) 9.2983(2.3-1.7)(2.3-3.0)
- - 19.4872(2.3-1.1)(2.3-3.0)
- 8.2186(2.3-1.1)(2.3-1.7)
- 18.3813
13Lagrange Interpolation Program
The Lagrange interpolation is broken up into two
programs to evaluate the new polynomial.
- C Lagrange_coef(x,y), which evaluates the
coefficients of the Lagrange technique - P(x) Lagrange_eval(t,x,c), which uses the
coefficients and x values to evaluate the
polynomial - Plottest(x,y),which will plot the Lagrange
polynomial
14Example of Lagrange Interpolation
What happens if we increase the number of data
points?
Coefficient for 2 is
15Example of Lagrange Interpolation
Note that the coefficient creates a P4(x)
polynomial and comparison between the two curves.
The original value P2(x) is given. The problem
with adding additional points will create
bulges in the graph.
16Newton Interpolation
The Newton interpolation uses a divided
difference method. The technique allows one to
add additional points easily.
17Newton Interpolation
For given set of data points (x1,y1), (x2,y2),
(x3,y3)
18Newton Interpolation
The function can be defined as
19Newton Interpolation
The method works for quadratic and cubic
polynomials. As you add additional points in the
degree of the polynomial increases. So if you
have n points it will fit a (n-1)th degree
polynomial. The method is setup to show the a
pattern for combining a table computation and
provide additional points.
20Example of Newton Interpolation
What are the coefficients of the polynomial and
what is the value of P2(2.3)?
The true function of the points is f(x) 2x
21Example of Newton Interpolation
22Example of Newton Interpolation
The coefficients are the top row of the chart
23Example of Newton Interpolation
- The values are evaluated
- P(x) 1 (x-0)
- 0.5(x-0)(x-1)
- 0.1667(x-0)(x-1)(x-2)
- 0.04167(x)(x-1)(x-2)(x-3)
- P(2.3) 1 (2.3)
- 0.5(2.3)(1.3)
- 0.1667(2.3)(1.3)(0.3)
- 0.04167(2.3)(1.3)(0.3)(-0.7)
- 4.9183 (4.9246)
24Newton Interpolation Program
The Newton interpolation is broken up into two
programs to evaluate the new polynomial.
- C Newton_coef(x,y), which evaluates the
coefficients of the Newton technique - P(x) Newton_eval(t,x,c), which uses the
coefficients and x values to evaluate the
polynomial - Plottest_new(x,y),which will plot the Newton
polynomial
25Summary
- The Lagrange and Newton Interpolation are
basically the same methods, but use different
coefficients. The polynomials depend on the
entire set of data points.
26Homework
- Check the Homework webpage