Hermite interpolation

From HandWiki
Short description: Polynomial interpolation using derivative values

In numerical analysis, Hermite interpolation, named after Charles Hermite, is a method of polynomial interpolation, which generalizes Lagrange interpolation. Lagrange interpolation allows computing a polynomial of degree less than n that takes the same value at n given points as a given function. Instead, Hermite interpolation computes a polynomial of degree less than mn such that the polynomial and its m − 1 first derivatives have the same values at n given points as a given function and its m − 1 first derivatives.

Hermite's method of interpolation is closely related to the Newton's interpolation method, in that both are derived from the calculation of divided differences. However, there are other methods for computing a Hermite interpolating polynomial. One can use linear algebra, by taking the coefficients of the interpolating polynomial as unknowns, and writing as linear equations the constraints that the interpolating polynomial must satisfy. For another method, see Chinese remainder theorem § Hermite interpolation.

Statement of the problem

Hermite interpolation consists of computing a polynomial of degree as low as possible that matches an unknown function both in observed value, and the observed value of its first m derivatives. This means that n(m + 1) values

[math]\displaystyle{ \begin{matrix} (x_0, y_0), &(x_1, y_1), &\ldots, &(x_{n-1}, y_{n-1}), \\ (x_0, y_0'), &(x_1, y_1'), &\ldots, &(x_{n-1}, y_{n-1}'), \\ \vdots & \vdots & &\vdots \\ (x_0, y_0^{(m)}), &(x_1, y_1^{(m)}), &\ldots, &(x_{n-1}, y_{n-1}^{(m)}) \end{matrix} }[/math]

must be known. The resulting polynomial has a degree less than n(m + 1). (In a more general case, there is no need for m to be a fixed value; that is, some points may have more known derivatives than others. In this case the resulting polynomial has a degree less than the number of data points.)

Let us consider a polynomial P(x) of degree less than n(m + 1) with indeterminate coefficients; that is, the coefficients of P(x) are n(m + 1) new variables. Then, by writing the constraints that the interpolating polynomial must satisfy, one gets a system of n(m + 1) linear equations in n(m + 1) unknowns.

In general, such a system has exactly one solution. Charles Hermite proved that this is effectively the case here, as soon as the xi are pairwise different,[citation needed] and provided a method for computing it, which is described below.

Method

Simple case

When using divided differences to calculate the Hermite polynomial of a function f, the first step is to copy each point m times. (Here we will consider the simplest case [math]\displaystyle{ m = 1 }[/math] for all points.) Therefore, given [math]\displaystyle{ n + 1 }[/math] data points [math]\displaystyle{ x_0, x_1, x_2, \ldots, x_n }[/math], and values [math]\displaystyle{ f(x_0), f(x_1), \ldots, f(x_n) }[/math] and [math]\displaystyle{ f'(x_0), f'(x_1), \ldots, f'(x_n) }[/math] for a function [math]\displaystyle{ f }[/math] that we want to interpolate, we create a new dataset

[math]\displaystyle{ z_0, z_1, \ldots, z_{2n+1} }[/math]

such that

[math]\displaystyle{ z_{2i}=z_{2i+1}=x_i. }[/math]

Now, we create a divided differences table for the points [math]\displaystyle{ z_0, z_1, \ldots, z_{2n+1} }[/math]. However, for some divided differences,

[math]\displaystyle{ z_i = z_{i + 1}\implies f[z_i, z_{i+1}] = \frac{f(z_{i+1})-f(z_{i})}{z_{i+1}-z_{i}} = \frac{0}{0} }[/math]

which is undefined. In this case, the divided difference is replaced by [math]\displaystyle{ f'(z_i) }[/math]. All others are calculated normally.

General case

In the general case, suppose a given point [math]\displaystyle{ x_i }[/math] has k derivatives. Then the dataset [math]\displaystyle{ z_0, z_1, \ldots, z_{N} }[/math] contains k identical copies of [math]\displaystyle{ x_i }[/math]. When creating the table, divided differences of [math]\displaystyle{ j = 2, 3, \ldots, k }[/math] identical values will be calculated as

[math]\displaystyle{ \frac{f^{(j)}(x_i)}{j!}. }[/math]

For example,

[math]\displaystyle{ f[x_i, x_i, x_i]=\frac{f''(x_i)}{2} }[/math]
[math]\displaystyle{ f[x_i, x_i, x_i, x_i]=\frac{f^{(3)}(x_i)}{6} }[/math]

etc.

Example

Consider the function [math]\displaystyle{ f(x) = x^8 + 1 }[/math]. Evaluating the function and its first two derivatives at [math]\displaystyle{ x \in \{-1, 0, 1\} }[/math], we obtain the following data:

x ƒ(x) ƒ'(x) ƒ''(x)
−1 2 −8 56
0 1 0 0
1 2 8 56

Since we have two derivatives to work with, we construct the set [math]\displaystyle{ \{z_i\} = \{-1, -1, -1, 0, 0, 0, 1, 1, 1\} }[/math]. Our divided difference table is then:

[math]\displaystyle{ \begin{array}{llcclrrrrr} z_0 = -1 & f[z_0] = 2 & & & & & & & & \\ & & \frac{f'(z_0)}{1} = -8 & & & & & & & \\ z_1 = -1 & f[z_1] = 2 & & \frac{f''(z_1)}{2} = 28 & & & & & & \\ & & \frac{f'(z_1)}{1} = -8 & & f[z_3,z_2,z_1,z_0] = -21 & & & & & \\ z_2 = -1 & f[z_2] = 2 & & f[z_3,z_2,z_1] = 7 & & 15 & & & & \\ & & f[z_3,z_2] = -1 & & f[z_4,z_3,z_2,z_1] = -6 & & -10 & & & \\ z_3 = 0 & f[z_3] = 1 & & f[z_4,z_3,z_2] = 1 & & 5 & & 4 & & \\ & & \frac{f'(z_3)}{1} = 0 & & f[z_5,z_4,z_3,z_2] = -1 & & -2 & & -1 & \\ z_4 = 0 & f[z_4] = 1 & & \frac{f''(z_4)}{2} = 0 & & 1 & & 2 & & 1 \\ & & \frac{f'(z_4)}{1} = 0 & & f[z_6,z_5,z_4,z_3] = 1 & & 2 & & 1 & \\ z_5 = 0 & f[z_5] = 1 & & f[z_6,z_5,z_4] = 1 & & 5 & & 4 & & \\ & & f[z_6,z_5] = 1 & & f[z_7,z_6,z_5,z_4] = 6 & & 10 & & & \\ z_6 = 1 & f[z_6] = 2 & & f[z_7,z_6,z_5] = 7 & & 15 & & & & \\ & & \frac{f'(z_6)}{1} = 8 & & f[z_8,z_7,z_6,z_5] = 21 & & & & & \\ z_7 = 1 & f[z_7] = 2 & & \frac{f''(z_7)}{2} = 28 & & & & & & \\ & & \frac{f'(z_7)}{1} = 8 & & & & & & & \\ z_8 = 1 & f[z_8] = 2 & & & & & & & & \\ \end{array} }[/math]

and the generated polynomial is

[math]\displaystyle{ \begin{align} P(x) &= 2 - 8(x+1) + 28(x+1) ^2 - 21 (x+1)^3 + 15x(x+1)^3 - 10x^2(x+1)^3 \\ &\quad{} + 4x^3(x+1)^3 -1x^3(x+1)^3(x-1)+x^3(x+1)^3(x-1)^2 \\ &=2 - 8 + 28 - 21 - 8x + 56x - 63x + 15x + 28x^2 - 63x^2 + 45x^2 - 10x^2 - 21x^3 \\ &\quad {}+ 45x^3 - 30x^3 + 4x^3 + x^3 + x^3 + 15x^4 - 30x^4 + 12x^4 + 2x^4 + x^4 \\ &\quad {}- 10x^5 + 12x^5 - 2x^5 + 4x^5 - 2x^5 - 2x^5 - x^6 + x^6 - x^7 + x^7 + x^8 \\ &= x^8 + 1. \end{align} }[/math]

by taking the coefficients from the diagonal of the divided difference table, and multiplying the kth coefficient by [math]\displaystyle{ \prod_{i=0}^{k-1} (x - z_i) }[/math], as we would when generating a Newton polynomial.

Quintic Hermite interpolation

The quintic Hermite interpolation based on the function ([math]\displaystyle{ f }[/math]), its first ([math]\displaystyle{ f' }[/math]) and second derivatives ([math]\displaystyle{ f'' }[/math]) at two different points ([math]\displaystyle{ x_0 }[/math] and [math]\displaystyle{ x_1 }[/math]) can be used for example to interpolate the position of an object based on its position, velocity and acceleration. The general form is given by

[math]\displaystyle{ \begin{align} p(x) & = f(x_0) + f'(x_0) (x - x_0) + \frac{1}{2}f''(x_0) (x - x_0)^2 + \frac{f(x_1) - f(x_0) - f'(x_0) (x_1 - x_0) - \frac{1}{2} f''(x_0) (x_1 - x_0)^2}{(x_1 - x_0)^3} (x - x_0)^3 \\ & + \frac{3 f(x_0) - 3 f(x_1) + 2\left( f'(x_0) + \frac{1}{2}f'(x_1) \right) (x_1 - x_0) + \frac{1}{2} f''(x_0) (x_1 - x_0)^2}{(x_1 - x_0)^4} (x - x_0)^3 (x - x_1) \\ & + \frac{6 f(x_1) - 6 f(x_0) - 3 \left( f'(x_0) + f'(x_1) \right) (x_1 - x_0) + \frac{1}{2}\left( f''(x_1) - f''(x_0) \right) (x_1 - x_0)^2}{(x_1 - x_0)^5} (x - x_0)^3 (x - x_1)^2. \end{align} }[/math]

Error

Call the calculated polynomial H and original function f. Evaluating a point [math]\displaystyle{ x \in [x_0, x_n] }[/math], the error function is

[math]\displaystyle{ f(x) - H(x) = \frac{f^{(K)}(c)}{K!} \prod_{i}(x - x_i)^{k_i}, }[/math]

where c is an unknown within the range [math]\displaystyle{ [x_0, x_N] }[/math], K is the total number of data-points, and [math]\displaystyle{ k_i }[/math] is the number of derivatives known at each [math]\displaystyle{ x_i }[/math] plus one.

See also

References

  • Burden, Richard L.; Faires, J. Douglas (2004). Numerical Analysis. Belmont: Brooks/Cole. 
  • Spitzbart, A. (January 1960), "A Generalization of Hermite's Interpolation Formula", American Mathematical Monthly 67 (1): 42–46, doi:10.2307/2308924 

External links