Académique Documents
Professionnel Documents
Culture Documents
To centre the data around x = 3.44, the first three points are used. Applying P
2(x) at each of these data points gives the following three equations:
Solving for a, b, and c by Gauss elimination without scaling or
pivoting yields
• advantages of higher-degree interpolation are obvious.
• The main advantage of direct fit polynomials is that the explicit form of the
approximating function is obtained, and interpolation at several values of x can
be accomplished simply by evaluating the polynomial at each value of x.
• The work required to obtain the polynomial does not have to be redone for
each value of x.
• A second advantage is that the data can be unequally spaced.
Neville’s Algorithm
• Neville’s algorithm is equivalent to a Lagrange polynomial. It is based on a series
of linear interpolations.
• divided difference is defined as the ratio of the difference in the function values at
two points divided by the difference in the values of the corresponding
independent variable.
• Thus, the first divided difference at point i is defined as
Example
Difference Tables
• There are three difference method
A difference table below can be interpreted as a forward-difference
table, a backward-difference table, or a centred difference table,
Forward-difference table
Backward-difference table Centred-difference
• The numbers in the tables are identical. Only the notation is different.
• Difference tables are useful for evaluating the quality of a set of
tabular data.
Least Squares Approximation
• The least squares method is defined as follows: Given N data points, [xi, Y(xi)] =
(xi, Yi), choose the functional form of the approximating function to be fit, y =
y(x), and minimize the sum of the squares of the deviations, ei = (Yi- yi).
• For example, if the values of the independent variable xi are considered exact,
then all the deviation is assigned to the dependent variable Y(x), and the deviation
ei is the vertical distance between Y, and yi =f(xi). Thus
• The simplest polynomial is a linear polynomial, the straight line. Least squares
straight line approximations are an extremely useful and common approximate
fit.
Dividing above Eqs by 2 and rearranging yields
(c)third-order (cubic)
connecting four points.
• Newton’s method
• Lagrange method
• Least square approximation methods , etc.…..
Newton’s Divided-difference Interpolating Polynomials
• As stated above, there are a variety of alternative forms for expressing an
interpolating polynomial.
• Newton’s divided-difference interpolating polynomial is among the most popular
and useful forms.
• Before presenting the general equation, we will introduce the first- and second-
order versions because of their simple visual interpretation.
Linear Interpolation
• The simplest form of interpolation is to connect two data points with a straight
line.
• This technique, called linear interpolation,
Eqn(1)
• Finally, substituting the above two equation in the original equation and b2,can be
evaluated at x = x2 and solved (after some algebraic manipulations) for,
Cont.………
• Notice that, as was the case with linear interpolation, b1 still represents the slope
of the line connecting points x0 and x1.
• Thus, the first two terms of Eqn(2) are equivalent to linear interpolation from x0
to x1.
• The last term, b2(x - x0)(x -0 x1) in eqn(2), introduces the second-order curvature
into the formula.
Example
• Substituting these values into Eqn(2) yields the quadratic formula
f2(x) = 0 + 0.4620981(x - 1) - 0.0518731(x - 1)(x - 4)
which can be evaluated at x = 2 for
f2(2) = 0.5658444
• which represents a relative error of t =18.4%.
• Thus, the curvature introduced by the quadratic formula improves the
interpolation compared with the result obtained using straight lines.
General Form of Newton’s Interpolating Polynomials
• The preceding analysis can be generalized to fit an nth-order polynomial to n + 1
data points.
• The nth-order polynomial is
• fn(x) = b0 + b1(x - x0) +………
bn(x - x0)(x -x1)………… (x – xn-1) Eqn(3)
• We use these data points and the
following equations to evaluate the coefficients:
the first finite divided difference is represented generally as
The second finite divided difference, which represents the difference of two first
divided differences, is expressed generally as
Eqn(3)
• which is called Newton’s divided-difference interpolating polynomial.
• It should be noted that it is not necessary that the data points used in be
equally spaced or that the abscissa values necessarily be in ascending order,
example
• In the previous Example, data points at x0 = 1, x1 =4, and x2 = 6 were used to estimate ln 2 with a
parabola.
• Now, adding a fourth point [x3 = 5; f(x3) = 1.609438], estimate ln 2 with a third-order Newton’s
interpolating polynomial.
Solution.
The third-order
polynomial,
with n = 3, is
The results for f [x1, x0], f [x2, x1, x0], and f [x3, x2, x1, x0] represent the coefficients
b1, b2, and b3, respectively, Along with b0 = f(x0) = 0.0,
eqn(5)
Example
• Use a Lagrange interpolating polynomial of the first and second order to evaluate
ln 2 on the basis of the data given in above example:
• x0 = 1, f (x0) = 0
• x1 = 4, f (x1) = 1.386294
• x2 = 6, f (x2) = 1.791760
• Solution , The first-order
polynomial eqn(5)can be used
to obtain the estimate at x = 2,
As expected, both these results agree with those previously obtained using
Newton’s interpolating polynomial.
Inverse Interpolation
• As the nomenclature implies, the f(x) and x values in most interpolation contexts
are the dependent and independent variables, respectively.
• invers interpolation is the of processes finding ‘x’ by the given f(x).
• A simple example is a table of values derived for the function f(x) = 1/x ,
For instance, for the data above, suppose that you were asked to
determine the value of x that corresponded to f(x) = 0.3.
For this case, because the function is available and easy to manipulate,
the correct answer can be determined directly as x = 1/0.3 = 3.3333.
Such a problem is called inverse interpolation.
• For example, for the problem outlined above, a simple approach would be to fit a
quadratic polynomial to the three points: (2, 0.5), (3, 0.3333) and (4, 0.25). The
result would be
𝟐.𝟓−𝟏
M = = −𝟎. 𝟔
𝟕−𝟒.𝟓
The slopes for the other intervals can be computed, and the resulting first-order splines are plotted in
Figure above.
Quadratic Splines
• The objective in quadratic splines is to derive a second-order polynomial for each
interval between data points.
• The polynomial for each interval can be represented generally as,
• Figure below has been included to help clarify the notation.
• For n + 1 data points (i = 0, 1,2, . . . , n), there are n intervals and, consequently, 3n
unknown constants (the a’s, b’s, and c’s) to evaluate.
• Therefore, 3n equations or conditions are required to evaluate the unknowns.
These are:
• 1. The function values of adjacent polynomials must be equal at the interior knots.
This condition can be represented as,
for i = 2 to n.
3. The first derivatives of adjacent polynomials at the interior knots must be equal. The
first derivative of the quadratic function is :for i = 2 to n.
4. Assume that the second derivative is zero at the first point. this condition
can be expressed mathematically as , a1 = 0
Example, Fit quadratic splines to the same data used in (Table Example above.
Use the results to estimate the value at x = 5.
Solution, For the present problem, we have four data points and n = 3 intervals.
Therefore, 3(3) = 9 unknowns and the first criteria yield
2(3) - 2 = 4 conditions:
Passing the first and last functions through the
initial and final values adds 2 more
9a1 + 3b1 + c1 = 2.5
81a3 + 9b3 + c3 = 0.5
Continuity of derivatives creates an additional 3 - l = 2 • Finally specifies that a1 = 0.
Because this equation specifies a1
exactly, the problem reduces to
solving eight simultaneous equations.
• Reading assignment :
Cubic Splines
• The objective in cubic splines is to derive a third-order polynomial for each interval between knots,
as in
fi(x) = 𝑎𝑖(𝑥)3 + 𝑏𝑖(𝑥)2 + ci x 1
• Thus, for n - 1 data points (i = 0, 1, 2, . . . , n), there are n intervals and, consequently, 4n unknown
constants to evaluate.
• Just as for quadratic splines, 4n conditions are required to evaluate the unknowns. These are:
1. The function values must be equal at the interior knots (2n - 2 conditions).
2. The first and last functions must pass through the end points (2 conditions).
3. The first derivatives at the interior knots must be equal (n 2 1 conditions).
4. The second derivatives at the interior knots must be equal (n 2 1 conditions).
5. The second derivatives at the end knots are zero (2 conditions).
Multidimensional Interpolation
These points can then be used to linearly interpolate along the y dimension to yield the
final result,
• A single equation can be developed by substituting the first two
equation in to the last equation
Note that beyond the simple bilinear interpolation described in the foregoing example, higher-
order polynomials and splines can also be used to interpolate in two dimensions.