Trigonometric interpolation

Short description: Interpolation with trigonometric polynomials

In mathematics, trigonometric interpolation is interpolation with trigonometric polynomials. Interpolation is the process of finding a function which goes through some given data points. For trigonometric interpolation, this function has to be a trigonometric polynomial, that is, a sum of sines and cosines of given periods. This form is especially suited for interpolation of periodic functions.

An important special case is when the given data points are equally spaced, in which case the solution is given by the discrete Fourier transform.

## Contents

* 1 Formulation of the interpolation problem
* 2 Formulation in the complex plane
* 3 Solution of the problem
* 3.1 Odd number of points
* 3.2 Even number of points
* 4 Equidistant nodes
* 4.1 Odd number of points
* 4.2 Even number of points
* 4.3 Implementation
* 4.4 Relation with the discrete Fourier transform
* 5 Applications in numerical computing
* 6 References
* 7 External links

## Formulation of the interpolation problem

A trigonometric polynomial of degree K has the form

p(x)=a0+∑k=1Kakcos⁡(kx)+∑k=1Kbksin⁡(kx).

|
|

(1)

This expression contains 2K \+ 1 coefficients, a0, a1, … aK, b1, …, bK, and we wish to compute those coefficients so that the function passes through N points:

p(xn)=yn,n=0,…,N−1.

Since the trigonometric polynomial is periodic with period 2π, the N points can be distributed and ordered in one period as

0≤x0<x1<x2<…<xN−1<2π.

(Note that we do not in general require these points to be equally spaced.) The interpolation problem is now to find coefficients such that the trigonometric polynomial p satisfies the interpolation conditions.

## Formulation in the complex plane

The problem becomes more natural if we formulate it in the complex plane. We can rewrite the formula for a trigonometric polynomial as p(x)=∑k=−KKckeikx, where i is the imaginary unit. If we set z = eix, then this becomes

q(z)=∑k=−KKckzk,

with

q(eix)≜p(x).

This reduces the problem of trigonometric interpolation to that of polynomial interpolation on the unit circle. Existence and uniqueness for trigonometric interpolation now follows immediately from the corresponding results for polynomial interpolation.

For more information on formulation of trigonometric interpolating polynomials in the complex plane, see p. 156 of Interpolation using Fourier Polynomials.

## Solution of the problem

Under the above conditions, there exists a solution to the problem for any given set of data points {xk, yk} as long as N, the number of data points, is not larger than the number of coefficients in the polynomial, i.e., N ≤ 2K+1 (a solution may or may not exist if N>2K+1 depending upon the particular set of data points). Moreover, the interpolating polynomial is unique if and only if the number of adjustable coefficients is equal to the number of data points, i.e., N = 2K + 1\. In the remainder of this article, we will assume this condition to hold true.

### Odd number of points

If the number of points N is odd, say N=2K+1, applying the Lagrange formula for polynomial interpolation to the polynomial formulation in the complex plane yields that the solution can be written in the form

p(x)=∑k=02Kyktk(x),

|
|

(5)

where

tk(x)=e−iKx+iKxk∏m=0m≠k2Keix−eixmeixk−eixm.

The factor e−iKx+iKxk in this formula compensates for the fact that the complex plane formulation contains also negative powers of eix and is therefore not a polynomial expression in eix. The correctness of this expression can easily be verified by observing that tk(xk)=1 and that tk(x) is a linear combination of the right powers of eix. Upon using the identity

eiz1−eiz2=2isin⁡12(z1−z2)e(z1+z2)i/2,

|
|

(2)

the coefficient tk(x) can be written in the form

tk(x)=∏m=0m≠k2Ksin⁡12(x−xm)sin⁡12(xk−xm).

|
|

(4)

### Even number of points

If the number of points N is even, say N=2K, applying the Lagrange formula for polynomial interpolation to the polynomial formulation in the complex plane yields that the solution can be written in the form

p(x)=∑k=02K−1yktk(x),

|
|

(6)

where

tk(x)=e−iKx+iKxkeix−eiαkeixk−eiαk∏m=0m≠k2K−1eix−eixmeixk−eixm.

|
|

(3)

Here, the constants αk can be chosen freely. This is caused by the fact that the interpolating function (1) contains an odd number of unknown constants. A common choice is to require that the highest frequency is of the form a constant times cos⁡(Kx), i.e. the sin⁡(Kx) term vanishes, but in general the phase of the highest frequency can be chosen to be φK. To get an expression for αk, we obtain by using (2) that (3) can be written on the form

tk(x)=cos⁡12(2Kx−αk+∑m=0,m≠k2K−1xm)+∑m=−(K−1)K−1ckeimx2Nsin⁡12(xk−αk)∏m=0,m≠k2K−1sin⁡12(xk−xm).

This yields

αk=∑m=0m≠k2K−1xm−2φK

and

tk(x)=sin⁡12(x−αk)sin⁡12(xk−αk)∏m=0m≠k2K−1sin⁡12(x−xm)sin⁡12(xk−xm).

Note that care must be taken in order to avoid infinities caused by zeros in the denominators.

## Equidistant nodes

Further simplification of the problem is possible if nodes xm are equidistant, i.e.

xm=2πmN,

see Zygmund for more details.

### Odd number of points

Further simplification by using (4) would be an obvious approach, but is obviously involved. A much simpler approach is to consider the Dirichlet kernel

