Spectral Methods#
These examples are based on the book
L. N. Trefethen, Spectral Methods in MATLAB, SIAM.
I have rewritten these codes in Python.
You can get the codes and run them on your own computer
git clone https://github.com/cpraveen/chebpy
cd chebpy
jupyter-lab
For nbviewer links to these files, see here
http://cpraveen.github.io/teaching/chebpy.html
Matlab versions of the code are available here
Important
In the Matlab codes, the Chebyshev points are ordered from right to left, which can be counter-intuitive to the way we usually think of these problems. In the Python codes, I have ordered them from left to right. However, there may still be some bugs in some codes, so please watch out for them and write to me if you find any mistakes.
Table of contents#
- p01: Convergence of fourth order finite differences
- p02: Convergence of periodic spectral method
- p03: Band-limited interpolation
- p04: Periodic spectral differentiation
- p05: Repetition of p04 via FFT
- p05b: Repetition of p05 via real FFT
- p05c: Repetition of p05 using scipy.fftpack.diff
- p06: Variable coefficient wave equation
- Variable coefficient acoustics equation
- p07: Accuracy of periodic spectral differentiation
- p08: Eigenvalues of harmonic oscillator
- p09: Polynomial interpolation in equispaced and chebyshev points
- p10: Polynomials and corresponding equipotential curves
- p11: Chebyshev differentiation of a smooth function
- p12: Accuracy of Chebyshev spectral differentiation
- p13: Solve linear BVP
- p14: Solve nonlinear BVP
- p15: Solve eigenvalue BVP
- p16: Poisson equation in 2-D
- p17: Helmholtz Equation in 2-D
- p18: Chebyshev differentiation via FFT
- p19: Second order Wave Equation on Chebyshev Grid
- p20: Second order wave equation in 2-D via FFT
- p21: Eigenvalues of Mathieu operator
- p22: 5’th eigenvector of Airy equation
- p23: Eigenvalues of Laplacian in 2-D
- p23a: Eigenvalues of perturbed Laplacian in 2-D
- p24: Pseudospectra of Davies’s complex harmonic oscillator
- p25: Stability regions for ODE formulas
- p26: Eigenvalues of 2nd order Chebyshev diff. matrix
- p27: Solve KdV equation
- Burgers equation using FFT
- Eigenvalues of Chebyshev differentiation matrix
- p30: Spectral integration, ODE style
- p32: Solve linear BVP
- p33: Solve linear BVP, Neumann bc