Spectral Methods in MATLAB

by admin in on June 5, 2019

The aim of this book is to teach you the essentials of spectral collocation methods with the aid of forty short Matlab R programs, or \M- files”.* The programs are available online throw the link down this page, and you will run them and modify them to solve all kinds of ordinary and partial differential equations (ODEs and PDEs) connected with problems in fluid mechanics, quantum mechanics, vibrations, linear and nonlinear waves, complex analysis, and other fields. Concerning prerequisites, it is assumed that the words just written have meaning for you, that you have some knowledge of numerical methods, and that you already know Matlab.

If you like computing and numerical mathematics, you will enjoy working through this book, whether alone or in the classroom|and if you learn a few new tricks of Matlab along the way, that’s ok too! Spectral methods are one of the \big three” technologies for the numerical solution of PDEs, which came into their own roughly in successive decades:

1950s: Finite difference methods
1960s: Finite element methods
1970s: Spectral methods

Naturally, the origins of each technology can be traced further back. For spectral methods, some of the ideas are as old as interpolation and expansion, and more speci cally algorithmic developments arrived with Lanczos as early as 1938 [Lan38,Lan56] and with Clenshaw, Elliott, Fox and others in the 1960s [FoPa68]. Then, in the 1970s, a transformation of the eld took place initiated by work by Orszag and others on problems in uid dynamics and meteorology, and spectral methods became famous. Three landmarks of the early modern spectral methods literature were the short book by Gottlieb and Orszag [GoOr77], the survey by Gottlieb, Hussaini, and Orszag [GHO84], and the monograph by Canuto, Hussaini, Quarteroni and Zang [CHQZ88]. Other books have been contributed since then by Mercier [Mer89], Boyd [Boy00] ( rst edition in 1989), Funaro [Fun92], Bernardi and Maday [BeMa92], Fornberg [For96], and Karniadakis and Sherwin [KaSh99].

If one wants to solve an ODE or PDE to high accuracy on a simple domain, and if the data de fning the problem are smooth, then spectral methods are usually the best tool. They can often achieve ten digits of accuracy where a finite difference or finite element method would get two or three. At lower accuracies, they demand less computer memory than the alternatives.

This short textbook presents some of the fundamental ideas and techniques of spectral methods. It is aimed at anyone who has finished a numerical analysis course and is familiar with the basics of applied ODEs and PDEs. You will see that a remarkable range of problems can be solved to high precision by a few lines of Matlab in a few seconds of computer time. Play with the programs; make them your own! The exercises at the end of each chapter will help get you started.

I would like to highlight three mathematical topics presented here that, while known to experts, are not usually found in textbooks. The first, in Chapter 4, is the connection between the smoothness of a function and the rate of decay of its Fourier transform, which determines the size of the aliasing errors introduced by discretization; these connections explain how the accuracy of spectral methods depends on the smoothness of the functions being approximated. The second, in Chapter 5, is the analogy between roots of polynomials and electric point charges in the plane, which leads to an explanation in terms of potential theory of why grids for non-periodic spectral methods need to be clustered at boundaries. The third, in Chapter 8, is the three-way link between Chebyshev series on [-1; 1], trigonometric series on [-pi; p], and Laurent series on the unit circle, which forms the basis of the technique of computing Chebyshev spectral derivatives via the Fast Fourier Transform. All three of these topics are beautiful mathematical subjects in their own right, well worth learning for any applied mathematician.

If you are determined to move immediately to applications without paying too much attention to the underlying mathematics, you may wish to turn directly to Chapter 6. Most of the applications appear in Chapters 7{14. Inevitably, this book covers only a part of the subject of spectral methods. It emphasizes collocation (\pseudospectral”) methods on periodic and on Chebyshev grids, saying next to nothing about the equally important Galerkin methods and Legendre grids and polynomials. The theoretical analysis is very limited, and simple tools for simple geometries are emphasized rather than the \industrial strength” methods of spectral elements and hp fi nite elements. Some indications of omitted topics and other points of view are given in the
Afterword. A new era in scienti c computing has been ushered in by the development of Matlab. One can now present advanced numerical algorithms and solutions of nontrivial problems in complete detail with great brevity, covering more applied mathematics in a few pages that would have been imaginable a few years ago.

By sacri ficing sometimes (not always!) a certain factor in machine efficiency compared with lower-level languages such as Fortran or C, one obtains with Matlab a remarkable human efficiency an ability to modify
a program and try something new, then something new again, with unprecedented ease. This short book is offered as an encouragement to students, scientists, and engineers to become skilled at this new kind of computing.


  • Chebyshev differentiation matrices 11, 26
  • Chebyshev differentiation by FFT 18, 19, 20
  • Clenshaw{Curtis quadrature 30
  • Complex arithmetic 10, 24, 25, 31, 40
  • Differentiation 1, 2, 4, 5, 7, 11, 12, 18
  • Eigenvalue problems 8, 15, 21, 22, 23, 24, 26, 28, 39, 40
  • Fi nite difference methods 1
  • Fourier differentiation matrices 2, 4, 8
  • Fourier differentiation by FFT 5, 6, 28
  • Fourth-order problems 38, 39, 40
  • Gauss quadrature 30
  • Gibbs phenomenon 3
  • Inhomogeneous boundary conditions 32, 35, 36
  • Interpolation 3, 9, 10, 13, 16
  • Laplace and Poisson problems 13, 14, 15, 16, 23, 28, 29, 32, 33, 36
  • Neumann boundary conditions 33, 37
  • Nonlinear problems 14, 27, 34, 35
  • Periodic domains 21
  • Polar coordinates 28, 29
  • Potential theory 10
  • Pseudospectra 24
  • Runge phenomenon 9, 10
  • Spectral accuracy 2, 4, 7, 8, 11, 12, 30
  • Time-stepping 6, 19, 20, 25, 27, 34, 35, 37
  • Two-dimensional domains 16, 17, 20, 23, 28, 29, 36, 37, 39
  • Two-point boundary-value problems 13, 14, 32, 33, 38
  • Unbounded domains 8, 24
  • Variable coefficients 6, 8, 22, 23, 24
  • Wave equations 6, 19, 20, 27, 37

Download the programs from here http://www.comlab.ox.ac.uk/oucl/work/nick.trefethen.

Start up Matlab.
Run p1, p2, p3, : : :
Happy computing!

0 Sale

Share Now!

Share Your Valuable Opinions