### 2.3 Polynomial interpolation

#### 2.3.1 Orthogonal polynomials

Spectral methods are often based on the notion of orthogonal polynomials. In order to define orthogonality, one must define the scalar product of two functions on an interval . Let us consider a positive function of called the measure. The scalar product of and with respect to this measure is defined as:

A basis of is then a set of polynomials . is of degree and the polynomials are orthogonal: for .

The projection of a function on this basis is then

where the coefficients of the projection are given by
The difference between and its projection goes to zero when increases:
Figure 6 shows the function and its projection on Chebyshev polynomials (see Section 2.4.3) for and , illustrating the rapid convergence of to .

At first sight, the projection seems to be an interesting means of numerically representing a function. However, in practice this is not the case. Indeed, to determine the projection of a function, one needs to compute the integrals (30), which requires the evaluation of at a great number of points, making the whole numerical scheme impractical.

The main theorem of Gaussian quadratures (see for instance [57]) states that, given a measure , there exist positive real numbers and real numbers such that:

The are called the weights and the are the collocation points. The integer can take several values depending on the exact quadrature considered:
• Gauss–Lobatto: and .

Gauss quadrature is the best choice because it applies to polynomials of higher degree but Gauss–Lobatto quadrature is often more useful for numerical purposes because the outermost collocation points coincide with the boundaries of the interval, making it easier to impose matching or boundary conditions. More detailed results and demonstrations about those quadratures can be found for instance in [57].

#### 2.3.3 Spectral interpolation

As already stated in 2.3.1, the main drawback of projecting a function in terms of orthogonal polynomials comes from the difficulty to compute the integrals (30). The idea of spectral methods is to approximate the coefficients of the projection by making use of Gaussian quadratures. By doing so, one can define the interpolant of a function by

where
The exactly coincides with the coefficients , if the Gaussian quadrature is applicable for computing Equation (30), that is, for all . So, in general, and the difference between the two is called the aliasing error. The advantage of using is that they are computed by estimating at the collocation points only.

One can show that and coincide at the collocation points: so that interpolates on the grid, whose nodes are the collocation points. Figure 7 shows the function and its spectral interpolation using Chebyshev polynomials, for and .

#### 2.3.4 Two equivalent descriptions

The description of a function in terms of its spectral interpolation can be given in two different, but equivalent spaces:

• in the configuration space, if the function is described by its value at the collocation points ;
• in the coefficient space, if one works with the coefficients .

There is a bijection between both spaces and the following relations enable us to go from one to the other:

• the coefficients can be computed from the values of using Equation (34);
• the values at the collocation points are expressed in terms of the coefficients by making use of the definition of the interpolant (33):

Depending on the operation one has to perform on a given function, it may be more clever to work in one space or the other. For instance, the square root of a function is very easily given in the collocation space by , whereas the derivative can be computed in the coefficient space if, and this is generally the case, the derivatives of the basis polynomials are known, by .