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
https://github.com/cpraveen/spectral_matlab
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.