Polynom

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 82

An introduction to polynomial interpolation

Eric Gourgoulhon
Laboratoire de lUnivers et de ses Theories (LUTH)
CNRS / Observatoire de Paris
F-92195 Meudon, France
eric.gourgoulhon@obspm.fr
School on spectral methods:
Application to General Relativity and Field Theory
Meudon, 14-18 November 2005
http://www.lorene.obspm.fr/school/
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 1 / 50
Plan
1
Introduction
2
Interpolation on an arbitrary grid
3
Expansions onto orthogonal polynomials
4
Convergence of the spectral expansions
5
References
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 2 / 50
Introduction
Outline
1
Introduction
2
Interpolation on an arbitrary grid
3
Expansions onto orthogonal polynomials
4
Convergence of the spectral expansions
5
References
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 3 / 50
Introduction
Introduction
Basic idea: approximate functions R R by polynomials
Polynomials are the only functions that a computer can evaluate exactely.
Two types of numerical methods based on polynomial approximations:
spectral methods: high order polynomials on a single domain (or a few
domains)
nite elements: low order polynomials on many domains
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 4 / 50
Introduction
Introduction
Basic idea: approximate functions R R by polynomials
Polynomials are the only functions that a computer can evaluate exactely.
Two types of numerical methods based on polynomial approximations:
spectral methods: high order polynomials on a single domain (or a few
domains)
nite elements: low order polynomials on many domains
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 4 / 50
Introduction
Framework of this lecture
We consider real-valued functions on the compact interval [1, 1]:
f : [1, 1] R
We denote
by P the set all real-valued polynomials on [1, 1]:
p P, x [1, 1], p(x) =
n

i=0
a
i
x
i
by P
N
(where N is a positive integer), the subset of polynomials of degree at
most N.
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 5 / 50
Introduction
Is it a good idea to approximate functions by polynomials ?
For continuous functions, the answer is yes:
Theorem (Weierstrass, 1885)
P is a dense subspace of the space C
0
([1, 1]) of all continuous functions on
[1, 1], equiped with the uniform norm |.|

.
a
a
This is a particular case of the Stone-Weierstrass theorem
The uniform norm or maximum norm is dened by |f|

