Finite-dimensional approximation of the S-matrix