  We present a novel approach for solving numerically one-dimensional
scattering problems and apply it for computing the emission probability of an
ultracold atom interacting with an arbitrary field mode of a high-$Q$ cavity.
Our method is efficient, stable and succeeds when other numerical integration
methods fail. It also replaces and improves advantageously the WKB
approximation. The cases of sinusoidal, $\mathrm{sech}^2$ and Gaussian field
modes are studied and compared. Divergences with previous works, where WKB was
used, are found.
