Professional Documents
Culture Documents
The trapezoidal rule is not a very good way to integrate most functions. The following
table gives the relative error in Z 1
exp(x) dx
0
n relative error
10 0.001431662930269 × 10+0
100 0.000014318991372 × 10+0
1000 1.431901499850846 × 10−7
10000 1.431901523477221 × 10−9
100000 1.431901523713485 × 10−11
ˆ ˙
1
Later on, we will show that the error in the trapezoidal rule is O when it is used to
n2
integrate generate smooth functions.
But the trapezoidal rule is a spectacularly good way to integrate smooth, periodic
functions. The following table gives the relative errors in the integral
Z π
exp(cos(t)) dt
−π
which arise when the trapezoidal rule of various lengths are used to approximate it.
n relative error
4 0.03439691880919236 × 10+00
5 0.00341130316644266 × 10+00
6 0.00028260086127189 × 10+00
7 0.00002009636897756 × 10+00
8 1.25168893154474934 × 10−6
9 3.45945653506638244 × 10−9
12 6.52918602772248367 × 10−12
15 2.97881172300385740 × 10−16
The errors here are on the order of exp(−rn) for some constant r > 0.
What’s going on? Why is the trapezoidal rule so effective for smooth,
periodic functions?
That is, a quadrature rule is exact for a collection of functions if it correctly evlautes their
integrals.
where
2π
xj = −π + j.
n
exp(−ikt), k = −n + 1, −n + 2, . . . , −1, 0, 1, 2, . . . , n − 1.
the result is
|k|
(−1) 2π
if k = m · n for some nonzero integer m
2π if k = 0
0 otherwise.
Corollary
If
∞
X
f (t) = an exp(int).
n=−∞
then Z π
f (t) dt = 2πa0 ,
−π
whereas the approximation of the integral obtained via the m-point periodic trapezoidal
rule is
∞
X
2πa0 + 2π (−1)km pakm + a−km q .
k=1
In particular, the error in the trapezoidal will be small if the Fourier coefficients of f
decay rapidly!
Corollary
If f is a C k function, then error in the approximation of
Z π
f (t) dt
−π
ˆ ˙
1
obtained via the n-point periodic trapezoidal rule is O .
nk
Corollary
If f is a 2π-periodic function which is analytic in a strip containing the real line, then the
error in the approximation of Z π
f (t) dt
−π
obtained via the n-point periodic trapezoidal rule is O pexp(−rn)q with r > 0 a constant.
The first of these is a pessimistic estimate, meaning that it is not the best possible result.
The functions
{exp(int) : n ∈ Z}
are orthonormal with respect to the inner product
Z π
1
pf , g q = f (t)g (t) dt.
2π −π
That is, (
1 if n = m
pexp(int), exp(imt)q =
0 otherwise.
The periodic trapezoidal rule of length (2N + 1) integrates the exponential functions
exp(int) exp(imt)
with −N ≤ n, m ≤ N.
In other words, it accurately discretizes the restriction of inner product we just defined to
the finite-dimensional space
{exp(int) : −N ≤ n ≤ N} .
That is to say: if t0 , t1 , . . . , t2N , w0 , w1 , . . . , w2N are the nodes and weights of the
(2N + 1)-point periodic trapezoidal rule then
Z π 2N
1 1 X
pexp(int), exp(imt)q = exp(int) exp(−imt) dt = exp(intj ) exp(−imtj )wj
2π −π 2π j=0
for all −N ≤ n, m ≤ N.
EN = {exp(int) : −N ≤ n ≤ N} ,
then (3) is exact!! This is what we mean by the trapezoidal rule discretizes the inner
product we defined on the space EN .