CHAPTER TREFETHEN 

Chapter

Fourier sp ectral metho ds

An example

Unb ounded grids

Perio dic grids

Stability

Notes and references

Think globally Act lo cally

BUMPER STICKER

CHAPTER TREFETHEN 

Finite dierence metho ds like nite element metho ds are based on lo cal

representations of functionsusually by loworder p olynomials In contrast

sp ectral metho ds make use of global representations usually by highorder

p olynomials or Fourier series Under fortunate circumstances the result is a

degree of accuracy that lo cal metho ds cannot match For largescale compu

tations esp ecially in several space dimensions this higher accuracy may be

most imp ortant for p ermitting a coarser mesh hence a smaller numb er of data

values to store and op erate up on It also leads to discrete mo dels with little

or no articial dissipation a particularly v aluable feature in high Reynolds

number uid ow calculations where the small amountofphysical dissipation

maybeeasilyoverwhelmed byany dissipation of the numerical kind Sp ectral

metho ds have achieved dramatic successes in this area

Some of the ideas b ehind sp ectral metho ds have been intro duced several

times into One early prop onentwas Cornelius Lanczos in

the s who showed the p ower of Fourier series and Chebyshev p olynomials

in a variety of problems where they had not b een used b efore The emphasis

was on ordinary dierential equations Lanczoss work has been carried on

esp ecially in Great Britain byanumb er of colleagues suchasCWClenshaw

More recently sp ectral metho ds were intro duced again by Kreiss and

Oliger Orszag and others in the s for the purp ose of solving the par

tial dierential equations of uid mechanics Increasingly they are becoming

viewed within some elds as an equal comp etitor to the better established

nite dierence and nite element approaches At present however they are

less well understo o d

Sp ectral metho ds fall into various categories and one distinction often

made is between Galerkin tau and collo cation or pseudosp ectral

sp ectral metho ds In a word the rst twowork with the co ecients of a global

expansion and the latter with its values at p oints The discussion in this b o ok

is entirely conned to collo cation metho ds which are probably used the most

often chiey b ecause they oer the simplest treatment of nonlinear terms

Sp ectral metho ds are aected far more than nite dierence metho ds by

the presence of b oundaries which tend to intro duce stability problems that are

illundersto o d and sometimes highly restrictive as regards time step Indeed

diculties with b oundaries direct and indirect are probably the primary rea

son why sp ectral metho ds have not replaced their loweraccuracy comp etition

CHAPTER TREFETHEN 

in most applications Chapter considers sp ectral metho ds with b oundaries

but the presentchapter assumes that there are none This means that the spa

tial domain is either innitea theoretical device not applicable in practice

or p erio dic In those cases where the physical problem naturally inhabits a

p erio dic domain sp ectral metho ds maybe strikingly successful Conspicuous

examples are the global circulation mo dels used by meteorologists Limited

area meteorological co des since they require b oundaries are often based on

nite dierence formulas but as of this writing almost all of the global circula

tion co des in use which mo del ow in the atmosphere of the entire spherical

earth are sp ectral

AN EXAMPLE TREFETHEN 

An example

Sp ectral metho ds have b een most dramatically successful in problems with

p erio dic geometries In this section we presenttwo examples of this kind that

involve elastic wave propagation Both are taken from B Fornb erg The

pseudosp ectral metho d comparisons with nite dierences for the elastic wave

equation Geophysics Details and additional examples

can be found in that pap er

Elastic waves are waves in an elastic medium such as an iron bar a build

ing or the earth and they come in two varieties P waves pressure or

primary characterized by longitudinal vibrations and S waves shear or

secondary characterized by transverse vibrations The partial dierential

equations of elasticity can be written in various forms such as a system of

two secondorder equations involving displacements For his numerical simu

lations Fornb erg choseaformulation as a system of ve rstorder equations

Figures and show the results of calculations for two physical

problems In the rst a P wave propagates uninterruptedly through a p erio dic

uniform medium In the second an oblique P wave oriented at hits a

horizontal interface at whichthewave sp eeds abruptly cut in half The result

is reected and transmitted P and S waves For this latter example the actual

computation was p erformed on a domain of twice the size shown which is

a hint of the trouble one may be willing to go to with sp ectral metho ds to

