Spectral Methods in MATLAB

The MATLAB programs in this book are terse. I have tried to make each one compact enough to fit on a single page, and most often, on half a page. Of course, there is a message in this style, which is the message of this book: you can do an astonishing amount of serious computing in a few inches of computer code! And there is another message, too. The best discipline for making sure you understand something is to simplify it, simplify it relentlessly.
Without a doubt, readability is sometimes impaired by this obsession with compactness. For example, I have often combined two or three short MATLAB commands on a single program line. You may prefer a looser style, and that is fine. What's best for a printed book is not necessarily what's best for one's personal work.
Another idiosyncrasy of the programming style in this book is that the structure is flat: with the exception of the function cheb, defined in Chapter 6 and used repeatedly thereafter, I make almost no use of functions. (Three further functions, chebfft, clencurt, and gauss, are introduced in Chapters 8 and 12, but each is used just locally.) This style has the virtue of emphasizing how much can be achieved compactly, but as a general rule, MATLAB programmers should make regular use of functions.
Quite a bit might have been written to explain the details of each program, for there are tricks throughout this book that will be unfamiliar...