New method for solving the scattering of waves from a periodic hard surface: Solutions and numerical comparisons with the various formalisms