A polynomial interpolation algorithm is developed using the Newton's divided-difference interpolating polynomials. The definition of monotony of a function is then used to define the least degree of the polynomial to make efficient and consistent the interpolation in the discrete given function. The relation between the order of monotony of a particular function and the degree of the interpolating polynomial is justified, analyzing the relation between the derivatives of such function and the truncation error expression. In this algorithm there is not matter about the number and the arrangement of the data points, neither if the points are regularly spaced or not. The algorithm thus defined can be used to make interpolations in functions of one and several dependent variables. The algoritm automatically select the data points nearest to the point where an interpolation is desired, following the criterion of symmetry. Indirectly, the algorithm also select the number of data points, which is a unity higher than the order of the used polynomial, following the criterion of monotony. Finally, the complete algoritm is presented and subroutines in fortran code is exposed as an addendum. Notice that there is not the degree of the interpolating polynomial within the arguments of such subroutines.
1. CONFERENCE ON
NUMERICAL METHODS IN ENGINEERING PROBLEMS.
INTEVEP Headquarters. Los Teques, July 15-17. 1991.
Edo. Miranda, Venezuela.
FREE ORDER POLYNOMIAL INTERPOLATION ALGORITHM
ANDRES L. GRANADOS M.
INTEVEP, S.A. Production Department (EPPR/32).
Venezuela Government Research Facility for Petroleum Industry.
Los Teques, Estado Miranda. Venezuela.
ABSTRACT.-
A polynomial interpolation algorithm is developed using the Newton’s divided-difference inter-
polating polynomials. The definition of monotony of a function is then used to define the least degree
of the polynomial to make efficient and consistent the interpolation in the discrete given function. The
relation between the order of monotony of a particular function and the degree of the interpolating poly-
nomial is justified, analyzing the relation between the derivatives of such function and the truncation
error expression. In this algorithm there is not matter about the number and the arrangement of the
data points, neither if the points are regularly spaced or not. The algorithm thus defined can be used
to make interpolations in functions of one and several dependent variables. The algoritm automatically
select the data points nearest to the point where an interpolation is desired, following the criterion of
symmetry. Indirectly, the algorithm also select the number of data points, which is a unity higher than
the order of the used polynomial, following the criterion of monotony. Finally, the complete algoritm is
presented and subroutines in fortran code is exposed as an addendum. Notice that there is not the degree
of the interpolating polynomial within the arguments of such subroutines.
2. INTRODUCTION
It has been developed an interpolation algorithm using polynomy of Newton in divided differ-
ences. To increase the efficiency of interpolation it has been used two criteria that make the interpolation
the most consistent possible with the given discrete points. These criterions are symmetry and Monotony,
when applied accordingly, permits to determine the order of the optimum polynomy used during a inter-
polation.
POLYNOMIAL OF INTERPOLATION
Let be (x0, f(x0)), (x1, f(x1)), (x2, f(x2)) until (xn, f(xn)) the n+1 discrete points that represent
a function y = f(x). As is well known, there exist a unique polynomial y = Pn(x) of n-degree, which pass
over the n+1 mentioned points. These polynomials are adequate to perform estimartions of the function
y = f(x) for any value x belonging to the interval [x0, x1, x2, x3, . . . , xn] containing all the points, being
the values xi not necessarily ordered, nor having repeted values. We name to this process “Interpolation”.
If the value of x is outside of the interval of points the process is named “Extrapolation”.
Divided Difference
The divided differences [Carnahan et al.,1969] symbolized by f[ · ] is defined in a recurrent
manner in the following form
f[x0] = f(x0) (1.a)
f[x1, x0] =
f[x1] − f[x0]
x1 − x0
(1.b)
f[x2, x1, x0] =
f[x2, x1] − f[x1, x0]
x2 − x0
(1.c)
f[x3, x2, x1, x0] =
f[x3, x2, x1] − f[x2, x1, x0]
x3 − x0
(1.d)
f[xn, xn−1, . . . , x1, x0] =
f[xn, xn−1, . . . , x2, x1] − f[xn−1, xn−2, . . . , x1, x0]
xn − x0
(1.e)
The divided differences satisfy the property
f[xn, xn−1, . . . , x1, x0] = f[x0, x1, . . . , xn−1, xn] ∀n ∈ N (2)
This property, expressed for any n, what means is that, regardless the ordering of these values xi within
the argument of a divided difference, the result is always the same. Said in concise form, the divide
2
3. difference is invariant after permutations of its arguments. This property made it adequated for the
calculations, as we shall see later.
A way to express every posible divided difference generated by, for example, the set of four
points (x0, f(x0)), (x1, f(x1), (x2, f(x2)), (x3, f(x3)) and (x4, f(x4)), not necessarily ordered, is what
we denominate Lozenge Diagram of divided differences. For our proposed example, we have the lozenge
diagram represented as
x0 f[x0]
f[x0, x1]
x1 f[x1] f[x0, x1, x2]
f[x1, x2] f[x0, x1, x2, x3]
x2 f[x2] f[x1, x2, x3] f[x0, x1, x2, x3, x4]
f[x2, x3] f[x1, x2, x3, x4]
x3 f[x3] f[x2, x3, x4]
f[x3, x4]
x4 f[x4]
(3)
One may observe that for obtaining every divided difference located in a vertex of an imaginary triangle, is
sufficient to calculate the difference of the contiguous divided differences and divide them by the difference
of the extreme values of x in the base of such triangle.
Algebraic Manipulation of differences of increasing orders results, by mean of induction, in a
similar symetrical form for the k-divided-difference, in terms of its arguments and the functional values
f(xi). This symetrical form may be described in a compact manner by
f[x0, x1, x2, . . . , xk−1, xk] =
k
i=0
f(xi)
k
j=0
j=i
(xi − xj)
(4)
For regular intervals in x, where the values xi are ordered, we define the forward difference ∆k
fi,
such that
∆k
fi = k! hk
f[xi, xi+1, xi+2, . . . , xi+k−1, xi+k] (5)
where h is the size of the interval in x for consecutive points (h = xi+1 − xi). They are ordered in a
lozenge diagram as before, but they are not divided, that is why the factor k! hk
.
Newton Polynomials
The Newton polynomials Pn(x) of degree n in divided differenes [Carnahan et al.,1969], as said
before, permit to make estimations of the function y = f(x) of intermediate points by the formula
f(x) = Pn(x) + Rn(x) (6)
3
4. where Pn(x) is the polynomial of degree n
Pn(x) =f[x0] + (x − x0) f[x0, x1] + (x − x0)(x − x1) f[x0, x1, x2] + · · ·
+ (x − x0)(x − x1)(x − x2) · · · (x − xn−1) f[x0, x1, x2, . . . , xn−1, xn]
=
n
k=0
k−1
j=0
(x − xj) f[x0, x1, x2, . . . , xk−1, xk] (7)
and the function Rn(x) is the error committed in the interpolation
Rn(x) =
n
j=0
(x − xj) f[x0, x1, x2, . . . , xn−1, xn, x]
=
n
j=0
(x − xj)
f(n+1)
(ξ)
(n + 1)!
ξ ∈ [x0, x1, . . . , xn−1, xn] (8)
being ξ the value between the lower and the higher of the values {x0, x1, . . . , xn−1, xn}. Naturaly Rn(xi) =
0 for i = 1, 2, 3, . . ., n, since the polynomial pass over every one of the points (xi, f(xi)). When high limit
of a producto is less than the low limit, as occur in the first therm of (7), the result is one.
A simple example is the parabola that pass over three points (a, f(a)), (b, f(b)) y (c, f(c))
P2(x) = f[a] + (x − a)f[a, b] + (x − a)(x − b)f[a, b, c] (9)
where f[a, b] if the slope between points a y b and f[a, b, c] is the curvature of the parabola, if positive is
upward opened, if negative is downward opened.
For regular intervals, the polynomial of Newton in divided difference (7) becomes in
Pn(x) =
n
k=0
s
k
∆k
f0 (10)
denominated forward Newton-Gregory polynomial and where the combinatorial number means
s
k
=
Γ(s + 1)
Γ(s − k + 1) Γ(k + 1)
s =
x − x0
h
(11)
4
5. Particularly, Γ(k + 1) = k! for k being a positive integer and, although the function Γ(s) is not always a
factorial, it is satisfied Γ(s+1)/Γ(s−k+1) = s(s−1)(s−2) . . . (s−k +1) [Gerald,1970]. The expression
(10) was obtained by substitution of
k−1
j=0
(x − xj) = hk Γ(s + 1)
Γ(s − k + 1)
= k! hk s
k
(12)
and (5), solving f[ · ] for i = 0, in (7).
For regular intervals, the error (8) becomes in
Rn(x) =
s
n + 1
hn+1
f(n+1)
(ξ) ξ ∈ [x0, x1, . . . , xn−1, xn] (13)
being ξ the same as before. The polynomials for regular intervals are shown here only for reference. In
general, the data used for interpolation are not ordered, nor are regular. At last we use polynomials in
divided difference for the reason aditionally justified in continuation.
Lagrange Polynomials
The polynomial of Lagrange [Hildebrand,1956] is other form to express the same polynomial
Pn(x) from the equation (7), but through (4). In such a way we have [Carnahan et al.,1969]
Pn(x) =
n
i=0
Li(x) f(xi) (14)
where
Li(x) =
n
j=0
j=i
(x − xj)
(xi − xj)
(15)
The error Rn(x) continuous being the same as expresion (8). Every functional value f(xi) included in the
expresion (14) es multiplied by Li(x), which are all polynomials of degree n. For this reason receive the
name of Lagrange multiplier. An inconvenience that have these Lagrange polynomials is that, to increase
the degree in one unit, implies a cumbersome process of appending an additional factor for each multiplier
(products), and then calculate all again. This inconvenience is not presented in Newton polynomials,
where to increase the degree one unit, involves only to add a point and calculate a additional term (sums),
and all the calculations done before may be reused.
5
6. CRITERIA FOR INTERPOLATION
In continuation there are decribed two criteria used in the algorithm: symmetry and monotony.
Then is formulated how they are coupled in the algorithm.
symmetry
El criterion of symmetry consist in choosing the distribution of points as simetrically as possible,
around where a interpolation is desired. This may be done in two ways: by the number of points, or
the distance of influence, at each side of the target. In the case of irregular interval, the second option
becomes in a criterion of proximity. In the case of regular intervals one of the ways implies the other.
In any way, the number of proximate points is determined by the criterion of monotony describe below.
In the extreme of the interval containing the points, sometimes it is imposible to follow the criterion of
symmetry estrictly, then it is necessary in its place to follow the criterion of proximity, if you want to
reach a higher order of monotony as is explained below.
The criterion of symmetry has another advantage. For example, in the finite difference central
scheme the presented formulations have a lower error, than when they are not, inclusively using the same
number of points.
Monotony
The criterion of monotony is based in the definition of monotony of a funtion: A function is said
to have a monotony of order m, in a determined interval, if all the derivatives up to that order conserve
always its sign in such an interval. In others words, a continuous function y = f(x) is monotonic of order
m in an interval [a, b], if
f (x) = 0 f (x) = 0 f (x) = 0 · · · f(m)
(x) = 0 for all x ∈ [a, b]
f(m+1)
(x) = 0 for some x ∈ [a, b]
(16)
In the example shown in (9), la parabola has monotony of order 2 in the intervals (−∞, v) and (v, ∞),
separately, where v = 1
2 { a + b − f[a, b]/f[a, b, c] } is the location of the vertex of that parabola.
The divided difference are proportional to the derivatives in its surround, as it is indicated in
the next relation coming from (8)
f[x0, x1, x2, . . . , xn−1, xn, x] =
f(n+1)
(ξ)
(n + 1)!
ξ ∈ [x0, x1, . . . , xn−1, xn, x] (17)
6
7. For this, the criterion of monotony implies to choose the highest order in the divided difference with equal
sign by columns in the lozenge diagram. The last divided difference to avoid from here, together with the
last point that originates it, should have the opposite sign of all the rest of divided difference of the same
order (same column) in the vicinity. This means that the criterion of monotony accepts polynomials up
to degree m. The lack of monotony in the interpolations implies that it may be produced undesirable
oscillations of the functions around or within the given points. As the last added point is the farest, there
is not inconvenience to leave it (not recommended), since the calculations are already done and are of the
last order in the error. As more similar are the monotony of the dicrete function and the interpolation
polynomial, as in the same weight the interpolation will be more consistent.
Algorithm
The criteria of symmetry and monotony are complementary to indicate which points and how
many of them must be used in the interpolation. In any way, the degree of the polynomial will be a unit
less than the number of used points. The algorithm may be resumed in the following manner: select the
nearest points where the interpolation is desired in a simetrical (or proximate) number (distance), one by
one (calculating every time all the diagonal of divided difference up to the vertex), until such a number
of point, reflected in the divided difference, conserve the maximum possible order of monotony of the
interpolation polynomial equal to the monotony of the dicrete function.
The aforementioned explained algorithm may be used to do interpolations in one or several
dimensions. Also permits the interpolation without the necessity of pre-ordering the used points or pre-
select their number. In several dimensions the only requirement is that the function values will be for
the same and for all the discrete points in each dimension. The algorithm neither need to select a degree
of polynomial anticipatively, during the process of interpolation. The algorithm decides the optimum
degree of the polynomial that guarantees the satisfaction of the critera of symmetry and monotony.
REFERENCES
• Carnahan, B.; Luther, H. A.; Wilkes, J. O. Applied Numerical Methods. John Wiley &
Sons (New York), 1969.
• Gerald, C. F. Applied Numerical Analysis, 2nd
Edition. Addison-Wesley (New York), 1970.
• Hildebrand, F. B. Introduction to Numerical Analysis. McGraw-Hill (New York),1956.
ADDENDUM
Please ask for the FORTRAN code at e-mails: agrana@usb.ve granados.al@gmail.com
7