avoid coping explicitly with b oundaries

The gures show that sp ectral metho ds may sometimes decisively outp er

form secondorder and fourthorder nite dierence metho ds In particular

sp ectral metho ds are nondispersive and in a wave calculation that prop erty

can be of great imp ortance In these examples the accuracy achieved by the

sp ectral calculation on a grid is not matched by fourthorder nite dif

ferences on a grid or by secondorder nite dierences on a

grid The corresp onding dierences in work and storage are enormous

Fornberg picked his examples carefully sp ectral metho ds do not always

p erform so convincingly Nevertheless sometimes they are extremely impres

sive Although the reasons are not fully understo o d their advantages often

hold not just for problems involving smo oth functions but even in the presence

of discontinuities

The gures in this section will app ear in the published version of this b o ok only with p ermission

UNBOUNDED GRIDS TREFETHEN 

a Schematic initial and end states

b Computational results

Figure Sp ectral and nite dierence simulations of a P wave

propagating through a uniform medium from Fornb erg

UNBOUNDED GRIDS TREFETHEN 

a Schematic initial and end states

b Computational results

Figure Sp ectral and nite dierence simulations of a P wave

incident obliquely up on an interface from Fornb erg

UNBOUNDED GRIDS TREFETHEN 

Unb ounded grids

We shall b egin our study of sp ectral metho ds by lo oking at an innite un

b ounded domain Of course real computations are not carried out on innite

domains but this simplied problem contains many of the essential features

of more practical sp ectral metho ds

Consider again the set of squareintegrable functions v fv g on the

j

h

unb ounded regular grid hZ As mentioned already in x the foundation

of sp ectral metho ds is the sp ectral dierentiation op erator D

h h

ays One is by means of the which can be describ ed in several equivalent w

Fourier transform

SPECTRAL DIFFERENTIATION BY THE SEMIDISCRETE FOURIER TRANS

Compute v

Multiply by i

Inverse transform



Dv F i F v

h

h

Another is in terms of bandlimited interp olation As describ ed in x

one can think of the interp olantasaFourier of bandlimited complex

exp onentials or equivalentlyasan innite series of sinc functions

SPECTRAL DIFFERENTIATION BY SINC INTERPOLATION

P



Interp olate v by a sum of sinc functions q x v S x x

k 

k h k

Dierentiate the interp olant at the grid points x

j



x Dv q

j j

Recall that the sinc function S x dened by

h

sin xh

S x

h xh

UNBOUNDED GRIDS TREFETHEN 

is the unique function in L that interp olates the discrete delta function e

j

j

e

j

j

and that moreover is bandlimited in the sense that its has

compact supp ort contained in h h

For higher order sp ectral dierentiation we multiply F v by higher

h

powers of i or equivalently dierentiate q x more than once

tal reason is Why are these two descriptions equivalent The fundamen

that S x is not just any interp olant to the delta function e but the band

h

limited interp olant For a precise argument note that both pro cesses are

obviously linear and it is not hard to see that b oth are shiftinvariantin the

m m

sense that D K v K Dv for any m The shift op erator K was dened

can be written as a convolution in Since an arbitrary function v

h

P



sum v v e it follows that it is enough to prove that the two

k 

j

k j k

pro cesses give the same result when applied to the particular function e That

equivalence results from the fact that the Fourier transform of e is the constant

function h whose inverse Fourier transform is in turn precisely S x

h

Since sp ectral dierentiation constitutes a linear op eration on it can

h

also b e viewed as multiplication by a biinnite To eplitz matrix

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C

D

B C

h

B C

B C

B C

B C

B C

B C

B C

B C

A

As discussed in x this matrix is the limit of banded To eplitz matrices

corresp onding to nite dierence dierentiation op erators of increasing orders

of accuracy see Table on p In this chapter we drop the subscript

on the symbol D used in x We shall be careless in this text ab out



the distinction between the op erator D and the matrix D that represents it

Another way to express the same thing is to write

Dv a v a

h

UNBOUNDED GRIDS TREFETHEN 

S x

*o h *o

S x

x h

*o o * *o ****oooo ****oooo *o o * *o *o

*o

a b

Figure The sinc function S x and its derivativeS x

x

h h

as in

The co ecients of can be derived from either the Fourier

