Numerical Analysis of Spectral Methods: Theory and Applications