Algebraic and spectral methods for nonlinear wave equations