Remarks On Chapter 5 in L. Trefethen: Spectral Methods in MATLAB

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

Remarks on Chapter 5 in

L. Trefethen: Spectral Methods in MATLAB


Arne Jensen
Department of Mathematical Sciences
Aalborg University
c 2006
1 Introduction
In this short note we give some comments and additional computations relat-
ing to the results in Chapter 5 of [3]. We assume that the reader is familiar
with the basic results in Complex Analysis. We refer to the lecture notes [1]
for results we need. The error estimate we give here for spectral dierenti-
ation based on the choice of Chebyshev points made in [3], is based on the
paper [2].
2 Lagrange Interpolation
We state the Lagrange interpolation formula and derive an error estimate for
it. We limit outselves to interpolation points in the interval [1, 1]. Let
x
0
, x
1
, . . . , x
N
[1, 1] be N + 1 distinct points.
The Lagrange interpolation polynomials are dened by
L
j
(x) =
N

k=0
k=j
x x
k
x
j
x
k
. (2.1)
They have the property
L
j
(x
k
) =
_
1, if k = j,
0, if k = j.
(2.2)
1
Thus given a function u on [1, 1], let u
j
= u(x
j
). Then the Lagrange
interpolation formula is the following expression:
p
N
(x) =
N

j=0
u
j
L
j
(x). (2.3)
It is clear from (2.2) that p
N
is the interpolating polynomial, viz. p
N
(x
j
) =
u
j
, for all j = 0, 1, . . . , N.
We will now derive an expression for the error term
R
N
(x) = u(x) p
N
(x). (2.4)
For this purpose we introduce the function

N+1
(x) =
N

k=0
(x x
k
). (2.5)
We have the following expression for the Lagrange polynomials:
L
j
(x) =

N+1
(x)
(x x
j
)

N+1
(x
j
)
. (2.6)
Since the interpolating polynomial for a given set of nodes {(x
j
, u
j
)}
j=0,1,...,N
is unique, it suces to verify that the expression on the right hand side
of (2.6) satises (2.2). We rst assume that k = j. Since by denition

N+1
(x
k
) = 0, the right hand side in (2.6) is zero for x = x
k
. For k = j we
have to evaluate using a limit. We have, using
N+1
(x
j
) = 0, i
lim
xx
j

N+1
(x)
(x x
j
)

N+1
(x
j
)
=
1

N+1
(x
j
)
lim
xx
j

N+1
(x)
N+1
(x
j
)
x x
j
=

N+1
(x
j
)

N+1
(x
j
)
= 1.
Thus equation (2.6) has been established.
In order to get an error estimate we now assume that the function u
extends to an analytic function in a domain , which contains the interval
[1, 1]. The approximating polynomial (2.3) is dened for all z C. Thus
the error term (2.4) is dened for all z .
Now let be a simple, positively oriented, closed contour, containing
[1, 1] in its interior and contained in . Then we have the following formula
2
for the error term, valid for z inside the contour .
R
N
(z) = u(z) p
N
(z)
= u(z)
N

j=0

N+1
(z)u(x
j
)
(z x
j
)

N+1
(x
j
)
=

N+1
(z)
2i
_

u()
( z)
N+1
()
d. (2.7)
The last equality in (2.7) is a consequence of the calculus of residues. See
Theorem 7.5 in [1]. More precisely, the integrand in (2.7) has simple poles
at the point z and at the points x
0
, x
1
, . . . , x
N
. The residue at the point z is
u(z)

N+1
(z)
,
and the residue at a point x
j
is
u(x
j
)

N+1
(x
j
)(x
j
z)
.
Thus the residue theorem implies that (2.7) holds (note that the denominator
has the factor (x
j
z), accounting for the sign in front of the sum in (2.7)).
3 Error Estimates in Polynomial Interpola-
tion
The formula (2.7) allows one to obtain error estimates in the polynomial in-
terpolation, if the function u has an analytic continuation to a neighborhood
of the interval [1, 1]. Assume this is the case. Then we get from (2.7),
taking z = x [1, 1],
|R
N
(x)|
_
1
2
max
z
|u(z)|
min
z
|
N+1
(z)|
_

