0% found this document useful (0 votes)
104 views18 pages

Part 5b: Interpolation

The document discusses different methods of polynomial interpolation for estimating values between data points, including: 1) Newton's divided differences method, which uses finite differences to determine polynomial coefficients; 2) Lagrange polynomial interpolation, which expresses the interpolating polynomial as a linear combination of basis polynomials; 3) Inverse interpolation, which finds the independent variable value corresponding to a given dependent variable value. 4) Spline interpolation is also mentioned but not described. Error analysis and computational considerations are discussed for different interpolation methods.

Uploaded by

DocTor DOOM
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
104 views18 pages

Part 5b: Interpolation

The document discusses different methods of polynomial interpolation for estimating values between data points, including: 1) Newton's divided differences method, which uses finite differences to determine polynomial coefficients; 2) Lagrange polynomial interpolation, which expresses the interpolating polynomial as a linear combination of basis polynomials; 3) Inverse interpolation, which finds the independent variable value corresponding to a given dependent variable value. 4) Spline interpolation is also mentioned but not described. Error analysis and computational considerations are discussed for different interpolation methods.

Uploaded by

DocTor DOOM
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 18

Part 5b:

INTERPOLATION
– Newton’s Divided-Differences
– Lagrange Polynomial Interpolation
– Inverse Interpolation
– Spline Interpolation
Introduction:
 Interpolation is the process of estimating intermediate values
between precisely defined data points.
For n+1 scattered data points there is a unique n-th order
polynomial fit function.
n+1=3 n+1=4
n+1=2

 Polynomial interpolation is the process of determining the unique


nth-order polynomial that fits (n+1) data points.
One can define the n-th order polynomial in different formats, e.g.,
Newton polynomials These formats are well-suited for
Lagrange polynomials computational implementations
Newton’s Divided Differences
 One of the most popular interpolating functions
Linear interpolation:
 Simplest form of interpolation: connect two data points by a
straight line, and estimate the intermediate value. underlying
function
f(x) f1(x) fit function Similarity of the triangles:
f1 ( x) f ( x0 ) f ( x1 ) f ( x0 )
f(x1) x x0 x1 x0
f1(x) finite divided difference
of first derivative
f(x0)
f ( x1 ) f ( x0 )
f1 ( x) f ( x0 ) ( x x0 )
x0 x x1 x1 x0
for data points
f1 ( xi ) f ( xi ) represents the first
order interpolation
linear interpolation formula
Quadratic interpolation:
 If you have three data points, you can introduce some curvature
for a better fitting.
 A second-order polynomial (quadratic polynomial) of the form
If you expand the
f 2 ( x) b0 b1 ( x x0 ) b2 ( x x0 )( x x1 )
terms, this is nothing
different a general
To determine the values of the coefficients; polynomial
x x0 b0 f ( x0 )
Linear
f ( x1 ) f ( x0 ) interpolation
x x1 b1 formula Quadratic
x1 x0
interpolation
formula
f ( x2 ) f ( x1 ) f ( x1 ) f ( x0 )
x x2 x2 x1 x1 x0
b2 finite divided
( x2 x0 ) difference of
second derivative
General form of Newton’s interpolating polynomials:
In general, to fit an n-the order Newton’s polynomial to (n+1) data
points:
f n ( x) b0 b1 ( x x0 ) b2 ( x x0 )( x x1 ) .. bn ( x x0 )( x x1 )..( x xn 1 )

where the coefficients:


b0 f [ x0 ] data points brackets represent the
function evaluations for
b1 f [ x1 , x0 ] finite divided-differences
b2 f [ x2 , x1 , x0 ]
n-th finite divided difference:

f [ xn , xn 1 ,.., x1 , x0 ]
bn f [ xn , xn 1 ,.., x1 , x0 ]
f [ xn , xn 1 ,.., x1 ] f [ xn 1 ,.., x1 , x0 ]
( xn x0 )
 These differences can be evaluated for the coefficients and
substituted into the fitting function.

f n ( x) f ( x0 ) ( x x0 ) f [ x1 , x0 ] ( x x0 )(x x1 ) f [ x2 , x1 , x0 ]
.. ( x x0 )(x x1 )..(x xn 1 ) f [ xn , xn 1 ,.., x0 ]

 x values are not need to be equally Newton’s divided-


spaced. difference interpolating
 x values are not necessarily in order. polynomial
Error for Newton’s interpolating polynomials:
 Newton’s divided difference formula is similar to Taylor
expansion formula, adding higher order derivatives of the
underlying function.
 A truncation error can be defined as in the case of Taylor series
approximation:

f ( n 1) ( )
For Taylor series
Rn ( x x0 )( x x1 )..( x xn ) approximation error
(n 1)!
f ( n 1) ( )
where is somewhere in the Rn ( xi 1 xi ) n 1

(n 1)!
interval containing the unknown
and the data.

Above formulation requires prior knowledge of the underlying


function and its derivative, so cannot be evaluated.
An alternative formulation that does not require prior knowledge
of the underlying function:
Rn f [ x, xn , xn 1 ,..., x0 ]( x x0 )( x x1 )..( x xn )

(n+1)th finite
divided difference

 One more data point (xn+1) is needed to evaluate the equation.

Rn f [ xn 1 , xn , xn 1 ,..., x0 ]( x x0 )( x x1 )..( x xn )

This relationship is equivalent to


Rn f n 1 ( x) f n ( x) (next estimate) - (current estimate)

increment added to the (n)th order case


