1 The method ¶ Consider N + 1 N+1 N + 1 distinct points x 0 , x 1 , … , x N x_0,x_1,\ldots,x_N x 0 , x 1 , … , x N at which data about a function is given. The Newton form of interpolation makes use of the basis functions
1 , ( x − x 0 ) , ( x − x 0 ) ( x − x 1 ) , … , ( x − x 0 ) ( x − x 1 ) … ( x − x N − 1 ) 1, \quad (x-x_0), \quad (x-x_0)(x-x_1), \quad \ldots, \quad (x-x_0)(x-x_1)\ldots(x- x_{N-1}) 1 , ( x − x 0 ) , ( x − x 0 ) ( x − x 1 ) , … , ( x − x 0 ) ( x − x 1 ) … ( x − x N − 1 ) so that the degree N N N polynomial has the form
p ( x ) = c 0 + c 1 ( x − x 0 ) + c 2 ( x − x 0 ) ( x − x 1 ) + … + c N ( x − x 0 ) … ( x − x N − 1 ) p(x) = c_0 + c_1(x-x_0) + c_2 (x-x_0)(x-x_1) + \ldots + c_N (x-x_0) \ldots(x-x_{N-1}) p ( x ) = c 0 + c 1 ( x − x 0 ) + c 2 ( x − x 0 ) ( x − x 1 ) + … + c N ( x − x 0 ) … ( x − x N − 1 ) The two practical questions are:
How to determine the coefficients { c i } \{ c_i \} { c i } ?
How to evaluate the resulting polynomial ?
The interpolation conditions are given by
f 0 = c 0 f 1 = c 0 + c 1 ( x 1 − x 0 ) f 2 = c 0 + c 1 ( x 2 − x 0 ) + c 2 ( x 2 − x 0 ) ( x 2 − x 1 ) ⋮ f N = c 0 + c 1 ( x N − x 0 ) + … + c N ( x N − x 0 ) … ( x N − x N − 1 ) \begin{aligned}
f_0 &= c_0 \\
f_1 &= c_0 + c_1 (x_1 - x_0) \\
f_2 &= c_0 + c_1(x_2-x_0) + c_2(x_2-x_0)(x_2-x_1) \\
& \vdots \\
f_N &= c_0 + c_1 (x_N-x_0) + \ldots + c_N(x_N-x_0)\ldots(x_N-x_{N-1})
\end{aligned} f 0 f 1 f 2 f N = c 0 = c 0 + c 1 ( x 1 − x 0 ) = c 0 + c 1 ( x 2 − x 0 ) + c 2 ( x 2 − x 0 ) ( x 2 − x 1 ) ⋮ = c 0 + c 1 ( x N − x 0 ) + … + c N ( x N − x 0 ) … ( x N − x N − 1 ) We have a matrix equation with a lower triangular matrix which can be solved recursively starting from the first equation. There is no need to invert the matrix. The non-singularity of the matrix is clear since the determinant is the product of the diagonal terms and this is non-zero since the points { x i } \{ x_i \} { x i } are distinct. The coefficients { c i } \{ c_i \} { c i } can be computed in O ( N 2 ) O(N^2) O ( N 2 ) operations but there is danger of overflow/ underflow errors if we do not do this carefully. The triangular structure means that if we add a new data point ( x N + 1 , f N + 1 ) (x_{N+1},f_{N+1}) ( x N + 1 , f N + 1 ) , then the coefficients c 0 , c 1 , ⋯ c N c_0, c_1, \cdots c_N c 0 , c 1 , ⋯ c N do not change; we have to compute the additional coefficient c N + 1 c_{N+1} c N + 1 .
2 Divided differences ¶ Define zeroth divided difference
f [ x i ] = f i , i = 0 , 1 , … , N f[x_i] = f_i, \qquad i=0,1,\ldots,N f [ x i ] = f i , i = 0 , 1 , … , N and the first divided difference
f [ x i , x j ] = f [ x j ] − f [ x i ] x j − x i , i ≠ j f[x_i,x_j] = \frac{f[x_j] - f[x_i]}{x_j - x_i}, \qquad i \ne j f [ x i , x j ] = x j − x i f [ x j ] − f [ x i ] , i = j The k k k ’th divided difference is defined recursively by
f [ x 0 , x 1 , … , x k ] = f [ x 1 , x 2 , … , x k ] − f [ x 0 , x 1 , … , x k − 1 ] x k − x 0 f[x_0,x_1,\ldots,x_k] = \frac{ f[x_1,x_2,\ldots,x_k] - f[x_0,x_1,\ldots,x_{k-1}]}{x_k - x_0} f [ x 0 , x 1 , … , x k ] = x k − x 0 f [ x 1 , x 2 , … , x k ] − f [ x 0 , x 1 , … , x k − 1 ] We claim that
c k = f [ x 0 , x 1 , … , x k ] c_k = f[x_0,x_1,\ldots,x_k] c k = f [ x 0 , x 1 , … , x k ] We can compute the divided differences by constructing the following table
f [ x 0 ] f [ x 1 ] f [ x 0 , x 1 ] f [ x 2 ] f [ x 1 , x 2 ] f [ x 0 , x 1 , x 2 ] f [ x 3 ] f [ x 2 , x 3 ] f [ x 1 , x 2 , x 3 ] f [ x 0 , x 1 , x 2 , x 3 ] ⋮ ⋮ ⋮ ⋮ \begin{array}{llll}
f[x_0] & & & \\
f[x_1] & f[x_0,x_1] & & \\
f[x_2] & f[x_1,x_2] & f[x_0,x_1,x_2] & \\
f[x_3] & f[x_2,x_3] & f[x_1,x_2,x_3] & f[x_0,x_1,x_2,x_3] \\
\vdots & \vdots & \vdots & \vdots
\end{array} f [ x 0 ] f [ x 1 ] f [ x 2 ] f [ x 3 ] ⋮ f [ x 0 , x 1 ] f [ x 1 , x 2 ] f [ x 2 , x 3 ] ⋮ f [ x 0 , x 1 , x 2 ] f [ x 1 , x 2 , x 3 ] ⋮ f [ x 0 , x 1 , x 2 , x 3 ] ⋮ The diagonal terms are the coefficients { c i } \{c_i\} { c i } of Newton interpolation. To compute the the diagonal terms, it is not necessary to store all the other terms in memory.
for(i=0; i<=N; ++i) c[i] = f[i];
for(j=1; j<=N; ++j)
for(i=N; i>=j; --i)
c[i] = (c[i] - c[i-1])/(x[i] - x[i-j]);
This requires N 2 N^2 N 2 additions and 1 2 N 2 \frac{1}{2}N^2 2 1 N 2 divisions.
3 Evaluation of polynomials ¶ Suppose given x x x we have to compute
p ( x ) = a N x N + a N − 1 x N − 1 + … + a 1 x + a 0 p(x) = a_N x^N + a_{N-1} x^{N-1} + \ldots + a_1 x + a_0 p ( x ) = a N x N + a N − 1 x N − 1 + … + a 1 x + a 0 A direct term-by-term evaluation as in the above formula can suffer from overflow/ underflow error and the cost is also high. To see how to evaluate more efficiently, let us consider some simpler examples for quadratic
p = a 2 x 2 + a 1 x + a 0 = ( a 2 x + a 1 ) x + a 0 p = a_2 x^2 + a_1 x + a_0 = (a_2 x + a_1) x + a_0 p = a 2 x 2 + a 1 x + a 0 = ( a 2 x + a 1 ) x + a 0 and cubic polynomials,
p = a 3 x 3 + a 2 x 2 + a 1 x + a 0 = ( ( a 3 x + a 2 ) x + a 1 ) x + a 0 p = a_3 x^3 + a_2 x^2 + a_1 x + a_0 = ((a_3 x + a_2) x + a_1) x + a_0 p = a 3 x 3 + a 2 x 2 + a 1 x + a 0 = (( a 3 x + a 2 ) x + a 1 ) x + a 0 This suggests the following recursive algorithm called Horner’s method
p = a N p = p ⋅ x + a N − 1 p = p ⋅ x + a N − 2 ⋮ p = p ⋅ x + a 0 \begin{aligned}
p &= a_N \\
p &= p \cdot x + a_{N-1} \\
p &= p \cdot x + a_{N-2} \\
\vdots & \\
p &= p \cdot x + a_0
\end{aligned} p p p ⋮ p = a N = p ⋅ x + a N − 1 = p ⋅ x + a N − 2 = p ⋅ x + a 0 which gives p ( x ) p(x) p ( x ) at the end. This approach can be used for the Newton form also.
p = c N p = p ⋅ ( x − x N − 1 ) + c N − 1 p = p ⋅ ( x − x N − 2 ) + c N − 2 ⋮ p = p ⋅ ( x − x 0 ) + c 0 \begin{aligned}
p &= c_N \\
p &= p \cdot (x-x_{N-1}) + c_{N-1} \\
p &= p \cdot (x-x_{N-2}) + c_{N-2} \\
& \vdots \\
p &= p \cdot (x-x_0) + c_0
\end{aligned} p p p p = c N = p ⋅ ( x − x N − 1 ) + c N − 1 = p ⋅ ( x − x N − 2 ) + c N − 2 ⋮ = p ⋅ ( x − x 0 ) + c 0 This requires 2 N 2N 2 N additions and N N N multiplications so the cost is O ( N ) O(N) O ( N ) . The direct term-by-term computation
double x[N], c[N];
double p = 0.0;
for(int i=0; i<=N; ++i)
{
double tmp = 1.0;
for(int j=0; j<i; ++j) tmp *= (x - x[j]);
p += c[i] * tmp;
}
would require N N N additions and
1 + 2 + … + N = 1 2 N ( N + 1 ) 1 + 2 + \ldots + N = \frac{1}{2}N(N+1) 1 + 2 + … + N = 2 1 N ( N + 1 ) multiplications for a total cost of O ( N 2 ) O(N^2) O ( N 2 ) for each evaluation of p ( x ) p(x) p ( x ) . This can be improved by a simple modification
double x[N], c[N];
double tmp = 1.0, p = 0.0;
for(int i=0; i<=N; ++i)
{
p += c[i] * tmp;
tmp *= (x-x[i]);
}
Give the data ( x i , f i ) (x_i,f_i) ( x i , f i ) , i = 0 , 1 , … , N i=0,1,\ldots,N i = 0 , 1 , … , N write a function to compute the coefficients of Newton interpolation. Write a second function which evaluates p ( x ) p(x) p ( x ) by Horner’s method.
4 Proof of c k = f [ x 0 , x 1 , … , x k ] c_k = f[x_0,x_1,\ldots,x_k] c k = f [ x 0 , x 1 , … , x k ] ¶ The polynomial interpolating the data at { x 0 , x 1 , … , x k } \{ x_0,x_1,\ldots,x_k \} { x 0 , x 1 , … , x k } is
p k ( x ) = c 0 + c 1 ( x − x 0 ) + c 2 ( x − x 0 ) ( x − x 1 ) + … c k ( x − x 0 ) … ( x − x k − 1 ) p_k(x) = c_0 + c_1 (x-x_0) + c_2 (x-x_0)(x-x_1) + \ldots c_k (x-x_0)\ldots(x-x_{k-1}) p k ( x ) = c 0 + c 1 ( x − x 0 ) + c 2 ( x − x 0 ) ( x − x 1 ) + … c k ( x − x 0 ) … ( x − x k − 1 ) Note that c k c_k c k depends on x 0 , x 1 , … , x k x_0,x_1,\ldots,x_k x 0 , x 1 , … , x k so we indicate this
dependence symbolically as
c k = f [ x 0 , x 1 , … , x k ] c_k = f[x_0,x_1,\ldots,x_k] c k = f [ x 0 , x 1 , … , x k ] We will show
that this symbol satisfies the recursion relation for divided
differences . Note that c k c_k c k is the coefficient of x k x^k x k in the
polynomial p k ( x ) p_k(x) p k ( x ) .
Let us also write the Lagrange polynomial interpolating the same data as
above. Define
ψ k ( x ) = ( x − x 0 ) ( x − x 1 ) … ( x − x k ) \psi_k(x) = (x-x_0)(x-x_1) \ldots (x-x_k) ψ k ( x ) = ( x − x 0 ) ( x − x 1 ) … ( x − x k ) so that
ψ k ′ ( x i ) = ( x i − x 0 ) … ( x i − x i − 1 ) ( x i − x i + 1 ) … ( x i − x k ) \psi_k'(x_i) = (x_i-x_0) \ldots (x_i - x_{i-1})(x_i-x_{i+1}) \ldots (x_i-x_k) ψ k ′ ( x i ) = ( x i − x 0 ) … ( x i − x i − 1 ) ( x i − x i + 1 ) … ( x i − x k ) Then the Lagrange form can be written as
p k ( x ) = ∑ j = 0 k ψ k ( x ) ( x − x j ) ψ k ′ ( x j ) f ( x j ) p_k(x) = \sum_{j=0}^k \frac{\psi_k(x)}{(x-x_j)\psi_k'(x_j)} f(x_j) p k ( x ) = j = 0 ∑ k ( x − x j ) ψ k ′ ( x j ) ψ k ( x ) f ( x j ) The coefficient of x k x^k x k in this form is
c k = f [ x 0 , x 1 , … , x k ] = ∑ j = 0 k f ( x j ) ψ k ′ ( x j ) c_k = f[x_0,x_1,\ldots,x_k] = \sum_{j=0}^k \frac{f(x_j)}{\psi_k'(x_j)} c k = f [ x 0 , x 1 , … , x k ] = j = 0 ∑ k ψ k ′ ( x j ) f ( x j ) since the interpolating polynomial is unique.
Now, using above result, we can write a formula for
f [ x 0 , x 1 , … , x k − 1 ] f[x_0,x_1,\ldots,x_{k-1}] f [ x 0 , x 1 , … , x k − 1 ] but we have to knock off the factor
( x j − x k ) (x_j-x_k) ( x j − x k ) from ψ k ′ ( x j ) \psi_k'(x_j) ψ k ′ ( x j ) , so that
f [ x 0 , x 1 , … , x k − 1 ] = ∑ j = 0 k − 1 f ( x j ) ψ k ′ ( x j ) ( x j − x k ) = ∑ j = 0 k f ( x j ) ψ k ′ ( x j ) ( x j − x k ) f[x_0,x_1,\ldots,x_{k-1}] = \sum_{j=0}^{k-1} \frac{f(x_j)}{\psi_k'(x_j)} (x_j-x_k) =
\sum_{j=0}^k \frac{f(x_j)}{\psi_k'(x_j)} (x_j - x_k) f [ x 0 , x 1 , … , x k − 1 ] = j = 0 ∑ k − 1 ψ k ′ ( x j ) f ( x j ) ( x j − x k ) = j = 0 ∑ k ψ k ′ ( x j ) f ( x j ) ( x j − x k ) Similarly
f [ x 1 , x 2 , … , x k ] = ∑ j = 1 k f ( x j ) ψ k ′ ( x j ) ( x j − x 0 ) = ∑ j = 0 k f ( x j ) ψ k ′ ( x j ) ( x j − x 0 ) f[x_1,x_2,\ldots,x_{k}] = \sum_{j=1}^{k} \frac{f(x_j)}{\psi_k'(x_j)} (x_j-x_0) =
\sum_{j=0}^k \frac{f(x_j)}{\psi_k'(x_j)} (x_j - x_0) f [ x 1 , x 2 , … , x k ] = j = 1 ∑ k ψ k ′ ( x j ) f ( x j ) ( x j − x 0 ) = j = 0 ∑ k ψ k ′ ( x j ) f ( x j ) ( x j − x 0 ) Hence
f [ x 1 , x 2 , … , x k ] − f [ x 0 , x 1 , … , x k − 1 ] = ∑ j = 0 k f ( x j ) ψ k ′ ( x j ) ( x k − x 0 ) = ( x k − x 0 ) f [ x 0 , x 1 , … , x k ] \begin{align*}
f[x_1,x_2,\ldots,x_{k}] - f[x_0,x_1,\ldots,x_{k-1}]
&= \sum_{j=0}^k \frac{f(x_j)} {\psi_k'(x_j)} (x_k - x_0) \\
&= (x_k - x_0) f[x_0,x_1,\ldots,x_k]
\end{align*} f [ x 1 , x 2 , … , x k ] − f [ x 0 , x 1 , … , x k − 1 ] = j = 0 ∑ k ψ k ′ ( x j ) f ( x j ) ( x k − x 0 ) = ( x k − x 0 ) f [ x 0 , x 1 , … , x k ] which is the recursion relation for divided differences.
Let { i 0 , i 1 , … , i k } \{i_0, i_1, \ldots, i_k\} { i 0 , i 1 , … , i k } be an arbitrary permutation of
{ 0 , 1 , … , k } \{0,1,\ldots,k\} { 0 , 1 , … , k } . Then
f [ x 0 , x 1 , … , x k ] = ∑ j = 0 k f ( x j ) ψ k ′ ( x j ) = ∑ j = 0 k f ( x i j ) ψ k ′ ( x i j ) = f [ x i 0 , x i 1 , … , x i k ] f[x_0,x_1,\ldots,x_k] = \sum_{j=0}^k \frac{f(x_j)}{\psi_k'(x_j)} = \sum_{j=0}^k
\frac{f(x_{i_j})}{\psi_k'(x_{i_j})} = f[x_{i_0}, x_{i_1}, \ldots, x_{i_k}] f [ x 0 , x 1 , … , x k ] = j = 0 ∑ k ψ k ′ ( x j ) f ( x j ) = j = 0 ∑ k ψ k ′ ( x i j ) f ( x i j ) = f [ x i 0 , x i 1 , … , x i k ] Hence the value of f [ x 0 , x 1 , … , x N ] f[x_0,x_1,\ldots,x_N] f [ x 0 , x 1 , … , x N ] is independent of the order
of the arguments.
5 Interpolation error ¶ The Newton form of interpolation to the data ( x i , f i ) (x_i,f_i) ( x i , f i ) ,
i = 0 , 1 , … , N i=0,1,\ldots,N i = 0 , 1 , … , N is
p N ( x ) = f 0 + ( x − x 0 ) f [ x 0 , x 1 ] + ( x − x 0 ) ( x − x 1 ) f [ x 0 , x 1 , x 2 ] + … + ( x − x 0 ) … ( x − x N − 1 ) f [ x 0 , … , x N ] \begin{aligned}
p_N(x) = f_0 & + (x-x_0)f[x_0,x_1] \\
& + (x-x_0)(x-x_1) f[x_0,x_1, x_2] \\
& + \ldots \\
& + (x-x_0) \ldots (x-x_{N-1}) f[x_0,\ldots,x_N]
\end{aligned} p N ( x ) = f 0 + ( x − x 0 ) f [ x 0 , x 1 ] + ( x − x 0 ) ( x − x 1 ) f [ x 0 , x 1 , x 2 ] + … + ( x − x 0 ) … ( x − x N − 1 ) f [ x 0 , … , x N ] Let t ∈ R t \in \re t ∈ R be distinct from the nodes x 0 , x 1 , … , x N x_0,x_1,\ldots,x_N x 0 , x 1 , … , x N but otherwise arbitrary. The polynomial interpolating f ( x ) f(x) f ( x ) at x 0 , x 1 , … , x N , t x_0,x_1,\ldots,x_N,t x 0 , x 1 , … , x N , t is
p N + 1 ( x ) = p N ( x ) + ( x − x 0 ) … ( x − x N ) f [ x 0 , … , x N , t ] p_{N+1}(x) = p_N(x) + (x-x_0)\ldots (x-x_N) f[x_0,\ldots,x_N,t] p N + 1 ( x ) = p N ( x ) + ( x − x 0 ) … ( x − x N ) f [ x 0 , … , x N , t ] But p N + 1 ( t ) = f ( t ) p_{N+1}(t) = f(t) p N + 1 ( t ) = f ( t ) so that
f ( t ) = p N ( t ) + ( t − x 0 ) … ( t − x N ) f [ x 0 , … , x N , t ] f(t) = p_N(t) + (t-x_0)\ldots (t-x_N) f[x_0,\ldots,x_N,t] f ( t ) = p N ( t ) + ( t − x 0 ) … ( t − x N ) f [ x 0 , … , x N , t ] Since t t t was arbitrary, we could call it x x x . Then the error is
f ( x ) − p N ( x ) = ( x − x 0 ) … ( x − x N ) f [ x 0 , … , x N , x ] f(x) - p_N(x) = (x-x_0)\ldots (x-x_N) f[x_0,\ldots,x_N,x] f ( x ) − p N ( x ) = ( x − x 0 ) … ( x − x N ) f [ x 0 , … , x N , x ] Comparing this with the formula we have derived earlier, we conclude that
f [ x 0 , … , x N , x ] = 1 ( N + 1 ) ! f ( N + 1 ) ( ξ ) , ξ ∈ I ( x 0 , … , x N , x ) f[x_0,\ldots,x_N,x] = \frac{1}{(N+1)!} f^{(N+1)}(\xi), \qquad \xi \in I(x_0,\ldots,x_N,x) f [ x 0 , … , x N , x ] = ( N + 1 )! 1 f ( N + 1 ) ( ξ ) , ξ ∈ I ( x 0 , … , x N , x ) 6 Another proof of independence of order ¶ We will show that f [ x 0 , x 1 , … , x N ] f[x_0,x_1,\ldots,x_N] f [ x 0 , x 1 , … , x N ] is independent of the order of the arguments. Let p N − 1 ( x ) p_{N-1}(x) p N − 1 ( x ) interpolate the data { x 0 , x 1 , … , x N − 1 } \{ x_0, x_1, \ldots, x_{N-1}\} { x 0 , x 1 , … , x N − 1 } . In Newton form
p N − 1 ( x ) = f 0 + ( x − x 0 ) f [ x 0 , x 1 ] + ( x − x 0 ) ( x − x 1 ) f [ x 0 , x 1 , x 2 ] + … + ( x − x 0 ) … ( x − x N − 2 ) f [ x 0 , … , x N − 1 ] \begin{aligned}
p_{N-1}(x) = f_0 & + (x-x_0)f[x_0,x_1] \\
& + (x-x_0)(x-x_1) f[x_0,x_1, x_2] \\
& + \ldots \\
& + (x-x_0) \ldots (x-x_{N-2}) f[x_0,\ldots,x_{N-1}]
\end{aligned} p N − 1 ( x ) = f 0 + ( x − x 0 ) f [ x 0 , x 1 ] + ( x − x 0 ) ( x − x 1 ) f [ x 0 , x 1 , x 2 ] + … + ( x − x 0 ) … ( x − x N − 2 ) f [ x 0 , … , x N − 1 ] Consider a random permutation
{ x i 0 , x i 1 , … , x i N − 1 } \{ x_{i_0}, x_{i_1}, \ldots, x_{i_{N-1}} \} { x i 0 , x i 1 , … , x i N − 1 } and let Q N − 1 ( x ) Q_{N-1}(x) Q N − 1 ( x ) interpolate this data
Q N − 1 ( x ) = f i 0 + ( x − x i 0 ) f [ x i 0 , x i 1 ] + ( x − x i 0 ) ( x − x i 1 ) f [ x i 0 , x i 1 , x i 2 ] + … + ( x − x i 0 ) … ( x − x i N − 2 ) f [ x i 0 , … , x i N − 1 ] \begin{aligned}
Q_{N-1}(x) = f_{i_0} & + (x-x_{i_0})f[x_{i_0},x_{i_1}] \\
& + (x-x_{i_0})(x-x_{i_1}) f[x_{i_0},x_{i_1}, x_{i_2}] \\
& + \ldots \\
& + (x-x_{i_0}) \ldots (x-x_{i_{N-2}}) f[x_{i_0},\ldots,x_{i_{N-1}}]
\end{aligned} Q N − 1 ( x ) = f i 0 + ( x − x i 0 ) f [ x i 0 , x i 1 ] + ( x − x i 0 ) ( x − x i 1 ) f [ x i 0 , x i 1 , x i 2 ] + … + ( x − x i 0 ) … ( x − x i N − 2 ) f [ x i 0 , … , x i N − 1 ] But these two polynomials are same Q N − 1 = P N − 1 Q_{N-1} = P_{N-1} Q N − 1 = P N − 1 since they interpolate same data, and in particular the error at x = x N x=x_N x = x N is same
( x N − x 0 ) … ( x N − x N − 1 ) f [ x 0 , x 1 , … , x N ] = ( x N − x i 0 ) … ( x N − x i N − 1 ) f [ x i 0 , x i 1 , … , x N ] \begin{align*}
(x_N-x_0) \ldots(x_N - x_{N-1}) & f[x_0,x_1,\ldots,x_N] = \\
& (x_N-x_{i_0}) \ldots(x_N - x_{i_{N-1}}) f[x_{i_0},x_{i_1},\ldots,x_N]
\end{align*} ( x N − x 0 ) … ( x N − x N − 1 ) f [ x 0 , x 1 , … , x N ] = ( x N − x i 0 ) … ( x N − x i N − 1 ) f [ x i 0 , x i 1 , … , x N ] Since the polynomial factors are same, we get
f [ x 0 , x 1 , … , x N ] = f [ x i 0 , x i 1 , … , x N ] f[x_0,x_1,\ldots,x_N] = f[x_{i_0},x_{i_1},\ldots,x_N] f [ x 0 , x 1 , … , x N ] = f [ x i 0 , x i 1 , … , x N ] We can repeat this proof by leaving out x N − 1 , x N − 2 , … , x 0 x_{N-1}, x_{N-2}, \ldots, x_0 x N − 1 , x N − 2 , … , x 0 and then we obtain the complete proof.
7 Forward difference operator ¶ For h > 0 h > 0 h > 0 , define the forward difference
Δ f ( x ) = f ( x + h ) − f ( x ) \Delta f(x) = f(x+h) - f(x) Δ f ( x ) = f ( x + h ) − f ( x ) We will use uniformly spaced data at
x i = x 0 + i h , i = 0 , 1 , 2 , … x_i = x_0 + ih, \qquad i=0,1,2,\ldots x i = x 0 + ih , i = 0 , 1 , 2 , … Then
Δ f ( x i ) = f ( x i + h ) − f ( x i ) = f ( x i + 1 ) − f ( x i ) = f i + 1 − f i \Delta f(x_i) = f(x_i+h) - f(x_i) = f(x_{i+1}) - f(x_i) = f_{i+1} - f_i Δ f ( x i ) = f ( x i + h ) − f ( x i ) = f ( x i + 1 ) − f ( x i ) = f i + 1 − f i or, in compact form
Δ f i = f i + 1 − f i \Delta f_i = f_{i+1} - f_i Δ f i = f i + 1 − f i For r ≥ 0 r \ge 0 r ≥ 0 , define
Δ r + 1 f ( x ) = Δ r f ( x + h ) − Δ r f ( x ) \Delta^{r+1} f(x) = \Delta^r f(x+h) - \Delta^r f(x) Δ r + 1 f ( x ) = Δ r f ( x + h ) − Δ r f ( x ) Δ 0 f ( x ) = f ( x ) \Delta^0 f(x) = f(x) Δ 0 f ( x ) = f ( x ) Δ r + 1 f ( x ) \Delta^{r+1} f(x) Δ r + 1 f ( x ) is called the r r r -th order
forward difference of f f f at x x x .
For k ≥ 0 k \ge 0 k ≥ 0
f [ x 0 , x 1 , … , x k ] = 1 k ! h k Δ k f 0 f[x_0,x_1,\ldots,x_k] = \frac{1}{k! h^k} \Delta^k f_0 f [ x 0 , x 1 , … , x k ] = k ! h k 1 Δ k f 0 For k = 0 k=0 k = 0 , the result is trivially true since
1 0 ! h 0 Δ 0 f 0 = f 0 = f [ x 0 ] \frac{1}{0! h^0} \Delta^0 f_0 = f_0 = f[x_0] 0 ! h 0 1 Δ 0 f 0 = f 0 = f [ x 0 ] For k = 1 k=1 k = 1 ,
f [ x 0 , x 1 ] = f 1 − f 0 x 1 − x 0 = 1 h Δ f 0 f[x_0,x_1] = \frac{f_1 - f_0}{x_1 - x_0} = \frac{1}{h} \Delta f_0 f [ x 0 , x 1 ] = x 1 − x 0 f 1 − f 0 = h 1 Δ f 0 Assume that the result is true for all forward differences of order
k ≤ r k \le r k ≤ r . Then for k = r + 1 k=r+1 k = r + 1
f [ x 0 , x 1 , … , x r + 1 ] = f [ x 1 , … , x r + 1 ] − f [ x 0 , … , x r ] x r + 1 − x 0 = 1 ( r + 1 ) h [ 1 r ! h r Δ r f 1 − 1 r ! h r Δ r f 0 ] = 1 ( r + 1 ) ! h r + 1 Δ r + 1 f 0 \begin{aligned}
f[x_0,x_1,\ldots,x_{r+1}]
&= \frac{f[x_1,\ldots,x_{r+1}] - f[x_0,\ldots,x_r]}{x_{r+1} - x_0} \\
&= \frac{1}{(r+1)h} \left[ \frac{1}{r! h^r}\Delta^r f_1 - \frac{1}{r! h^r}\Delta^r f_0 \right] \\
&= \frac{1}{(r+1)! h^{r+1}} \Delta^{r+1}f_0
\end{aligned} f [ x 0 , x 1 , … , x r + 1 ] = x r + 1 − x 0 f [ x 1 , … , x r + 1 ] − f [ x 0 , … , x r ] = ( r + 1 ) h 1 [ r ! h r 1 Δ r f 1 − r ! h r 1 Δ r f 0 ] = ( r + 1 )! h r + 1 1 Δ r + 1 f 0 For uniformly spaced data, we can avoid the use of divided differences
and write in terms of forward differences, which is more efficient since
we avoid division, which is an expensive operation. Define
μ = x − x 0 h \mu = \frac{x - x_0}{h} μ = h x − x 0 Newton interpolation formula has factors of
the form ( x − x 0 ) … ( x − x k ) (x-x_0)\ldots(x-x_k) ( x − x 0 ) … ( x − x k ) . Since
x − x j = ( x 0 + μ h ) − ( x 0 + j h ) = ( μ − j ) h x-x_j = (x_0 + \mu h) - (x_0 + jh) = (\mu-j) h x − x j = ( x 0 + μ h ) − ( x 0 + jh ) = ( μ − j ) h hence
( x − x 0 ) … ( x − x k ) = μ ( μ − 1 ) … ( μ − k ) h k + 1 (x-x_0)\ldots(x-x_k) = \mu(\mu-1)\ldots(\mu-k) h^{k+1} ( x − x 0 ) … ( x − x k ) = μ ( μ − 1 ) … ( μ − k ) h k + 1 Using
previous lemma, we write divided difference in terms of forward
differences
p n ( x ) = f 0 + μ h Δ f 0 h + μ ( μ − 1 ) h 2 Δ 2 f 0 2 ! h 2 + … + μ ( μ − 1 ) … ( μ − n + 1 ) h n Δ n f 0 n ! h n p_n(x) = f_0 + \mu h \frac{\Delta f_0}{h} + \mu(\mu-1)h^2 \frac{\Delta^2 f_0}{2!
h^2} + \ldots + \mu(\mu-1)\ldots(\mu-n+1)h^n \frac{\Delta^n f_0}{n! h^n} p n ( x ) = f 0 + μ h h Δ f 0 + μ ( μ − 1 ) h 2 2 ! h 2 Δ 2 f 0 + … + μ ( μ − 1 ) … ( μ − n + 1 ) h n n ! h n Δ n f 0 Define the binomial coefficients
( μ k ) = μ ( μ − 1 ) … ( μ − k + 1 ) k ! , k > 0 \binom{\mu}{k} = \frac{\mu(\mu-1) \ldots (\mu-k+1)}{k!}, \qquad k > 0 ( k μ ) = k ! μ ( μ − 1 ) … ( μ − k + 1 ) , k > 0 ( μ 0 ) = 1 \binom{\mu}{0} = 1 ( 0 μ ) = 1 Then
p n ( x ) = ∑ j = 0 n ( μ j ) Δ j f 0 , μ = x − x 0 h p_n(x) = \sum_{j=0}^n \binom{\mu}{j} \Delta^j f_0, \qquad \mu = \frac{x-x_0}{h} p n ( x ) = j = 0 ∑ n ( j μ ) Δ j f 0 , μ = h x − x 0 This is the Newton forward difference form of the interpolating polynomial. A schematic of the computation is shown in Table 1 .
Table 1: Forward differences
x i x_i x i f i f_i f i Δ f i \Delta f_i Δ f i Δ 2 f i \Delta^2 f_i Δ 2 f i Δ 3 f i \Delta^3 f_i Δ 3 f i Δ 4 f i \Delta^4 f_i Δ 4 f i Δ 5 f i \Delta^5 f_i Δ 5 f i x 0 x_0 x 0 f 0 f_0 f 0 Δ f 0 \Delta f_0 Δ f 0 x 1 x_1 x 1 f 1 f_1 f 1 Δ 2 f 0 \Delta^2 f_0 Δ 2 f 0 Δ f 1 \Delta f_1 Δ f 1 Δ 3 f 0 \Delta^3 f_0 Δ 3 f 0 x 2 x_2 x 2 f 2 f_2 f 2 Δ 2 f 1 \Delta^2 f_1 Δ 2 f 1 Δ 4 f 0 \Delta^4 f_0 Δ 4 f 0 Δ f 2 \Delta f_2 Δ f 2 Δ 3 f 1 \Delta^3 f_1 Δ 3 f 1 Δ 5 f 0 \Delta^5 f_0 Δ 5 f 0 x 3 x_3 x 3 f 3 f_3 f 3 Δ 2 f 2 \Delta^2 f_2 Δ 2 f 2 Δ 4 f 1 \Delta^4 f_1 Δ 4 f 1 Δ f 3 \Delta f_3 Δ f 3 Δ 3 f 2 \Delta^3 f_2 Δ 3 f 2 x 4 x_4 x 4 f 4 f_4 f 4 Δ 2 f 3 \Delta^2 f_3 Δ 2 f 3 Δ f 4 \Delta f_4 Δ f 4 x 5 x_5 x 5 f 5 f_5 f 5
For n = 1 n=1 n = 1 , i.e., given ( x 0 , f 0 ) (x_0,f_0) ( x 0 , f 0 ) , ( x 1 , f 1 ) (x_1,f_1) ( x 1 , f 1 )
p 1 ( x ) = f 0 + μ Δ f 0 p_1(x) = f_0 + \mu \Delta f_0 p 1 ( x ) = f 0 + μ Δ f 0 For n = 2 n=2 n = 2 , i.e., given ( x 0 , f 0 ) (x_0,f_0) ( x 0 , f 0 ) ,
( x 1 , f 1 ) (x_1,f_1) ( x 1 , f 1 ) , ( x 2 , f 2 ) (x_2,f_2) ( x 2 , f 2 )
p 2 ( x ) = p 0 + μ Δ f 0 + 1 2 μ ( μ − 1 ) Δ 2 f 0 p_2(x) = p_0 + \mu \Delta f_0 + \frac{1}{2}\mu(\mu-1)\Delta^2 f_0 p 2 ( x ) = p 0 + μ Δ f 0 + 2 1 μ ( μ − 1 ) Δ 2 f 0 Take the function f ( x ) = x f(x) = \sqrt{x} f ( x ) = x . Given data on f ( x ) f(x) f ( x ) rounded to seven digits. Hence the data is accurate only to seven digits. Approximate f ( 2.15 ) = 2.15 = 1.4662878 f(2.15) = \sqrt{2.15} = 1.4662878 f ( 2.15 ) = 2.15 = 1.4662878
The data and forward differences are shown in Table 2 . The sixth decimal place may not be correct. The last column has no accuracy since the non-zero digit is at sixth decimal place.
Table 2: Forward differences for f ( x ) = x f(x) = \sqrt{x} f ( x ) = x . Data rounded to 7 digits. The 6’th decimal place could be erroneous.
x i x_i x i f i f_i f i Δ f i \Delta f_i Δ f i Δ 2 f i \Delta^2 f_i Δ 2 f i Δ 3 f i \Delta^3 f_i Δ 3 f i Δ 4 f i \Delta^4 f_i Δ 4 f i 2.0 1.414214 0.034924 2.1 1.449138 -0.000822 0.034102 0.000055 2.2 1.483240 -0.000767 -0.000005 0.033335 0.000050 2.3 1.516575 -0.000717 0.032618 2.4 1.549193
9 Errors in data and forward differences ¶ We can use a forward difference table to detect noise in physical data, as long as the noise is larger relative to the experimental error.
Δ r f ( x i ) = h r f ( r ) ( ξ ) , x i ≤ ξ i ≤ x i + r \Delta^r f(x_i) = h^r f^{(r)}(\xi), \qquad x_i \le \xi_i \le x_{i+r} Δ r f ( x i ) = h r f ( r ) ( ξ ) , x i ≤ ξ i ≤ x i + r If the derivatives of f ( x ) f(x) f ( x ) are uniformly bounded, or if h n f ( n ) → 0 h^n f^{(n)} \to 0 h n f ( n ) → 0 as n → ∞ n \to \infty n → ∞ , then the forward differences Δ n f ( x ) \Delta^n f(x) Δ n f ( x ) should become smaller as n n n increases. If the given data f ~ i \tilde{f}_i f ~ i has errors so that
f ( x i ) = f ~ i + e ( x i ) f(x_i) = \tilde{f}_i + e(x_i) f ( x i ) = f ~ i + e ( x i ) then
Δ r f ~ i = Δ r f ( x i ) − Δ r e ( x i ) \Delta^r \tilde{f}_i = \Delta^r f(x_i) - \Delta^r e(x_i) Δ r f ~ i = Δ r f ( x i ) − Δ r e ( x i ) The first term on the right decreases with r r r but the error term can behave badly. To understand this behaviour, consider a simple case where only one data point has error
e ( x i ) = { 0 i ≠ k ϵ i = k e(x_i) = \begin{cases}
0 & i \ne k \\
\epsilon & i = k
\end{cases} e ( x i ) = { 0 ϵ i = k i = k Table 3: Forward differences
x i x_i x i e ( x i ) e(x_i) e ( x i ) Δ e ( x i ) \Delta e(x_i) Δ e ( x i ) Δ 2 e ( x i ) \Delta^2 e(x_i) Δ 2 e ( x i ) Δ 3 e ( x i ) \Delta^3 e(x_i) Δ 3 e ( x i ) Δ 4 f i \Delta^4 f_i Δ 4 f i Δ 5 f i \Delta^5 f_i Δ 5 f i ⋮ \vdots ⋮ x k − 2 x_{k-2} x k − 2 0 0 ε 0 ε − 5 ϵ -5\epsilon − 5 ϵ x k − 1 x_{k-1} x k − 1 0 ε − 4 ϵ -4\epsilon − 4 ϵ ε − 3 ϵ -3\epsilon − 3 ϵ 10 ϵ 10\epsilon 10 ϵ x k x_k x k ε − 2 ϵ -2\epsilon − 2 ϵ 6 ϵ 6\epsilon 6 ϵ − ϵ -\epsilon − ϵ 3 ϵ 3\epsilon 3 ϵ − 10 ϵ -10\epsilon − 10 ϵ x k + 1 x_{k+1} x k + 1 0 ε − 4 ϵ -4\epsilon − 4 ϵ 0 − ϵ -\epsilon − ϵ 5 ϵ 5\epsilon 5 ϵ x k + 2 x_{k+2} x k + 2 0 0 ε 0 0 − ϵ -\epsilon − ϵ x 5 x_5 x 5 0 0 0
The differences Δ r e ( x i ) \Delta^r e(x_i) Δ r e ( x i ) increase with r r r as shown in Table 3 . Hence the differences Δ r f ~ i \Delta^r \tilde{f}_i Δ r f ~ i will also increase with r r r . This is an indication of error in the data. If the Δ r f ~ i \Delta^r \tilde{f}_i Δ r f ~ i start increasing, then the Newton polynomial must be truncated.
Let x 0 , x 1 , … , x n x_0,x_1,\ldots,x_n x 0 , x 1 , … , x n be distinct and let f f f be n n n times continuously differentiable in the interval of these points. Then
f [ x 0 , x 1 , … , x n ] = ∫ τ n f ( n ) ( t 0 x 0 + t 1 x 1 + … + t n x n ) d t 1 … d t n f[x_0,x_1,\ldots,x_n] = \int_{\tau_n} f^{(n)}(t_0 x_0 + t_1 x_1 + \ldots + t_n x_n) \ud
t_1 \ldots \ud t_n f [ x 0 , x 1 , … , x n ] = ∫ τ n f ( n ) ( t 0 x 0 + t 1 x 1 + … + t n x n ) d t 1 … d t n where
τ n = { ( t 1 , … , t n ) : t i ≥ 0 , ∑ j = 1 n t i ≤ 0 } , t 0 = 1 − ∑ j = 1 n t j \tau_n = \{(t_1,\ldots,t_n) : t_i \ge 0, \ \sum_{j=1}^n t_i \le 0 \}, \qquad t_0 = 1 -
\sum_{j=1}^n t_j τ n = {( t 1 , … , t n ) : t i ≥ 0 , j = 1 ∑ n t i ≤ 0 } , t 0 = 1 − j = 1 ∑ n t j (Note that 0 ≤ t 0 ≤ 1 0 \le t_0 \le 1 0 ≤ t 0 ≤ 1 and ∑ j = 0 n t j = 1 \sum_{j=0}^n t_j = 1 ∑ j = 0 n t j = 1 .)
10 Some properties of divided differences ¶ Recall that the divided difference can be written as
f [ x 0 , … , x n ] = f ( n ) ( ξ ) n !
f[x_0,\ldots,x_n] = \frac{f^{(n)}(\xi)}{n!} f [ x 0 , … , x n ] = n ! f ( n ) ( ξ ) Prove this result by induction. The Hermite-Gennochi formula relates the
sames quantities in terms of an integral.
If f ( n ) f^{(n)} f ( n ) is continuous in the interval [ min j x j , max j x j ] [\min_j x_j, \max_j x_j] [ min j x j , max j x j ] ,
then f [ x 0 , … , x n ] f[x_0,\ldots,x_n] f [ x 0 , … , x n ] is a continuous function of
x 0 , … , x n x_0, \ldots,x_n x 0 , … , x n .
From the Hermite-Gennochi formula, we see that the right hand side
makes sense even if all the x j x_j x j are not distinct. If we take all
arguments to be equal to x x x , then
f [ x , x , … , x ⏟ n + 1 arguments ] = ∫ τ n f ( n ) ( x ) d t 1 … d t n = f n ( x ) volume ( τ n ) = f ( n ) ( x ) n !
\begin{aligned}
f[\underbrace{x,x,\ldots,x}_{n+1 \textrm{ arguments}}]
=& \int_{\tau_n} f^{(n)}(x) \ud t_1 \ldots \ud t_n \\
=& f^n(x) \textrm{ volume}(\tau_n) \\
=& \frac{f^{(n)}(x)}{n!}
\end{aligned} f [ n + 1 arguments x , x , … , x ] = = = ∫ τ n f ( n ) ( x ) d t 1 … d t n f n ( x ) volume ( τ n ) n ! f ( n ) ( x ) Consider f [ x 0 , … , x n , x ] f[x_0,\ldots,x_n,x] f [ x 0 , … , x n , x ] as a function of x x x and
differentiate this. By definition of the derivative
d d x f [ x 0 , … , x n , x ] = lim h → 0 f [ x 0 , … , x n , x + h ] − f [ x 0 , … , x n , x ] h = lim h → 0 f [ x 0 , … , x n , x + h ] − f [ x , x 0 , … , x n ] h = lim h → 0 f [ x , x 0 , … , x n , x + h ] = f [ x , x 0 , … , x n , x ] = f [ x 0 , … , x n , x , x ]
\begin{aligned}
\dd{}{x}f[x_0,\ldots,x_n,x]
=& \lim_{h \to 0} \frac{f[x_0,\ldots,x_n,x+h] - f[x_0,\ldots,x_n,x]}{h} \\
=& \lim_{h \to 0} \frac{f[x_0,\ldots,x_n,x+h] - f[x,x_0,\ldots,x_n]}{h} \\
=& \lim_{h \to 0} f[x,x_0,\ldots,x_n,x+h] \\
=& f[x,x_0,\ldots,x_n,x] \\
=& f[x_0,\ldots,x_n,x,x]
\end{aligned} d x d f [ x 0 , … , x n , x ] = = = = = h → 0 lim h f [ x 0 , … , x n , x + h ] − f [ x 0 , … , x n , x ] h → 0 lim h f [ x 0 , … , x n , x + h ] − f [ x , x 0 , … , x n ] h → 0 lim f [ x , x 0 , … , x n , x + h ] f [ x , x 0 , … , x n , x ] f [ x 0 , … , x n , x , x ] The quantity on the right has n + 3 n+3 n + 3 arguments and it
is well defined if f ∈ C n + 2 f \in
\cts^{n+2} f ∈ C n + 2 .