transform or the sinc function interpretation Let us b egin with the latter

The sinc function has derivative

cos xh sinxh

S x

h x

x x h

with values

if j

S x

h x j

j



if j

jh

at the grid points See Figure This is precisely the zeroth column

of D since that column must by denition contain the values on the grid of

the sp ectral derivative of the delta function The other columns corresp ond

ing to delta functions centered at other points x contain the same entries

j

appropriately shifted

Now let us rederive by means of the Fourier transform If

d

Dv a v then Dv a v and for sp ectral dierentiation we want

a i Therefore by the inverse semidiscrete Fourier transform

Z

h

i j h

i e d a

j

h

For j the integral is giving a while for j integration by parts

Think ab out this Make sure you understand why represents a column rather than a rowof

D

UNBOUNDED GRIDS TREFETHEN 

yields

h

Z

i j h i j h

h

e ie

a i d

j

ij h ij h

h

h

The integral here is again zero since the integrand is a periodic exp onential

and what remains is

i j i j

a e e

j

j h h h

j

i j i j

e e

jh jh

as in

The entries of D are suggestiveoftheTaylor expansion of log x and

this is not a coincidence In the notation of the spatial shift op erator K of

D can be written

  

D K K K K K K

h h

which corresp onds formally to



log K log K D

h h

K

log log K



h h

K

hD

Therefore formally e K and this makes sense byintegrating the deriva

tive over a distance h one gets a shift See the pro of of Theorem

i j h

If v e for some h h then Dv i v Therefore i is an

j

eigenvalue of the op erator D On the other hand if v has the same form with

h h then will be indistinguishable on the grid from some alias

 

wave number h h with h for some integer and the



result will b e Dv i v In other words in Fourier space the spatial dieren

tiation op erator b ecomes multiplication by a p erio dic function thanks to the

discrete grid and in this sense is only an approximation to the exact dier

entiation op erator for continuous functions Figure shows the situation

graphically For bandlimited data however the sp ectral dierentiation op

erator is exact in contrast to nite dierence dierentiation op erators which

are exact only in the limit dashed line in the Figure

i j h

Actually this is not quite true by denition an eigenvector must b elong to and e do es not

Strictly sp eaking i is in the sp ectrum of D but is not an eigenvalue However this technicalityis

unimp ortant for our purp oses and will b e ignored in the present draft of this b o ok

UNBOUNDED GRIDS TREFETHEN 

eigenvalue

i

h h h h

Figure Eigenvalue of D divided by i corresp onding to the

i x

eigenfunction e as a function of The dashed line shows corre

sp onding eigenvalues for the nite dierence op erator D

ih

C C

ih

ih

ih

a D nite dierence b D sp ectral

Figure Eigenvalues of nite dierence and sp ectral rstorder

dierentiation matrices as subsets of the complex plane

Figure compares the sp ectrum of D to that of the secondorder nite

dierence op erator D of x

D is a b ounded linear op erator on withnorm

h

kD k max ji j

h

 h h

see xx Notice that the norm increases to innity as the mesh is rened

UNBOUNDED GRIDS TREFETHEN 

This is inevitable as the dierentiation op erator for continuous functions is

unb ounded

So far wehave describ ed the sp ectral approximation to the rst derivative

op erator x but it is an easy matter to approximate higher derivatives to o

For the second derivative the co ecients turn out to b e

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C

D

B C

h

B C

B C

B C

B C

B C

B C

B C

B C

A

To derive the entries of this matrix one can simply square D this leads to

innite series to be summed One can dierentiate a second time Or

one can compute the inverse Fourier transform ofa asfollows Two

integrations by parts are involved and terms that are zero have b een dropp ed

For j

Z

h

i j h

a e d

j

h

Z

i j h

h

e

d

ij h

h

h

j ij ij i j h

e e e

ij h j h j h

h

For j the integral is simply

a

h h

i j h

The eect of D on a function v e is to multiply it by the square

j

of the factor asso ciated with D as illustrated in Figure Again one has

a periodic multiplier that is exactly correct for h h The dashed

line shows the analogous curve for the standard centered threep oint nite

UNBOUNDED GRIDS TREFETHEN 

eigenvalue

h h h h

Figure Eigenvalue of D corresp onding to the eigenfunction

