Numerical study of the relaxation of one-dimensional gravitational systems