Implementing Spectral Methods for Partial Differential Equations: Algorithms for Scientists and Engineers