= max
x[1,1]
[f(x)[
Other phrasings:
For any continuous function on [1, 1], f, and any > 0, there exists a
polynomial p P such that |f p|

< .
For any continuous function on [1, 1], f, there exists a sequence of polynomials
(p
n
)
nN
which converges uniformly towards f: lim
n
|f p
n
|

= 0.
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 6 / 50
Introduction
Best approximation polynomial
For a given continuous function: f C
0
([1, 1]), a best approximation
polynomial of degree N is a polynomial p

N
(f) P
N
such that
|f p

N
(f)|

= min |f p|

, p P
N

Chebyshevs alternant theorem (or equioscillation theorem)


For any f C
0
([1, 1]) and N 0, the best approximation polynomial p

N
(f)
exists and is unique. Moreover, there exists N +2 points x
0
, x
1
, ... x
N+1
in [-1,1]
such that
f(x
i
) p

N
(f)(x
i
) = (1)
i
|f p

N
(f)|

, 0 i N + 1
or f(x
i
) p

N
(f)(x
i
) = (1)
i+1
|f p

N
(f)|

, 0 i N + 1
Corollary: p

N
(f) interpolates f in N + 1 points.
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 7 / 50
Introduction
Illustration of Chebyshevs alternant theorem
N = 1
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 8 / 50
Introduction
Illustration of Chebyshevs alternant theorem
N = 1
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 8 / 50
Interpolation on an arbitrary grid
Outline
1
Introduction
2
Interpolation on an arbitrary grid
3
Expansions onto orthogonal polynomials
4
Convergence of the spectral expansions
5
References
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 9 / 50
Interpolation on an arbitrary grid
Interpolation on an arbitrary grid
Denition: given an integer N 1, a grid is a set of N + 1 points
X = (x
i
)
0iN
in [-1,1] such that 1 x
0
< x
1
< < x
N
1. The N + 1
points (x
i
)
0iN
are called the nodes of the grid.
Theorem
Given a function f C
0
([1, 1]) and a grid of N + 1 nodes, X = (x
i
)
0iN
,
there exist a unique polynomial of degree N, I
X
N
f, such that
I
X
N
f(x
i
) = f(x
i
), 0 i N
I
X
N
f is called the interpolant (or the interpolating polynomial) of f through the
grid X.
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 10 / 50
Interpolation on an arbitrary grid
Lagrange form of the interpolant
The interpolant I
X
N
f can be expressed in the Lagrange form:
I
X
N
f(x) =
N

i=0
f(x
i
)
X
i
(x),
where
X
i
(x) is the i-th Lagrange cardinal polynomial associated with the grid X:

X
i
(x) :=
N

j=0
j=i
x x
j
x
i
x
j
, 0 i N
The Lagrange cardinal polynomials are such that

X
i
(x
j
) =
ij
, 0 i, j N
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 11 / 50
Interpolation on an arbitrary grid
Examples of Lagrange polynomials
Uniform grid N = 8
X
0
(x)
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 12 / 50
Interpolation on an arbitrary grid
Examples of Lagrange polynomials
Uniform grid N = 8
X
1
(x)
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 12 / 50
Interpolation on an arbitrary grid
Examples of Lagrange polynomials
Uniform grid N = 8
X
2
(x)
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 12 / 50
Interpolation on an arbitrary grid
Examples of Lagrange polynomials
Uniform grid N = 8
X
3
(x)
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 12 / 50
Interpolation on an arbitrary grid
Examples of Lagrange polynomials
Uniform grid N = 8
X
4
(x)
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 12 / 50
Interpolation on an arbitrary grid
Examples of Lagrange polynomials
Uniform grid N = 8
X
5
(x)
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 12 / 50
Interpolation on an arbitrary grid
Examples of Lagrange polynomials
Uniform grid N = 8
X
6
(x)
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 12 / 50
Interpolation on an arbitrary grid
Examples of Lagrange polynomials
Uniform grid N = 8
X
7
(x)
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 12 / 50
Interpolation on an arbitrary grid
Examples of Lagrange polynomials
Uniform grid N = 8
X
8
(x)
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 12 / 50
Interpolation on an arbitrary grid
Examples of Lagrange polynomials
Uniform grid N = 8
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 12 / 50
Interpolation on an arbitrary grid
Interpolation error with respect to the best approximation
error
Let N N, X = (x
i
)
0iN
a grid of N + 1 nodes and f C
0
([1, 1]).
Let us consider the interpolant I
X
N
f of f through the grid X.
The best approximation polynomial p

N
(f) is also an interpolant of f at N + 1
nodes (in general dierent from X)
reminder
How does the error |f I
X
N
f|

behave with respect to the smallest possible


error |f p

N
(f)|

?
The answer is given by the formula:
|f I
X
N
f|

(1 +
N
(X)) |f p

N
(f)|

where
N
(X) is the Lebesgue constant relative to the grid X:

N
(X) := max
x[1,1]
N

i=0

X
i
(x)

Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 13 / 50


Interpolation on an arbitrary grid
Lebesgue constant
The Lebesgue constant contains all the information on the eects of the choice of
X on |f I
X
N
f|

.
Theorem (Erdos, 1961)
For any choice of the grid X, there exists a constant C > 0 such that

N
(X) >
2

ln(N + 1) C
Corollary:
N
(X) as N
In particular, for a uniform grid,
N
(X)
2
N+1
eN ln N
as N !
This means that for any choice of type of sampling of [1, 1], there exists a
continuous function f C
0
([1, 1]) such that I
X
N
f does not convergence
uniformly towards f.
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 14 / 50
Interpolation on an arbitrary grid
Example: uniform interpolation of a gentle function
f(x) = cos(2 exp(x)) uniform grid N = 4 : |f I
X
4
f|

1.40
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 15 / 50
Interpolation on an arbitrary grid
Example: uniform interpolation of a gentle function
f(x) = cos(2 exp(x)) uniform grid N = 6 : |f I
X
6
f|

1.05
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 15 / 50
Interpolation on an arbitrary grid
Example: uniform interpolation of a gentle function
f(x) = cos(2 exp(x)) uniform grid N = 8 : |f I
X
8
f|

0.13
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 15 / 50
Interpolation on an arbitrary grid
Example: uniform interpolation of a gentle function
f(x) = cos(2 exp(x)) uniform grid N = 12 : |f I
X
12
f|

0.13
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 15 / 50
Interpolation on an arbitrary grid
Example: uniform interpolation of a gentle function
f(x) = cos(2 exp(x)) uniform grid N = 16 : |f I
X
16
f|

0.025
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 15 / 50
Interpolation on an arbitrary grid
Example: uniform interpolation of a gentle function
f(x) = cos(2 exp(x)) uniform grid N = 24 : |f I
X
24
f|

4.6 10
4
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 15 / 50
Interpolation on an arbitrary grid
Runge phenomenon
f(x) =
1
1 + 16x
2
uniform grid N = 4 : |f I
X
4
f|

0.39
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 16 / 50
Interpolation on an arbitrary grid
Runge phenomenon
f(x) =
1
1 + 16x
2
uniform grid N = 6 : |f I
X
6
f|

0.49
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 16 / 50
Interpolation on an arbitrary grid
Runge phenomenon
f(x) =
1
1 + 16x
2
uniform grid N = 8 : |f I
X
8
f|

0.73
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 16 / 50
Interpolation on an arbitrary grid
Runge phenomenon
f(x) =
1
1 + 16x
2
uniform grid N = 12 : |f I
X
12
f|

1.97
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 16 / 50
Interpolation on an arbitrary grid
Runge phenomenon
f(x) =
1
1 + 16x
2
uniform grid N = 16 : |f I
X
16
f|

5.9
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 16 / 50
Interpolation on an arbitrary grid
Runge phenomenon
f(x) =
1
1 + 16x
2
uniform grid N = 24 : |f I
X
24
f|

62
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 16 / 50
Interpolation on an arbitrary grid
Evaluation of the interpolation error
Let us assume that the function f is suciently smooth to have derivatives at
least up to the order N + 1, with f
(N+1)
continuous, i.e. f C
N+1
([1, 1]).
Theorem (Cauchy)
If f C
N+1
([1, 1]), then for any grid X of N + 1 nodes, and for any
x [1, 1], the interpolation error at x is
f(x) I
X
N
(x) =
f
(N+1)
()
(N + 1)!

X
N+1
(x) (1)
where = (x) [1, 1] and
X
N+1
(x) is the nodal polynomial associated with
the grid X.
Denition: The nodal polynomial associated with the grid X is the unique
polynomial of degree N + 1 and leading coecient 1 whose zeros are the N + 1
nodes of X:

X
N+1
(x) :=
N

i=0
(x x
i
)
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 17 / 50
Interpolation on an arbitrary grid
Example of nodal polynomial
Uniform grid N = 8
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 18 / 50
Interpolation on an arbitrary grid
Minimizing the interpolation error by the choice of grid
In Eq. (1), we have no control on f
(N+1)
, which can be large.
For example, for f(x) = 1/(1 +
2
x
2
), |f
(N+1)
|

= (N + 1)!
N+1
.
Idea: choose the grid X so that
X
N+1
(x) is small, i.e. |
X
N+1
|

is small.
Notice:
X
N+1
(x) has leading coecient 1:
X
N+1
(x) = x
N+1
+
N

i=0
a
i
x
i
.
Theorem (Chebyshev)
Among all the polynomials of degree N + 1 and leading coecient 1, the unique
polynomial which has the smallest uniform norm on [1, 1] is the (N + 1)-th
Chebyshev polynomial divided by 2
N
: T
N+1
(x)/2
N
.
Since |T
N+1
|

= 1, we conclude that if we choose the grid nodes (x


i
)
0iN
to
be the N + 1 zeros of the Chebyshev polynomial T
N+1
, we have
|
X
N+1
|

=
1
2
N
and this is the smallest possible value.
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 19 / 50
Interpolation on an arbitrary grid
Chebyshev-Gauss grid
The grid X = (x
i
)
0iN
such that the x
i
s are the N + 1 zeros of the Chebyshev
polynomial of degree N + 1 is called the Chebyshev-Gauss (CG) grid.
It has much better interpolation properties than the uniform grid considered so far.
In particular, from Eq. (1), for any function f C
N+1
([1, 1]),
_
_
f I
CG
N
f
_
_


1
2
N
(N + 1)!
_
_
_f
(N+1)
_
_
_

If f
(N+1)
is uniformly bounded, the convergence of the interpolant I
CG
N
f towards
f when N is then extremely fast.
Also the Lebesgue constant associated with the Chebyshev-Gauss grid is small:

N
(CG)
2

ln(N + 1) as N
This is much better than uniform grids and close to the optimal value
reminder
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 20 / 50
Interpolation on an arbitrary grid
Example: Chebyshev-Gauss interpolation of f(x) =
1
1+16x
2
f(x) =
1
1 + 16x
2
CG grid N = 4 : |f I
CG
4
f|

0.31
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 21 / 50
Interpolation on an arbitrary grid
Example: Chebyshev-Gauss interpolation of f(x) =
1
1+16x
2
f(x) =
1
1 + 16x
2
CG grid N = 6 : |f I
CG
6
f|

0.18
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 21 / 50
Interpolation on an arbitrary grid
Example: Chebyshev-Gauss interpolation of f(x) =
1
1+16x
2
f(x) =
1
1 + 16x
2
CG grid N = 8 : |f I
CG
8
f|

0.10
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 21 / 50
Interpolation on an arbitrary grid
Example: Chebyshev-Gauss interpolation of f(x) =
1
1+16x
2
f(x) =
1
1 + 16x
2
CG grid N = 12 : |f I
CG
12
f|

3.8 10
2
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 21 / 50
Interpolation on an arbitrary grid
Example: Chebyshev-Gauss interpolation of f(x) =
1
1+16x
2
f(x) =
1
1 + 16x
2
CG grid N = 16 : |f I
CG
16
f|

1.5 10
2
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 21 / 50
Interpolation on an arbitrary grid
Example: Chebyshev-Gauss interpolation of f(x) =
1
1+16x
2
f(x) =
1
1 + 16x
2
CG grid N = 24 : |f I
CG
24
f|

2.0 10
3
no Runge phenomenon !
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 21 / 50
Interpolation on an arbitrary grid
Example: Chebyshev-Gauss interpolation of f(x) =
1
1+16x
2
Variation of the interpolation error as N increases
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 22 / 50
Interpolation on an arbitrary grid
Chebyshev polynomials = orthogonal polynomials
The Chebyshev polynomials, the zeros of which provide the Chebyshev-Gauss
nodes, constitute a family of orthogonal polynomials, and the Chebyshev-Gauss
nodes are associated to Gauss quadratures.
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 23 / 50
Expansions onto orthogonal polynomials
Outline
1
Introduction
2
Interpolation on an arbitrary grid
3
Expansions onto orthogonal polynomials
4
Convergence of the spectral expansions
5
References
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 24 / 50
Expansions onto orthogonal polynomials
Hilbert space L
2
w
(1, 1)
Framework: Let us consider the functional space
L
2
w
(1, 1) =
_
f : (1, 1) R,
_
1
1
f(x)
2
w(x) dx <
_
where w : (1, 1) (0, ) is an integrable function, called the weight function.
L
2
w
(1, 1) is a Hilbert space for the scalar product
(f[g)
w
:=
_
1
1
f(x) g(x) w(x) dx
with the associated norm
|f|
w
:= (f[f)
1/2
w
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 25 / 50
Expansions onto orthogonal polynomials
Orthogonal polynomials
The set P of polynomials on [1, 1] is a subspace of L
2
w
(1, 1).
A family of orthogonal polynomials is a set (p
i
)
iN
such that
p
i
P
deg p
i
= i
i ,= j (p
i
[p
j
)
w
= 0
(p
i
)
iN
is then a basis of the vector space P: P = span p
i
, i N
Theorem
A family of orthogonal polynomial (p
i
)
iN
is a Hilbert basis of L
2
w
(1, 1) :
f L
2
w
(1, 1), f =

i=0

f
i
p
i
with

f
i
:=
(f[p
i
)
w
|p
i
|
2
w
.
The above innite sum means lim
N
_
_
_
_
_
f
N

i=0

f
i
p
i
_
_
_
_
_
w
= 0
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 26 / 50
Expansions onto orthogonal polynomials
Jacobi polynomials
Jacobi polynomials are orthogonal polynomials with respect to the weight
w(x) = (1 x)

(1 +x)

Subcases:
Legendre polynomials P
n
(x): = = 0, i.e. w(x) = 1
Chebyshev polynomials T
n
(x): = =
1
2
, i.e. w(x) =
1

1 x
2
Jacobi polynomials are eigenfunctions of the singular
1
Sturm-Liouville problem

d
dx
_
(1 x
2
) w(x)
du
dx
_
= w(x) u, x (1, 1)
1
singular means that the coecient in front of du/dx vanishes at the extremities of the
interval [1, 1]
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 27 / 50
Expansions onto orthogonal polynomials
Legendre polynomials
w(x) = 1:
_
1
1
P
i
(x)P
j
(x) dx =
2
2i + 1

ij
P
0
(x) = 1
P
1
(x) = x
P
2
(x) =
1
2
(3x
2
1)
P
3
(x) =
1
2
(5x
3
3x)
P
4
(x) =
1
8
(35x
4
30x
2
+ 3)
P
i+1
(x)=
2i+1
i+1
xP
i
(x)
i
i+1
P
i1
(x)
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 28 / 50
Expansions onto orthogonal polynomials
Chebyshev polynomials
w(x) =
1

1 x
2
:
_
1
1
T
i
(x)T
j
(x)
dx

1 x
2
=

2
(1 +
0i
)
ij
T
0
(x) = 1
T
1
(x) = x
T
2
(x) = 2x
2
1
T
3
(x) = 4x
3
3x
T
4
(x) = 8x
4
8x
2
+ 1
cos(n) = T
n
(cos )
T
i+1
(x) = 2xT
i
(x) T
i1
(x)
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 29 / 50
Expansions onto orthogonal polynomials
Legendre and Chebyshev compared
[from Fornberg (1998)]
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 30 / 50
Expansions onto orthogonal polynomials
Orthogonal projection on P
N
Let us consider f L
2
w
(1, 1) and a family (p
i
)
iN
of orthogonal polynomials
with respect to the weight w.
Since (p
i
)
iN
is a Hilbert basis of L
2
w
(1, 1)
reminder
we have f(x) =

i=0

f
i
p
i
(x) with

f
i
:=
(f[p
i
)
w
|p
i
|
2
w
.
The truncated sum

w
N
f(x) :=
N

i=0

f
i
p
i
(x)
is a polynomial of degree N: it is the orthogonal projection of f onto the nite
dimensional subspace P
N
with respect to the scalar product (.[.)
w
.
We have
lim
N
|f
w
N
f|
w
= 0
Hence
w
N
f can be considered as a polynomial approximation of the function f.
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 31 / 50
Expansions onto orthogonal polynomials
Example: Chebyshev projection of f(x) = cos(2 exp(x))
f(x) = cos(2 exp(x)) w(x) = (1 x
2
)
1/2
N = 4 : |f
w
4
f|

0.66
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 32 / 50
Expansions onto orthogonal polynomials
Example: Chebyshev projection of f(x) = cos(2 exp(x))
f(x) = cos(2 exp(x)) w(x) = (1 x
2
)
1/2
N = 6 : |f
w
6
f|

0.30
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 32 / 50
Expansions onto orthogonal polynomials
Example: Chebyshev projection of f(x) = cos(2 exp(x))
f(x) = cos(2 exp(x)) w(x) = (1 x
2
)
1/2
N = 8 : |f
w
8
f|

4.9 10
2
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 32 / 50
Expansions onto orthogonal polynomials
Example: Chebyshev projection of f(x) = cos(2 exp(x))
f(x) = cos(2 exp(x)) w(x) = (1 x
2
)
1/2
N = 12 : |f
w
12
f|

6.1 10
3
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 32 / 50
Expansions onto orthogonal polynomials
Example: Chebyshev projection of f(x) = cos(2 exp(x))
Variation of the projection error |f
w
N
f|

as N increases
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 33 / 50
Expansions onto orthogonal polynomials
Evaluation of the coecients
The coecients

f
i
of the orthogonal projection of f are given by

f
i
:=
(f[p
i
)
w
|p
i
|
2
w
=
1
|p
i
|
2
w
_
1
1
f(x) p
i
(x) w(x) dx (2)
Problem: the above integral cannot be computed exactly; we must seek a
numerical approximation.
Solution: Gaussian quadrature
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 34 / 50
Expansions onto orthogonal polynomials
Gaussian quadrature
Theorem (Gauss, Jacobi)
Let (p
i
)
iN
be a family of orthogonal polynomials with respect to some weight w.
For N > 0, let X = (x
i
)
0iN
be the grid formed by the N + 1 zeros of the
polynomial p
N+1
and
w
i
:=
_
1
1

X
i
(x) w(x) dx
where
X
i
is the i-th Lagrange cardinal polynomial of the grid X
reminder
Then
f P
2N+1
,
_
1
1
f(x) w(x) dx =
N

i=0
w
i
f(x
i
)
If f , P
2N+1
, the above formula provides a good approximation of the integral.
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 35 / 50
Expansions onto orthogonal polynomials
Gauss-Lobatto quadrature
The nodes of the Gauss quadrature, being the zeros of p
N+1
, do not encompass
the boundaries 1 and 1 of the interval [1, 1]. For numerical purpose, it is
desirable to include these points in the boundaries.
This possible at the price of reducing by 2 units the degree of exactness of the
Gauss quadrature
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 36 / 50
Expansions onto orthogonal polynomials
Gauss-Lobatto quadrature
Theorem (Gauss-Lobatto quadrature)
Let (p
i
)
iN
be a family of orthogonal polynomials with respect to some weight w.
For N > 0, let X = (x
i
)
0iN
be the grid formed by the N + 1 zeros of the
polynomial
q
N+1
= p
N+1
+p
N
+p
N1
where the coecients and are such that x
0
= 1 and x
N
= 1.
Let
w
i
:=
_
1
1

X
i
(x) w(x) dx
where
X
i
is the i-th Lagrange cardinal polynomial of the grid X.
Then
f P
2N1
,
_
1
1
f(x) w(x) dx =
N

i=0
w
i
f(x
i
)
Notice: f P
2N1
instead of f P
2N+1
for Gauss quadrature.
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 37 / 50
Expansions onto orthogonal polynomials
Gauss-Lobatto quadrature
Remark: if the (p
i
) are Jacobi polynomials, i.e. if w(x) = (1 x)

(1 +x)

, then
the Gauss-Lobatto nodes which are strictly inside (1, 1), i.e. x
1
, . . . , x
N1
, are
the N 1 zeros of the polynomial p

N
, or equivalently the points where the
polynomial p
N
is extremal.
This of course holds for Legendre and Chebyshev polynomials.
For Chebyshev polynomials, the Gauss-Lobatto nodes and weights have simple
expressions:
x
i
= cos
i
N
, 0 i N
w
0
= w
N
=

2N
, w
i
=

N
, 1 i N 1
Note: in the following, we consider only Gauss-Lobatto quadratures
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 38 / 50
Expansions onto orthogonal polynomials
Discrete scalar product
The Gauss-Lobatto quadrature motivates the introduction of the following scalar
product:
f[g)
N
=
N

i=0
w
i
f(x
i
)g(x
i
)
It is called the discrete scalar product associated with the Gauss-Lobatto nodes
X = (x
i
)
0iN
Setting
i
:= p
i
[p
i
)
N
, the discrete coecients associated with a function f are
given by

f
i
:=
1

i
f[p
i
)
N
, 0 i N
which can be seen as approximate values of the coecients

f
i
provided by the
Gauss-Lobatto quadrature [cf. Eq. (2)]
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 39 / 50
Expansions onto orthogonal polynomials
Discrete coecients and interpolating polynomial
Let I
GL
N
f be the interpolant of f at the Gauss-Lobatto nodes X = (x
i
)
0iN
.
Being a polynomial of degree N, it is expandable as
I
GL
N
f(x) =
N

i=0
a
i
p
i
(x)
Then, since I
GL
N
f(x
j
) = f(x
j
),

f
i
=
1

i
f[p
i
)
N
=
1

i
I
GL
N
f[p
i
)
N
=
1

i
N

j=0
a
j
p
j
[p
i
)
N
Now, if j = i, p
j
[p
i
)
N
=
i
by denition. If j ,= i, p
j
p
i
P
2N1
so that the
Gauss-Lobatto formula holds and gives p
j
[p
i
)
N
= (p
j
[p
i
)
w
= 0. Thus we
conclude that p
j
[p
i
)
N
=
i

ij
so that the above equation yields

f
i
= a
i
, i.e. the
discrete coecients are nothing but the coecients of the expansion of
the interpolant at the Gauss-Lobato nodes
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 40 / 50
Expansions onto orthogonal polynomials
Spectral representation of a function
In a spectral method, the numerical representation of a function f is through its
interpolant at the Gauss-Lobatto nodes:
I
GL
N
f(x) =
N

i=0

f
i
p
i
(x)
The discrete coecients

f
i
are computed as

f
i
=
1

i
N

j=0
w
j
f(x
j
)p
i
(x
j
)
I
GL
N
f(x) is an approximation of the truncated series
w
N
f(x) =
N

i=0

f
i
p
i
(x),
which is the orthogonal projection of f onto the polynomial space P
N
.

w
N
f should be the true spectral representation of f, but in general it is not
computable exactly.
The dierence between I
GL
N
f and
w
N
f is called the aliasing error
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 41 / 50
Expansions onto orthogonal polynomials
Example: aliasing error for f(x) = cos(2 exp(x))
f(x) = cos(2 exp(x)) w(x) = (1 x
2
)
1/2
N = 4
red: f; blue:
w
N
f; green: I
GL
N
f
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 42 / 50
Expansions onto orthogonal polynomials
Example: aliasing error for f(x) = cos(2 exp(x))
f(x) = cos(2 exp(x)) w(x) = (1 x
2
)
1/2
N = 6
red: f; blue:
w
N
f; green: I
GL
N
f
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 42 / 50
Expansions onto orthogonal polynomials
Example: aliasing error for f(x) = cos(2 exp(x))
f(x) = cos(2 exp(x)) w(x) = (1 x
2
)
1/2
N = 8
red: f; blue:
w
N
f; green: I
GL
N
f
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 42 / 50
Expansions onto orthogonal polynomials
Example: aliasing error for f(x) = cos(2 exp(x))
f(x) = cos(2 exp(x)) w(x) = (1 x
2
)
1/2
N = 12
red: f; blue:
w
N
f; green: I
GL
N
f
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 42 / 50
Expansions onto orthogonal polynomials
Aliasing error = contamination by high frequencies
Aliasing of a sin(x) wave by a sin(5x) wave on a 4-points grid
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 43 / 50
Convergence of the spectral expansions
Outline
1
Introduction
2
Interpolation on an arbitrary grid
3
Expansions onto orthogonal polynomials
4
Convergence of the spectral expansions
5
References
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 44 / 50
Convergence of the spectral expansions
Sobolev norm
Let us consider a function f C
m
([1, 1]), with m 0.
The Sobolev norm of f with respect to some weight function w is
|f|
H
m
w
:=
_
m

k=0
_
_
_f
(k)
_
_
_
2
w
_
1/2
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 45 / 50
Convergence of the spectral expansions
Convergence rates for f C
m
([1, 1])
Chebyshev expansions:
truncation error :
|f
w
N
f|
w

C
1
N
m
|f|
H
m
w
and |f
w
N
f|


C
2
(1 + ln N)
N
m
m

k=0
_
_
_f
(k)
_
_
_

interpolation error :
_
_
f I
GL
N
f
_
_
w

C
3
N
m
|f|
H
m
w
and
_
_
f I
GL
N
f
_
_


C
4
N
m1/2
|f|
H
m
w
Legendre expansions:
truncation error :
|f
w
N
f|
w

C
1
N
m
|f|
H
m
w
and |f
w
N
f|


C
2
N
m1/2
V (f
(m)
)
interpolation error :
_
_
f I
GL
N
f
_
_
w

C
3
N
m1/2
|f|
H
m
w
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 46 / 50
Convergence of the spectral expansions
Evanescent error for smooth functions
If f C

([1, 1]), the error of the spectral expansions


w
N
f or I
GL
N
f decays
more rapidly than any power of N.
In practice: exponential decay
example
This error is called evanescent.
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 47 / 50
Convergence of the spectral expansions
For non-smooth functions: Gibbs phenomenon
Extreme case: f discontinuous
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 48 / 50
References
Outline
1
Introduction
2
Interpolation on an arbitrary grid
3
Expansions onto orthogonal polynomials
4
Convergence of the spectral expansions
5
References
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 49 / 50
References
References
C. Bernardi, Y. Maday & F. Rapetti : Discretisations variationnelles de
probl`emes aux limites elliptiques, Springer (Paris, 2004)
J.P. Boyd : Chebyshev and Fourier spectral methods, Dover (New York,
2001)
C. Canuto, M.Y. Hussaini, A. Quarteroni & T.A. Zang : Spectral methods in
uid dynamics, Springer-Verlag (Berlin, 1988)
B. Fornberg : A practical guide to pseudospectral methods, Cambridge Univ.
Press (Cambridge, 1998)
A. Quarteroni, R. Sacco & F. Saleri : Methodes numeriques pour le calcul
scientique, Springer (Paris, 2000)
M.A. Snyder : Chebyshev methods in numerical approximation, Prentice-Hall
(Englewood Clis, N.J., USA, 1966)
http://en.wikipedia.org/wiki/Polynomial interpolation
http://en.wikipedia.org/wiki/Orthogonal polynomials
Eric Gourgoulhon (LUTH, Meudon) Polynomial interpolation Meudon, 14 November 2005 50 / 50

You might also like