i x

e as a function of The dashed line shows corresp onding eigen

values for the nite dierence op erator



C C

h h

a nite dierence b D sp ectral



Figure Eigenvalues of nite dierence and sp ectral second

order dierentiation matrices as subsets of the complex plane

dierence op erator of x The sp ectrum of D must be real since D is



symmetric it is the interval h

The developments of this section are summarized and generalized to the

mthorder case in the following theorem

UNBOUNDED GRIDS TREFETHEN 

SPECTRAL DIFFERENTIATION ON AN UNBOUNDED REGULAR GRID

m

Theorem The mthorder sp ectral dierentiation op erator D is a

with norm b ounded linear op erator on

h

m m

kD k

h

m m m

If m is odd D has the imaginary sp ectrum ih ih and can

be represented by an innite skewsymmetric To eplitz matrix with entries

m

a a h for j

j

m m m

If m is even D has the real sp ectrum h and can be

represented by an innite symmetric To eplitz matrix with entries

m

a a h for j

j

The purp ose of all of these sp ectral dierentiation matrices is to solve

partial dierential equations In a sp ectral collo cation computation this is

done in the most straightforward way p ossible one discretizes the continuous

problem as usual and integrates forward in time by a discrete formula usually

by nite dierences Spatial derivatives are approximated by the matrix

D This same prescription holds regardless of whether the partial dierential

equation has variable co ecients or nonlinear terms For example to solve

u axu by sp ectral collo cation one approximates axu at each time step

t x x

by ax Dv For u u one uses D v where v denotes the p ointwise

t x

j

square v v Alternative discretizations may also be used for b etter

i i

stability prop erties see This is in contrast to Galerkin or tau sp ectral

metho ds in which one adjusts the co ecients in the Fourier expansion of v to

satisfy the partial dierential equation globally

Sp ectral approximations with resp ect to time can also sometimes b e used see H TalEzer Sp ectral

metho ds in time for hyp erb olic equations SIAM J Numer Anal pp

UNBOUNDED GRIDS TREFETHEN 

EXERCISES



Co ecients of D Determine the matrix co ecients of the thirdorder sp ectral



dierentiation matrix D Compare your result with the co ecients of Table

R

a Compute the integral S xdx of the sinc function One could do this by

h



complex contour integration but instead be cleverer than that and nd the answer

by considering the Fourier transform The argument is quite easy b e sure to state it

precisely

b By considering the trap ezoid rule for integration Exercise explain why the

answer ab ove had to come out as it did Hint what is the integral of a constant function

PERIODIC GRIDS TREFETHEN 

Perio dic grids

To b e implemented in practice a sp ectral metho d requires a b ounded domain In this

section we consider the case of a p erio dic domainor equivalentlyanunb ounded domain

on which we p ermit only functions with a xed p erio dicity The underlying

of discrete Fourier transforms was describ ed in x The next chapter will deal with more

general b ounded problems

N N

x x x

N N N N

 

 

*********ooooooooo *********ooooooooo

x

h

Figure Space and wavenumb er domains for the discrete Fourier trans

form

To rep eat some of the material of x our fundamental spatial domain will now be

as illustrated in Figure Let N b e a p ositiveeven integer set

h N even

N

and dene x jh for any j The grid p oints in the fundamental domain are

j

x x x h



N N

and the invaluable identity is this

N

h

were dened in x as was the discrete Fourier transform The norm kk and space

N

N

X

i j h

v F v h e v

N j

j N

the inverse discrete Fourier transform

N

X



i j h

v F v e v

j j

N

N

and the discrete convolution

N

X

v w v w h

k j j k

j N

PERIODIC GRIDS TREFETHEN 

Recall that since the spatial domain is p erio dic the set of wave numbers is discrete

namely the set of integers Zand this is whywehavechosen to use itself as a subscript

in and We take NN as our fundamental wave number

domain The prop erties of the discrete Fourier transform were summarized in Theorems

and recall in particular the convolution formula

d

v w v w

As was describ ed in x the discrete Fourier transform can b e computed with great

eciency b y the fast Fourier transform FFT algorithm for which a program was given on

p The discovery of the FFT in was an imp etus to the development of sp ectral

metho ds for partial dierential equations in the s Curiouslyhowever practical imple