1
| x|
|d|
_
|
N+1
(x)|. (3.1)
The integral above is with respect to arc length. It follows from the above
formula that the approximation error for large N is governed by the behavior
of
N+1
(z) for large N, both on the curve , and on the interval [1, 1]. This
explains why the author in [3] concentrates on the study of this function, in
the book denoted by p(z), see page 43 in [3].
3
Now let us try to explain Theorem 5 in [3]. We introduce the function

N+1
(z) =
1
N + 1
N

k=0
log|z x
k
|. (3.2)
We also as in [3] assume that the distribution of the points {x
k
} for N large is
given by a density function (x). We dene the associated potential function
(z) =
_
1
1
(x) log|z x|dx. (3.3)
Let

[1,1]
= max
x[1,1]
|(x)|.
Assume that there exists a constant
u
>
[1,1]
, such that u is analytic in a
domain slightly larger than the region
{x| (z)
u
}.
Now to explain the estimate in Theorem 5, we rst note that for N large we
have |
N+1
(z)| e
(N+1)(z)
, as explained in [3]. Suppose we can take a curve
, such that (z)
u
for z . Then we can conclude that
min
z
|
N+1
(z)| ce
(N+1)(z)
ce
(N+1)u
,
for large N. Similarly, for x [1, 1], we have
|
N+1
(x)| ce
(N+1)(x)
ce
(N+1)
[1,1]
.
Using these two estimates in (3.1), we get
|R
N
(x)| Ce
(N+1)(u
[1,1]
)
,
which is the estimate in Theorem 5.
We should note that the detailed justication of the result in Theorem 5
uses a number of properties of the functions
N+1
and . Both functions are
harmonic, which means (identifying points in the complex plane z = x + iy
with points in R
2
) that

x
2
(x, y) +

2

y
2
(x, y) = 0
for all z = z + iy not in the interval [1, 1], and analogously for
N+1
. Har-
monic functions have many nice properties. For example, they are innitely
often dierentiable, and they obey the maximum principle, meaning that a
harmonic function cannot have a local maximum or a local minimum in the
interior of a bounded domain. It is these facts that allow us to choose an
integration contour above.
4
4 An Error Estimate for Spectral Dierenti-
ation
We will briey show how the error formula derived above can be used to get
error estimates for spectral dierentiation based on the Chebyshev points.
We start with a general formula, valid for any set of nodes {x
j
}. Take the
formula (2.7) for z = x [1, 1] and dierentiate with respect to x to get
the formula
R

N
(x) = u

(x) p

N
(x)
=
1
2i
_

N+1
(x)
x
+

N+1
(x)
( x)
2
_
u()

N+1
()
d. (4.1)
Now if we evaluate at the nodes and use that
N+1
(x
j
) = 0 for all j =
0, 1, . . . , N, we get the general formula
u

(x
j
) p

N
(x
j
) =

N+1
(x
j
)
2i
_

u()

N+1
()( x
j
)
d. (4.2)
From now on we assume that the points x
j
are the Chebyshev points
chosen in [3], i.e.
x
j
= cos(j/N), j = 0, 1, 2, . . . , N.
We let T
N
(x) denote the Chebyshev polynomial of degree N, see [3]. The
Chebyshev points give the locations of the local extrema of T
N
(x) on the
interval [1, 1]. By using properties of the Chebyshev polynomials one can
show that there is a constant c such that

N+1
(x) = c(T
N+1
(x) T
N1
(x)).
Since in (4.2) only a ratio of two
N+1
enters, we can change the denition
of
N+1
to eliminate this constant. Thus from now on
N+1
denotes this
renormalized function.
Now we need to chose an appropriate curve in order to use (4.2) to
estimate the accuracy of spectral dierentiation. As can be seen from the
computations in [3] an ellipse with foci in 1 and 1 seems to be a good choice.
Thus we take a parameter > 1 and let

denote the ellipse given by


z() =
1
2
(e
i
+
1
e
i
), 0 2. (4.3)
It will follow from the estimates below that |
N+1
(z)| is nearly constant for
large N on the curve

.
5
Now we need one of the properties of the Chebyshev polynomials. We
have
T
N
(z) =
1
2
_
(z +

z
2
1)
N
+ (z

z
2
1)
N
_
. (4.4)
If z

, a simple calculation using (4.3) shows that


z +

z
2
1 = e

, (4.5)
z

