03 Interpolation
03 Interpolation
03 Interpolation
Interpolation
Interpolation is important concept in
numerical analysis.
Quite often functions may not be available
explicitly but only the values of the function
at a set of points.
Interpolation
Interpolation is important concept in
numerical analysis.
Quite often functions may not be available
explicitly but only the values of the function
at a set of points.
The values for f(xi) may be the results from
a physical measurement (conductivity at
different points around UWI)
Interpolation
It may also be from some long numerical
calculation which cant be put into a simple
equation.
Interpolation
It may also be from some long numerical
calculation which cant be put into a simple
equation.
What is required is that we estimate f(x)!
i.e. Draw a smooth curve through xi.
Interpolation
The method of estimating between two
known points (values) is called
interpolation.
While estimating outside of know values is
called extrapolation.
Interpolation
1.
2.
3.
4.
Interpolation
Theory
1.
2.
3.
4.
Polynomial Approximation
Polynomials satisfy a uniqueness theorem:
A polynomial of degree n passing exactly
through n + 1 points is unique.
The polynomial through a specific set of points
may take different forms, but all forms are
equivalent. Any form can be manipulated into
another form by simple algebraic rearrangement.
Polynomial Approximation
The Taylor series is a polynomial of infinite
order. Thus
(x) = (x0) + '(x0)(x - x0) + 1/2! ''(x0) (x - x0)2+..
Polynomial Approximation
Taylor polynomial of degree n is therefore
usually defined as
(x) = Pn(x) + Rn + 1(x)
where the Taylor polynomial Pn(x) and the
remainder term Rn + 1(x) are given by
Pn(x) = (x0) + '(x0)(x - x0) + + 1/n! n(x0) (x - x0)n
where x0<x.
Polynomial Approximation
The Taylor polynomial is a truncated Taylor series,
with an explicit remainder, or error term.
The Taylor polynomial cannot be used as an
approximating function for discrete data, because
the derivatives required in the coefficients cannot
be determined.
It does have great significance, however, for
polynomial approximation because it has an
explicit error term.
Polynomial Approximation
When a polynomial of degree n, Pn(x), is fitted
exactly to a set of n + 1 discrete data points, (x0, f0),
(x1, f1), , (xn, fn), the polynomial has no error at the
data points themselves. However, at the locations
between the data points, there is an error, which is
defined by
E(x) = (x) - Pn(x)
This error term has the form
E(x) = 1/(n+1)! (x - x0) (x x1) (x xn) n+1( );
x0x.
Interpolation
In Practice
Interpolating Polynomials
Interpolating Polynomials
Suppose we are given some values, the
principle is that we fit a polynomial curve to
the data.
The reason for this is that polynomials are
well-behaved functions, requiring simple
arithmetic calculations.
Interpolating Polynomials
Approximating polynomial (interpolating
polynomial) should pass through all the
known points.
Where it does not pass through the points it
should be close to the function.
Interpolating Polynomials
Approximating
polynomial
(interpolating
polynomial) should
pass through all the
known points.
Where it does not pass
through the points it
should be close to the
function.
True function
Approx 1
Approx 2
Interpolating Polynomials
Note that the interpolating
polynomial may miss
points of discontinuity.
There is only one
interpolating polynomial
P(xi) or less that matches
the exact values; f(x0),
f(x1),, f(xn) at n+1
distinct base points.
True function
Approx 1
Approx 2
Interpolating Polynomials
Using Polynomials to approximate a
function given discrete points
Interpolating Polynomials
Lagrange Interpolation
Lagrange Polynomials
A straightforward approach is the use of
Lagrange polynomials.
The Lagrange Polynomial may be used
where the data set is unevenly spaced.
Lagrange Polynomials
The formula used to interpolate between
data pairs (x0,f(x0)), (x1,f(x1)),, (xn,f(xn)) is
given by,
n
P x Pj x
j 1
Pj x y j
k 1
k j
x xk
x j xk
Lagrange Polynomials
In general,
x x2 x x3 ... x xn
P x y1
x1 x2 x1 x3 ... x1 xn
x x1 x x3 ... x xn
y2
...
x2 x1 x2 x3 ... x2 xn
x x1 x x2 ... x xn 1
yn
xn x1 xn x2 ... xn xn 1
Lagrange Polynomials
Consider the table of interpolating points
we wish to fit.
i
f(x)
x0
f(x0)
x1
f(x1)
x2
f(x2)
x3
f(x3)
Lagrange Polynomials
i
f(x)
x0
f(x0)
x1
f(x1)
x2
f(x2)
x3
f(x3)
x x1 x x2 x x3
x x0 x x2 x x3
P x
f x0
f x1
x0 x1 x0 x2 x0 x3
x1 x0 x1 x2 x1 x3
x x0 x x1 x x3 f x x x0 x x1 x x2 f x
x2 x0 x2 x1 x2 x3 2 x3 x0 x3 x1 x3 x2 3
Lagrange Polynomials
Note that the Lagrangian polynomial passes
through each of the points used in its
construction.
Advantages
The Lagrange formula is popular because it
is well known and is easy to code.
Also, the data are not required to be
specified with x in ascending or descending
order.
Disadvantages
Although the computation of Pn(x) is simple, the
method is still not particularly efficient for large
values of n.
When n is large and the data for x is ordered, some
improvement in efficiency can be obtained by
considering only the data pairs in the vicinity of the
x value for which Pn(x) is sought.
The price of this improved efficiency is the
possibility of a poorer approximation to Pn(x).
f x0 , x1
x0 x1
defined as f x0 , x1 x x
0
1
The second difference is given as:
f x0 , x1 f x1 , x2
f x0 , x1 , x2
x0 x2
In general,
f x0 ,..., xn 1 f x1 , xn
f x0 , x1 ,..., xn
x0 xn
f(x)
x0
f(x0)
x1
f(x1)
x2
f(x2)
x3
f(x3)
P x a0 a1 x a2 x 2 ... an 1 x x 1
True Curve