mentations of sp ectral metho ds do not always make use of the FFT but instead sometimes

p erform an explicit matrix multiplication The reason is that in largescale computations

whichtypically involvetwo or three space dimensions the grid in each dimension mayhave

as few as or p oints or even fewer in socalled sp ectral element computations and

these numb ers are low enough that the costs of an FFT and of a matrix multiplication may

b e roughly comparable

Now we are ready to investigate D the sp ectral dierentiation op erator

N N N

for N p erio dic functions As usual D can b e describ ed in various ways One is by means

N

of the discrete Fourier transform

SPECTRAL DIFFERENTIATION BY THE DISCRETE FOURIER TRANSFORM

Compute v

Multiply by i except that v is multiplied by

N

Inverse transform



D v F for N i v otherwise

N

N

The sp ecial treatment of the value v is required to maintain symmetry and app ears

N

only in sp ectral dierentiation of odd order

Another is in terms of interp olation by a nite series of complex exp onentials or

equivalently p erio dic sinc functions

PERIODIC SPECTRAL DIFFERENTIATION BY SINC INTERPOLATION

Interp olate v by a sum of p erio dic sinc functions

N

X

v S x x q x

k N k

k N

Dierentiate the interp olant at the grid p oints x

j



D v q x

N j j

PERIODIC GRIDS TREFETHEN 

In the second description wehave made use of the p erio dic sinc function on the N p oint

grid

x

sin

h

S x

N

x

tan

h

which is the unique p erio dic function in L that interp olates the discrete delta function

e on the grid

j

j

e

j

j N N

and which is bandlimited in the sense that its Fourier transform has compact supp ort

contained in h h and furthermore satisesv v Compare

N N

For higher order sp ectral dierentiation on the p erio dic grid wemultiplyv by higher

powers of i or equivalentlydierentiate q x more than once If the order of dierentiation

is o ddv is multiplied by the sp ecial valuetomaintain symmetry

N

As in the last section the sp ectral dierentiation pro cess can b e viewed as multiplica

tion byaskewsymmetric To eplitz matrix D compare N

PERIODIC GRIDS TREFETHEN 

 h  h  h

cot cot cot

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C

 h  h  h  h

cot cot cot cot D

B C

N

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C

A

h  h  h 

cot cot cot

In contrast to the matrix D of D is nite it applies to vectors v v

N

N N

and has dimension N N D is not only a To eplitz matrix but is in fact circulant

N

This means that its entries D wrap around dep ending not merely on i j but on

ij

N

i j mo d N

As in the last section the entries of can b e derived either by the inverse discrete

Fourier transform or by dierentiating a sinc function The latter approach is illustrated in



Figure which shows S and S for N Since N is even symmetry implies that

N N



S x for x as well as for x Dierentiation yields

N

x x

sin cos



h h

x S

N

x

x 

tan

sin

h

and at the grid p oints the values are

if j



S x

N j

jh



j

cot if j

Notice that for jjhj these values are approximately the same as in Thus the

i j entry of D as indicated in is

N

if i j

D

N ij

x x

i j



ij

cot if i j

Any circulant matrix describ es a convolution on a p erio dic grid and is equivalent to a p ointwise

multiplication in Fourier space In the case of D that multiplication happ ens to b e by the function

N

i

PERIODIC GRIDS TREFETHEN 

S x

o N

* *o

S x N

*o *o ****oooo ****oooo *o *o *o *o *o

*o

a b



Figure The p erio dic sinc function S x and its derivative S x

N N

To derive by the Fourier transform one can make use of summation by parts

the discrete analog of integration by parts See Exercise

i x

The eigenvectors of D are the vectors e with Z and the eigenvalues are the

N

quantities i with N N These are precisely the factors i in the denition

of D by the Fourier transform formula The numb er is actually a double eigenvalue

N

of D corresp onding to two distinct eigenvectors the constant function and the sawto oth

N

What ab out the sp ectral dierentiation op erator of second order Again there are

various ways to describ e it This time b ecause is an even function no sp ecial treatment

of N is required to preserve symmetry in the Fourier transform description

Computev

Multiply by

Inverse transform





D v F v

N N

The sinc interp olation description follows the usual pattern

Interp olate v by a sum of p erio dic sinc functions

