**SPECTRAL METHODS: Algorithms, Analysis and Applications**

Springer Series in Computational Mathematics, Volume 41, Springer, 2011 by J. Shen, T. Tang and L. Wang

This book can be ordered at the website of Springer. It consists of 9 chapters with about 480 pages. Please click to view Table of Contents.

We provide below a collection of Matlab Routines on some fundamental spectral algorithms presented in this book. By no means, these functions are coded optimally, though we have attempted to do so. We have made significant efforts to test all algorithms, but it is inevitable that some functions might fail to work for some choices of arguments. The users are more than welcome to email us if you find any bugs or have any comments.

**Erratum** for the book

**Instructions for the functions**

- Instruction (to be updated)

**Legendre spectral methods (all files are zipped: Legendre.zip)**

- lepoly.m (evaluate Legendre polynomial and its first-order derivative)
- lepolym.m (evaluate Legendre polynomials and their first-order derivatives up to degree n)
- legs.m (compute Legendre-Gauss quadrature nodes and weights)
- legsndm.m (compute Legendre-Gauss points by the eigen-method)
- legslb.m (compute Legendre-Gauss-Lobatto quadrature nodes and weights)
- legslbndm.m (compute Legendre-Gauss-Lobatto points by the eigen-method)
- legslbwt.m (compute Legendre-Gauss-Lobatto quadrature weights by a very stable weight expression)
- legsrd.m (compute Legendre-Gauss-Radau quadrature nodes and weights)
- legsdiff.m (compute first-order Legendre-Gauss differentiation matrix)
- legslbdiff.m (compute first-order Legendre-Gauss-Lobatto differentiation matrix)
- legsrddiff.m (compute first-order Legendre-Gauss-Radau differentiation matrix)
- ledisctran.m (perform discrete Legendre transform)
- lefreqdiff.m (perform spectral differentiation in the frequency space)

**Chebyshev spectral methods (all files are zipped: Chebyshev.zip)**

- chebdiff.m (compute first-order Chebyshev-Gauss-Lobatto differentiation matrix)
- chebfft.m (perform Chebyshev spectral differentiation via FFT)

**Jacobi spectral methods (all files are zipped: Jacobi.zip)**

- japoly.m (compute Jacobi polynomial and its first-order derivative)
- japolym.m (compute Jacobi polynomials and its first-order derivatives up to degree n)
- japolyja1.m (compute normalized Jacobi polynomial and its first-order derivative)
- gebauerpoly.m (compute Gegenbauer polynomial and its first-order derivative)
- jags.m (compute Jacobi-Gauss quadrature nodes and weights; updated on June 26, 2012)
- jagslb.m (compute Jacobi-Gauss-Lobatto quadrature nodes and weights updated on June 26, 2012)
- jagsrd.m (compute Jacobi-Gauss-Radau quadrature nodes and weights updated on June 26, 2012)
- jagsdiff.m (compute first-order Jacobi-Gauss differentiation matrix)
- jagslbdiff.m (compute first-order Jacobi-Gauss-Lobatto differentiation matrix)
- jagsrddiff.m (compute first-order Jacobi-Gauss-Radau differentiation matrix)
- jadisctran.m (perform discrete Jacobi transform)

**Laguerre spectral methods (all files are zipped: Laguerre.zip uploaded on December 23, 2011)**

- lapoly.m and glapoly.m (evaluate Laguerre/generalized Laguerre polynomials and their first-order derivatives)
- lafun.m and glafun.m (evaluate Laguerre and generalized Laguerre functions and their first-order derivatives)
- lapolym.m and lafunm.m (evaluate Laguerre polynomial/function and first-order derivatives up to degree n)
- lags.m and glags.m (compute (generalized) Laguerre-Gauss quadrature nodes and weights)
- lagsrd.m and glagsrd.m (compute (generalized) Laguerre-Gauss-Radau quadrature nodes and weights)
- lagsdiff.m and lagsrddiff.m (compute first-order Laguerre-Gauss/Gauss-Radau differentiation matrix)
- lafgsdiff.m and lafgsrddiff.m (compute first-order differentiation matrix of Laguerre function approach)
- lafdisctran.m (perform discrete transform of Laguerre function approach)
- laffreqdiff.m (perform spectral differentiation in the frequency space of Laguerre function approach)

**Hermite spectral methods (all files are zipped: Hermite.zip uploaded on December 23, 2011)**

- hepoly.m and hepolyn.m (evaluate Hermite polynomials and normalized Hermite polynomials)
- hefun.m and hefunm.m (evaluate Hermite functions of degree n/of degree up to n)
- hegs.m (compute Hermite-Gauss quadrature nodes and weights)
- hegsdiff.m and hefgsdiff.m (compute first-order differentiation matrix of Hermite polynomial/function)
- hefdisctran.m (perform discrete transform of Hermite function approach)
- heffreqdiff.m (perform spectral differentiation in the frequency space of Hermite function approach)

Many more to come ……

**Useful links**

- Fortran Routines for Spectral Methods by D. Funaro
- A Matlab Differentiation Matrix Suite by J. Weideman and S. Reddy
- PseudoPack by W.S. Don and B. Costa
- Matlab codes for the book “Spectral Methods in Matlab” by L. Trefethen