f n 1 ( x) f n ( x) Rn to calculate (n+1)th order case is equal to
the error for the n-th order case.
Lagrange Polynomial Interpolation
A Lagrange polynomial can be stated concisely as

n n x xj
f n ( x) Li ( x) f ( xi ) Li ( x)
i 0 j 0 xi xj
j i

For example: In fact, Lagrange


x x1 x x0 polynomials is just a
n 1 f1 ( x) f ( x0 ) f ( x1 ) different formulation of
x0 x1 x1 x0 Newton’s polynomials

n 2 ( x x1 )(x x2 ) ( x x0 )(x x2 )
f1 ( x) f ( x0 ) f ( x1 )
( x0 x1 )(x0 x2 ) ( x1 x0 )(x1 x2 )
( x x0 )(x x1 )
f ( x2 )
( x2 x0 )(x2 x1 )
 In the formula, each term Li (x) will be equal to 1 for x=xi , and
zero for all other data points.
 Thus, each product Li (x) fi(x) takes on the value of fi(x) at the
data point.
Error is defined same as before
Rn f [ x, xn , xn 1 ,..., x0 ]( x x0 )( x x1 )..( x xn )

(An additional point (xn+1) is needed for evaluation)


In summary:
Newton’s method is preferable for exploratory computations (n
is not known a priori).
> Newton method has advantages because of the insight for the
behavior between different orders (consider Taylor series).
> Error estimate in Newton method can easily be implemented
as it employs a finite difference.
Lagrange method is preferable when only one interpolation is
performed (order n is known a priori),
> It is easier for computational implementation.
Polynomial coefficients:
 Newton and Lagrange methods do not provide the coefficients
of the conventional form
f ( x) a0 a1 x a2 x 2 ... an x n
 With (n+1) data points, all the (n+1) coefficients can be
determined by using elimination techniques. For example for
n=2: 2
f ( x) a0 a1 x a2 x

satisfies the following linear equations

f ( x0 ) a0 a1 x0 a2 x02  The process is notoriously ill-


conditioned and susceptible to round-off
f ( x1 ) a0 a1 x1 a2 x12 errors:
keep the order (n) small.
f ( x2 ) a0 a1 x2 a2 x22 use Lagrange or Newton interpolation.
Inverse Interpolation
f (x) dependant variable
x independent variable
 Values of x are usually evenly spaced.
 Normally interpolation concerns finding an approximate f (x) for
a given intermediate value of x.
 What if reverse is needed, that is value of f(x) is given and need
to find the corresponding x value (inverse interpolation).
 Two possible solutions:
Switch x by f(x) and apply Lagrange/Newton interpolation.
(this method is not suitable because there is no guarantee that
the new abscissa values will be evenly distributed,-in fact,
usually highly uneven.)
Apply normal interpolation, and find the x value that satisfies
the given f(x) value a root finding problem.
Equally spaced data:
 Newton/Lagrange methods are compatible for arbitrarily spaced
data
 Before the computer era, equally spaced data had to be
used, but computer implementation of these methods do not
require it anymore.
 Evenly spaced data is required for other applications
too, e.g., numerical differentiation and integration.
Extrapolation: true curve
 The process of f(x) for a point outside of
the range of x values.
 If the extrapolated x value is not near
the evaluation points, the error can be
very large. So, extreme caution is
fit curve extrapolation
required during extrapolation.
Spline Interpolation
 Sometimes fitting higher order polynomials results in erroneous
results, especially at sharp changes.
 Spline interpolation provide s smoother transition between data
points.
 Apply a different lower order polynomial to each interval of the
data points.
 Continuity is maintained by constraining the derivatives at the
knots.
Here the polynomial
interpolation overshoots
between data points. knot
Spline offer a smoother
and a meaningful
transition A different spline
function is defined
interval interval for each interval
Linear Splines:
 Each interval is connected by a straight line.

For each interval


f ( x) f ( xi ) mi ( x xi )

f ( xi 1 ) f ( xi )
where mi
( xi 1 xi )

 Linear splines is identical to the first order polynomial fit.


 Linear spline function is discontinuous at the knots. So, we need
to use higher order polynomials to maintain continuity.
 In general, for m-th derivative to be continuous, an order (m+1)
spline fit must be used.
Quadratic Splines:
In quadratic splines each interval is represented by a different
quadratic polynomial.
f ( x) ai x 2 bi x ci

For n+1 data points there are n intervals. This makes a total of 3n
unknowns to be solved. Conditions:
1. At the interior knots adjacent functions
must meet the data: 2n-2 equations
2. First and last function must pass through
end points: 2 equations
3. First derivatives at the interior knots
must be equal: n-1 equations
4. The final constrain is chosen arbitrarily: 1
equation
These simultaneous linear
Note that continuity of the second equations are solved to obtain
derivative is not ensured at the knots. all the coefficients.
Cubic Splines:
For cubic splines a different third order (cubic) polynomial is
defined for each interval.
f ( x) ai x 3 bi x 2 ci x d i

For n+1 data points there are n intervals: 4n unknowns to be


solved.
Conditions:
1. The function values must meet
interior knots: 2n-2 equations
2. The first and last function must pass
through end points: 2 equations
3. First derivatives at the knots must be
equal: n-1 equations
4. Second derivatives at the interior
knots must be equal: n-1 equations
5. The second derivatives at the end
Fifth condition is chosen arbitrarily knots are zero: 2 equations
(called natural spline)

You might also like