N

X

v S x x q x

k N k

k N

terp olanttwice at the grid p oints x Dierentiate the in

j





D v q x

j j

N

The matrix lo oks like this compare

Now that D is nite they are truly eigenvalues there are no technicalities to worry ab out as in

N the fo otnote on p

PERIODIC GRIDS TREFETHEN 

h h h    

csc csc csc

h

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C



h  h   h  h 

D

B C

csc csc csc csc

N

h

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C

B C

A

 h  h  h 

csc csc csc

h



Note that b ecause N has b een treated dierently in the two cases D is not the

N

square of D which is why we have put the sup erscript in parentheses In general the

N



mthorder sp ectral dierentiation op erator can b e written as a p ower of D if m is even

N



and as a p ower of D or as D times a p ower of D ifm is o dd See Exercise

N N

N

Figures are the analogs of Figures for a p erio dic grid

We summarize and generalize the developments of this section in the following theorem

PERIODIC GRIDS TREFETHEN 

SPECTRAL DIFFERENTIATION ON A PERIODIC GRID

Theorem Let N be even If m is o dd the mthorder sp ectral dierentiation matrix

m

isaskewsymmetric matrix with entries D

N

a a for j

 j

m m

eigenvalues i i and norm

h h

m

m

kD k

N

h

m

If m is even D is a symmetric matrix with entries

N

a a for j

 j

m m

eigenvalues and norm

h

m

m

kD k

N h

PERIODIC GRIDS TREFETHEN 

eigenvalue i

*o *o *o *o *o *o *o *o *o *o *o *o *o *o *o *o *o. . . *o. . . *o. . . *o. . . . *o. . *o. . *o. . . *o. . *o. . *o. . o. o. o. o. o. o. o.

* * * * * * *

. *o. . *o. . *o. .

h h h h

...... *o . . . *o . . . *o . . . *o *o *o *o *o *o *o *o *o *o *o *o *o *o *o *o

*o *o *o *o

Figure Eigenvalue of D divided by i corresp onding to the eigenfunc

N

i x

tion e as a function of for N The smaller dots show corresp onding

eigenvalues for the nite dierence op erator

 ih *o

o

C C * *o *o o *o *o ih *o *o *o *o *o *o *o *o *o o

o * ih * * *o *o *o *o

*o

ih

a nite dierence b DN sp ectral



Figure Eigenvalues of nite dierence and sp ectral rstorder dierenti

ation matrices on a p erio dic grid as subsets of the complex plane for N

PERIODIC GRIDS TREFETHEN 

eigenvalue

. . . *o. *o *o. *o. *o *o. *o. *o *o.

*o. *o. *o. *o. *o. *o.

h h h h o. o. o. o. o. o. o. o. * . . * * . . * * . . * * . . * *o . . *o *o . . *o *o . . *o *o . . *o ...... *o . . . *o *o . . . *o *o . . . *o *o . . . *o

*o *o *o *o *o *o *o *o

*o *o *o *o *o *o *o *o

*o *o *o *o



i x

Figure Eigenvalue of D corresp onding to the eigenfunction e asa

N

function of for N The smaller dots show corresp onding eigenvalues for

the nite dierence op erator



C C

h h

***ooo*o * o * o * o * o * o * **ooo **********oooooooooo*o *o *o *o *o *o *o

a nite dierence b D sp ectral



N

Figure Eigenvalues of secondorder nite dierence and sp ectral dieren

tiation matrices on a p erio dic grid as subsets of the complex plane for N

PERIODIC GRIDS TREFETHEN 

EXERCISES

Fourier transform derivation of D Not yet written

N



D D For most values of N the matrix D would serve as quite a go o d discrete

N N

N



secondorder dierentiation op erator but as mentioned in the text it is not identical to D

N



a Determine D D andD for N and conrm that the latter two are not equal

N N

N

b Explain the result of a by considering sinc interp olation as in Figure

c Explain it again by considering Fourier transforms as in Figure and

J

for arbitrary J d Give an exact formula for the eigenvalues of D

N

tiation Sp ectral dieren

Making use of a program for computing the FFT in Matlab such a program is builtin in

Fortran one can use the program of p write a program DERIV that computes the

m thorder sp ectral derivativeofanN p oint data v representing a function dened