D(x,N)=1N+2N∑k=1(N−1)/2cos⁡(kx)=sin⁡12NxNsin⁡12x,

where N>0 is odd. It can easily be seen that D(x,N) is a linear combination of the right powers of eix and satisfies

D(xm,N)={0 for m≠01 for m=0.

Since these two properties uniquely define the coefficients tk(x) in (5), it follows that

tk(x)=D(x−xk,N)={sin⁡12N(x−xk)Nsin⁡12(x−xk) for x≠xklim⁡x->0sin⁡12NxNsin⁡12x=1 for x=xk=sinc12N(x−xk)sinc12(x−xk).

Here, the sinc-function prevents any singularities and is defined by

sincx=sin⁡xx.

### Even number of points

For N even, we define the Dirichlet kernel as

D(x,N)=1N+1Ncos⁡12Nx+2N∑k=1(N−1)/2cos⁡(kx)=sin⁡12NxNtan⁡12x.

Again, it can easily be seen that D(x,N) is a linear combination of the right powers of eix, does not contain the term sin⁡12Nx and satisfies

D(xm,N)={0 for m≠01 for m=0.

Using these properties, it follows that the coefficients tk(x) in (6) are given by

tk(x)=D(x−xk,N)={sin⁡12N(x−xk)Ntan⁡12(x−xk) for x≠xklim⁡x->0sin⁡12NxNtan⁡12x=1 for x=xk.=sinc12N(x−xk)sinc12(x−xk)cos⁡12(x−xk)

Note that tk(x) does not contain the sin⁡12Nx as well. Finally, note that the function sin⁡12Nx vanishes at all the points xm. Multiples of this term can, therefore, always be added, but it is commonly left out.

### Implementation

A MATLAB implementation of the above can be found here and is given by:

function P = triginterp(xi,x,y)
% TRIGINTERP Trigonometric interpolation.
% Input:
%   xi  evaluation points for the interpolant (vector)
%   x   equispaced interpolation nodes (vector, length N)
%   y   interpolation values (vector, length N)
% Output:
%   P   values of the trigonometric interpolant (vector)
N = length(x);
% Adjust the spacing of the given independent variable.
h = 2/N;
scale = (x(2)-x(1)) / h;
x = x/scale;  xi = xi/scale;
% Evaluate interpolant.
P = zeros(size(xi));
for k = 1:N
P = P + y(k)*trigcardinal(xi-x(k),N);
end

function tau = trigcardinal(x,N)
ws = warning('off','MATLAB:divideByZero');
% Form is different for even and odd N.
if rem(N,2)==1   % odd
tau = sin(N*pi*x/2) ./ (N*sin(pi*x/2));
else             % even
tau = sin(N*pi*x/2) ./ (N*tan(pi*x/2));
end
warning(ws)
tau(x==0) = 1;     % fix value at x=0

### Relation with the discrete Fourier transform

The special case in which the points xn are equally spaced is especially important. In this case, we have

xn=2πnN,0≤n<N.

The transformation that maps the data points yn to the coefficients ak, bk is obtained from the discrete Fourier transform (DFT) of order N.

Yk=∑n=0N−1yn e−i2πnk/N

yn=p(xn)=1N∑k=0N−1Yk ei2πnk/N

(Because of the way the problem was formulated above, we have restricted ourselves to odd numbers of points. This is not strictly necessary; for even numbers of points, one includes another cosine term corresponding to the Nyquist frequency.)

The case of the cosine-only interpolation for equally spaced points, corresponding to a trigonometric interpolation when the points have even symmetry, was treated by Alexis Clairaut in 1754. In this case the solution is equivalent to a discrete cosine transform. The sine-only expansion for equally spaced points, corresponding to odd symmetry, was solved by Joseph Louis Lagrange in 1762, for which the solution is a discrete sine transform. The full cosine and sine interpolating polynomial, which gives rise to the DFT, was solved by Carl Friedrich Gauss in unpublished work around 1805, at which point he also derived a fast Fourier transform algorithm to evaluate it rapidly. Clairaut, Lagrange, and Gauss were all concerned with studying the problem of inferring the orbit of planets, asteroids, etc., from a finite set of observation points; since the orbits are periodic, a trigonometric interpolation was a natural choice. See also Heideman et al. (1984).

## Applications in numerical computing

Chebfun, a fully integrated software system written in MATLAB for computing with functions, uses trigonometric interpolation and Fourier expansions for computing with periodic functions. Many algorithms related to trigonometric interpolation are readily available in Chebfun; several examples are available here.

## References

* Kendall E. Atkinson, An Introduction to Numerical Analysis (2nd edition), Section 3.8. John Wiley & Sons, New York, 1988. ISBN 0-471-50023-2.
* M. T. Heideman, D. H. Johnson, and C. S. Burrus, "Gauss and the history of the fast Fourier transform," IEEE ASSP Magazine 1 (4), 14-21 (1984).
* G.B. Wright, M. Javed, H. Montanelli, and L.N. Trefethen, "Extension of Chebfun to periodic functions," SIAM. J. Sci. Comput., 37 (2015), C554-C573
* A. Zygmund, Trigonometric Series, Volume II, Chapter X, Cambridge University Press, 1988.

## External links

* www.chebfun.org

0.00

(0 votes)

Original source: https://en.wikipedia.org/wiki/Trigonometric interpolation. Read more

|

Retrieved from "https://handwiki.org/wiki/index.php?title=Trigonometric_interpolation&oldid=4414247"