Soliton perturbation theory is used to obtain analytical solutions describing solitary wave tails or shelves, due to numerical discretization error, for soliton solutions of the nonlinear Schr¨odinger equation. Two important implicit numerical schemes for the nonlinear Schr¨odinger equation, with second-order temporal and spatial discretization errors, are considered. These are the Crank– Nicolson scheme and a scheme, due to Taha , based on the inverse scattering transform. The first-order correction for the solitary wave tail, or shelf, is in integral form and an explicit expression is found for large time. The shelf decays slowly, at a rate of t−12 , which is characteristic of the nonlinear Schr¨odinger equation. Singularity theory, usually used for combustion problems, is applied to the explicit large-time expression for the solitary wave tail. Analytical results are then obtained, such as the parameter regions in which qualitatively different types of solitary wave tails occur, the location of zeros and the location and amplitude of peaks. It is found that three different types of tail occur for the Crank–Nicolson and Taha schemes and that the Taha scheme exhibits some unusual symmetry properties, as the tails for left and right moving solitary waves are different. Optimal choices of the discretization parameters for the numerical schemes are also found, whichminimize the amplitude of the solitary wave tail. The analytical solutions are compared with numerical simulations, and an excellent comparison is found.