$S$-matrix theory Scattering and open quantum systems mathematics