Numerical solution of the sine-Gordon equation