on or

N length of sequence p ower of input

m order of derivativeinteger input

v sequence to b e dierentiated real sequence of length N input

w m th sp ectral derivativeofv real sequence of length N output

Although a general FFT co de deals with complex make v and w real variables

in your program since most applications concern real variables Allow m to b e anyinteger

m and make sure to treat the distinction prop erly b etween even and o dd values of m

Test DERIV with N and N on the functions



u x expsin x and u xj sin xj



for the values m and hand in two tablesone for each functionof the resulting

errors in the discrete norm Put a star where appropriate and explain your results

Plot the computed derivatives with m

Sp ectral integration Mo dify DERIV to accept negativeaswell as p ositivevalues of

m For m DERIV should return a scalar representing the denite integral of v over one

period together with a function w representing the jmjth indenite integral Explore the

behavior of DERIV with various v and m

Hamming window Write a program FILTER that takes a sequence v and smo oths

v multiplying the transform by the Hamming window it by transforming to

k

w cos v

k k

N

and inverse transforming Apply FILTER to the function j sin xj and hand in a plot of the result

PERIODIC GRIDS TREFETHEN 

Fourier transform derivation of D Not yet written

N



D D For most values of N the matrix D would serve as quite a go o d discrete

N N

N



secondorder dierentiation op erator but as mentioned in the text it is not identical to D

N



aDetermine D D andD for N and conrm that the latter two are not equal

N N

N

bExplain the result of aby considering sinc interp olation as in Figure

cExplain it again by considering Fourier transforms as in Figures and

Sp ectral dierentiation Typ e the program FFT of Figure into your computer

t you understand how to compute b oth a and exp eriment with it until you are conden

discrete Fourier transform and an inverse discrete Fourier transform For example try as

input a sine wave and a sinc function and make sure the output you get is what you exp ect

Then makesureyou can get the input backagainbyinversion

Making use of FFT write a program DERIVN m v w which returns the m thorder sp ec

tral derivativeofthe N p oint data sequence v representing a function dened on or

N length of sequence p ower of input

m order of derivativeinteger input

v sequence to b e dierentiated real sequence of length N input

w m th sp ectral derivativeofv real sequence of length N output

Although FFT deals with complex sequences make v and w real variables in your program

since most applications concern real variables Allow m to b e anyinteger m and make

sure to treat the distinction prop erly b etween even and o dd values of m

Test DERIV with N and N on the functions





u x exp sin x and u xj sin xj



for the values m and hand in two tablesone for each functionof the result

ing errors in the discrete norm Explain your results If p ossible plot the computed

derivatives with m

Sp ectral integration Mo dify DERIV to accept negativeaswell as p ositivevalues of

m For m DERIV should return a scalar representing the denite integral of v over one

period together with a function w representing the jmjth indenite integral Explore the

behavior of DERIV with various v and m

Hamming window Write a program FILTERN v w whichtakes a sequence v and

smo oths it by transforming tov multiplying the transform by the Hamming window

k

w cos v

k k

N

and inverse transforming Apply FILTER to the function j sin xj and hand in the result A

plot would b e nice

STABILITY TREFETHEN 

Stability

Just a few results so far The nished section will b e more substantial

Sp ectral metho ds are commonly applied to timedep endent problems according to the

metho d of lines prescription of x rst the problem is discretized with resp ect to space

and then the resulting system of ordinary dierential equations is solved by a nite dierence

metho d in time As usual we can investigate the eigenvalue stability of this pro cess by

examining under what conditions the eigenvalues of the sp ectral dierentiation op erator are

contained in the stability region of the time discretization formula The separate question of

stability in the sense of the Lax Equivalence Theorem is rather dierent and involves some

subtleties that were not present with nite dierence metho ds these issues are deferred to

the next section

In xx wehaveintro duced two families of sp ectral dierentiation matrices D and

m

m

not exactly its p owers D for an innite grid and D and its higherorder analogs D

N

N

powers for a p erio dic grid The sp ectra of all of these matrices lie in the closed left half of

the complex plane and that is the same region that comes up in the denition of Astability

We conclude that if any equation

m

u

u

t

m

x

is mo deled on a regular grid by sp ectral dierentiation in space and an Astable formula in