z
2
1 =
1
e
i
. (4.6)
Inserted into (4.4) this leads to
T
N
(z) =
1
2
_
(e
i
)
N
+ (
1
e
i
)
N
_
(4.7)
Then we get

N+1
(z) = T
N+1
(z) T
N1
(z)
=
1
2
_
(e
i
)
N+1
+ (
1
e
i
)
N+1
_

1
2
_
(e
i
)
N1
+ (
1
e
i
)
N1
_
=
1
2
_
e
i

1
e
i
__

N
e
iN

N
e
iN
_
.
Now
|
N
e
iN

N
e
iN
| = |(
N

N
) cos(N) + i(
N
+
N
) sin(N)|
=
_

2N
+
2N
2 cos(2N),
where in the last step we used the double angle formula for the cosine. This
computation, also used for N = 1, gives the result
|
N+1
(z)| =
1
2
_

2
+
2
2 cos(2)
_

2N
+
2N
2 cos(2N). (4.8)
We use this result to get upper and lower bounds on |
N+1
(z)|. The minimal
value occurs for = 0, giving the lower bound
1
2
(
1
)(
N

N
).
To get the upper bound we maximize the two terms individually. The maxi-
mal value of each term occurs for values of such that the cosine term equals
1. This leads to an upper bound
1
2
( +
1
)(
N
+
N
).
To use these bounds, let = log , such that = e

. Note that > 0, since


we assume > 1. Then we have for example
1
2
( +
1
) =
1
2
(e

+ e

) = cosh().
6
This identity and similar ones then allow us to summarize the lower and
upper bounds as
2 sinh() sinh(N) |
N+1
(z)| 2 cosh() cosh(N). (4.9)
We need a bound on the derivative

N+1
(x
j
). This bound can be obtained
from standard bounds on the derivative of Chebyshev polynomials. The
result is
max
0jN
|

N+1
(x
j
)| = 4N.
Furthermore, we need an estimate for the arc length for the ellipse

. We
denote this arc length by

. From calculus we have that

=
_
2
0
|z

()|d.
Since
|z

()| = |
i
2
(e
i

1
e
i
)|
1
2
( +
1
),
we have the simple estimate

( +
1
). (4.10)
We also need an estimate for the minimal distance from points on the ellipse

to points in the interval [1, 1]. This distance can be computed exactly.
It is a very easy exercise in calculus (or geometry), so I just state the result.
The minimal distance is
d

=
1
2
( +
1
) 1. (4.11)
Now we can state the estimate for the approximation error. We assume
that u is analytic in a region larger than the closed ellipse bounded by

.
We dene
C

= max
z

|u(z)|.
Then using (4.2) and the above estimates we can estimate the approximation
error as follows.
|u

(x
j
) p

N
(x
j
)|
|

N+1
(x
j
)|C

2 min
z

|
N+1
(z)|
_

1
| x
j
|
|d| (4.12)

4NC

2
1
sinh() sinh(N)

. (4.13)
7
Now we need to look at some of the terms individually. First, we have

=
( +
1
)
1
2
( +
1
) 1
=
2 cosh()
cosh() 1
.
This quantity tends to innity as 0. It is easy to estimate its size
numerically. For example, it is less than 100 for 0.365, corresponding to
> 1.441.
The exponential decay for N comes from the sinh(N) term. A
simple estimate is
1
sinh(t)
=
cosh(t)
sinh(t)
1
cosh(t)
= coth(t)
2
e
t
+ e
t
coth(t)2e
t
,
valid for any t > 0. Thus if we assume as above 0.365, we have
coth(N) 2.9, for all N 1. Thus the decay rate is
e
N
= (
1
)
N
.
Now nally to compare with Theorem 6 in [3], we note that is the sum
of the major and minor semi-axes in the ellipse

, which is called K in
Theorem 6.
References
[1] Arne Jensen, A Short Introduction to Complex Analysis, Lecture Notes,
Department of Mathematical Sciences, Aalborg University, 2005.
[2] S. C. Reddy and J. A. C. Weideman, The accuracy of the Chebyshev
dierencing method for analytic functions, SIAM J. Numer. Anal. 42
(2005), 21762187.
[3] Lloyd N. Trefethen, Spectral Methods in MATLAB, SIAM 2000.
8

You might also like