time the result is eigenvalue stable regardless of the time step

By Theorem an Astable linear multistep formula must b e implicit For a mo del

problem as simple as the system of equations involved in the implicit formula can b e

solved quickly by the FFT but in more realistic problems this is often not true Since sp ec

tral dierentiation matrices are dense unlike nite dierence dierentiation matrices the

implementation of implicit formulas can b e a formidable problem Therefore it is desirable

to lo ok for explicit alternatives

On a regular grid satisfactory explicit alternatives exist For example supp ose we

solve u u by sp ectral dierentiation in space and the midp ointformula in time

t x

The stability region for the midp oint formula is the complex interval ik ik From

Theorem or Figure we conclude that the timestability restriction is h k

ie

h

k

This is stricter by a factor than the timestability restriction k h for the leap frog

formula which is based on secondorder nite dierence dierentiation The explanation

go es back to the fact that the sawto oth curve in Figure is times taller than the

dashed one

On a p erio dic grid Theorem or Figure lo osens slightly to

h

k

h N

Other explicit timediscretization formulas can also b e used with u u so long as

t x

their stability regions include a neighb orho o d of the imaginary axis near the origin Figure

STABILITY TREFETHEN 

reveals that this is true for example for the AdamsBashforth formulas of orders

The answer to Exercise b can readily b e converted to the exact stability b ound for

the rdorder AdamsBashforth discretization

For u u the eigenvalues of D or D b ecome real and negative so we need a

t xx

N

stability region that contains a segment of the negative real axis Thus the midp oint rule

will b e unstable On the other hand the Euler formula whose stability region was drawn in

Figure and again in Figure leads to the stability restriction h k ie

h

k

On an innite grid this is stricter than the stability restriction for the nite dierence

forward Euler formula considered in Example The cusp ed curve in Figure is

times deep er than the dashed one By Theorem exactly the same restriction is

also valid for a p erio dic grid

h

k

N

As another example the answer to Exercise a can be converted to the exact

stability b ound for the rdorder AdamsBashforth discretization of u u

t xx

In general sp ectral metho ds on a p erio dic grid tend to have stability restrictions that

are stricter by a constant factor than their nite dierence counterparts This is opp osite

to what the CFL condition might suggest the numerical domain of dep endence of a sp ectral

metho d is unb ounded so there is no CFL stability limit The constant factor is usually

not much of a problem in practice for sp ectral metho ds p ermit larger values of h than nite

dierence metho ds in the rst place b ecause of their high order of spatial accuracy In other

words relatively small time steps k are needed anyway to avoid large timediscretization

errors

EXERCISES

A simple sp ectral calculation

Write a program to solve u u on with periodic b oundary conditions by the

t x

pseudosp ectral metho d The program should use the midp oint time integration formula

and spatial dierentiation obtained from the program DERIV of Exercise

a Run the program up to t with k h N and N and initial data

 

v f x v f x k with b oth

cos x for jxj mo d

f x cos x and f x



otherwise

List the four errors you obtain at t Plot the computed solutions v x if

N

p ossible

b Rerun the program with k h and list the same four errors as b efore

c Explain the results of a and b What order of accuracy is observed How mightit

b e improved

Why is the ratio not Because h not h



 

STABILITY TREFETHEN 

Sp ectral calculation with ltering

n

a Mo dify the program ab ove so that instead of computing v at each step with DERIV

alone it uses DERIV followed by the program FILTER of Exercise Take k h

again and print and plot the same results as in the last problem Are the errors smaller

than they were without FILTER

b Run the program again in DERIVFILTER mo de with k h Print and plot the

same results as in c

c What is the exact theoretical stability restriction on k for the DERIVFILTER metho d

You may consider the limit N for simplicity

Note Filtering is an imp ortant idea in sp ectral metho ds but this simple linear problem is

not a go o d example of a problem where ltering is needed

Inviscid Burgers equation

u u on with p erio dic b oundary conditions by the Write a program to solve

t x

pseudosp ectral metho d The program should use forward Euler time integration formula

and spatial dierentiation implemented with the program DERIV



a Run the program up to t with k h N and initial data v

sin x Plot the computed results sup erimp osed on a single plot at times t

b Explain the results of part a as well as you can

c Optional Can you nd a way to improve the calculation