SPARSE: Scattering Poles and Amplitudes from Radial Schrödinger Equations Journal: Computer Physics Communications Roberto Bruschini Abstract We introduce an algorithm for the solution of a three-dimensional, two-body Schrödinger equation for scattering states. The equation is first reduced to a system of coupled radial Schrödinger equations. The system of differential equations is approximated as an ordinary linear nonhomogeneous system using the finite difference method. Dirichlet boundary conditions are imposed at the origin and at an arbitrary large radius. The physical K K -matrix for real energies is calculated from the numerical solutions of this system by comparison to the analytical real solutions for large distances. Scattering amplitudes are calculated from the physical K K -matrix. Scattering poles are obtained by extrapolating the K K -matrix to complex energies. PROGRAM SUMMARY Program Title: SPARSE CPC Library link to program files: (to be added by Technical Editor) Developer’s repository link: github.com/Robrusch/SPARSE Licensing provisions: MIT Programming language: Python Nature of problem: Calculation of two-body scattering poles and amplitudes from a radial multichannel Schrödinger equation. Solution method: We approximate the second derivative using the finite difference method. We impose Dirichelet boundary conditions and reduce the differential equation to a nonhomogeneous linear system. We obtain the K K -matrix from integrals of the wavefunctions times a sine or cosine function calculated using the trapezoidal rule. We obtain the scattering amplitudes from the K K -matrix for real energies. We obtain the scattering poles by extrapolating the K K -matrix to complex energies through a rational approximation. 1 Introduction The Schrödinger equation applies to scattering states just as well as to bound states. In fact, the Schrödinger equation provides the foundation of many approximate analytical methods to calculate scattering resonances using nonrelativistic quantum mechanics. But the advantages of calculating scattering poles and amplitudes directly from the Schrödinger equation are often overlooked. The most obvious benefit of calculating scattering states directly from the Schrödinger equation is that it does not require any additional assumption, approximation, or parametrization that may undermine the validity of the results. The scattering amplitudes are completely determined by the Schrödinger equation, and thus they are just as good as the underlying potential. That is most advantageous for those cases where resonant line shapes overlap with one another or with the energy thresholds where scattering channels open up. There is no need of a special treatment for esoteric structures like dips and cusps in the scattering amplitudes, since they are automatically included in the Schrödinger equation. A multichannel scattering Schrd̈inger equation can be used to describe the quantum mechanical scattering of particles in systems where different final states are possible after the collision. One notable example is nucleon-nucleon scattering, where the state of the colliding particles can change at relatively low scattering momentum ( NN\to NN,N\Delta,NN^{\prime},\Delta\Delta,\dots ). In this paper, we introduce a simple yet effective algorithm for calculating scattering poles and amplitudes directly from a multichannel Schrödinger equation. Our method is to solve the Schrödinger equation using a simple finite-difference method (see Chapter 3 of Reference [ 1 ] ). Other common methods include propagation algorithms [ 2 , 3 ] or basis expansions [ 4 , 5 ] (see Reference [ 1 ] for a review). The rest of the paper is structured as follows. In Section 2 , we derive the multichannel radial Schrödinger equation describing an elastic or inelastic 2-body scattering process. In Section 3 , we reduce the radial Schrödinger equation down to a nonhomogeneous linear system. In Section 4 , we calculate the reactance matrix K for the scattering process by comparing the numerical solutions of the Schrödinger equation to the analytic ones for scattering states with real boundary conditions. In Section 5 , we review the calculation of scattering amplitudes from the K -matrix and we calculate scattering resonances by extrapolating to complex energies using a rational approximation. In Section 6 , we showcase the SPARSE algorithm using a relatively simple example. Finally, we summarize these results in Section 7 . 2 Radial Schrödinger equation A two-body elastic or inelastic scattering process can be described by a multichannel Schrödinger equation whose most general form is \biggl[\frac{p_{1}^{2}}{2m_{1}}+\frac{p_{2}^{2}}{2m_{2}}+V(\bm{r}_{1}-\bm{r}_{2})-E\biggr]\psi(\bm{r}_{1},\bm{r}_{2})=0, (1) where \bm{r}_{1} , \bm{r}_{2} are the particles’ coordinates , \bm{p}_{1}=-i\bm{\nabla}_{\bm{r}_{1}} , \bm{p}_{2}=-i\bm{\nabla}_{\bm{r}_{2}} are their conjugate momenta, m_{1} and m_{2} are diagonal mass matrices, V(\bm{r}_{1}-\bm{r}_{2}) is a spin-dependent potential matrix, E is the total energy, and \psi(\bm{r}_{1},\bm{r}_{2}) is a multichannel wavefunction with spin. Note that we use natural units, \hbar=c=1 . We wish to reduce Equation ( 1 ) down to a differential equation in a single vector variable. Let us introduce the relative position \bm{r}=\bm{r}_{1}-\bm{r}_{2} (2) and the center-of-average-mass position \bm{R}=\frac{\overline{m}_{1}\bm{r}_{1}+\overline{m}_{2}\bm{r}_{2}}{\overline{m}_{1}+\overline{m}_{2}}, (3) where \overline{m}_{1} and \overline{m}_{2} are the average of the masses in the diagonal matrices m_{1} and m_{2} . We also introduce the relative momentum \bm{p}=\frac{\overline{m}_{2}\bm{p}_{1}-\overline{m}_{1}\bm{p}_{2}}{\overline{m}_{1}+\overline{m}_{2}} (4) and the total momentum \bm{P}=\bm{p}_{1}+\bm{p}_{2}, (5) which are the momenta conjugate to \bm{r} and \bm{R} , \bm{p}=-i\bm{\nabla}_{\bm{r}} and \bm{P}=-i\bm{\nabla}_{\bm{R}} . Expressing \bm{r}_{1} , \bm{r}_{2} , \bm{p}_{1} , and \bm{p}_{2} inside Equation ( 1 ) in terms of \bm{r} , \bm{R} , \bm{p} , and \bm{P} using Equations ( 2 )-( 5 ), we obtain \biggl[\frac{p^{2}}{2\mu}+\biggl(\frac{\overline{m}_{1}}{m_{1}}-\frac{\overline{m}_{2}}{m_{2}}\biggr)\frac{\bm{p}\cdot\bm{P}}{\overline{m}_{1}+\overline{m}_{2}}+\biggl(\frac{\overline{m}_{1}^{2}}{m_{1}}+\frac{\overline{m}_{2}^{2}}{m_{2}}\biggr)\frac{P^{2}}{2(\overline{m}_{1}+\overline{m}_{2})^{2}}\\ +V(\bm{r})-E\biggr]\psi(\bm{r},\bm{R})=0, (6) where \mu=\frac{m_{1}m_{2}}{m_{1}+m_{2}} (7) is a diagonal reduced-mass matrix. The Schrödinger equation is separable if the matrix multiplying \bm{p}\cdot\bm{P} is zero, which requires \frac{\overline{m}_{1}}{m_{1}}=\frac{\overline{m}_{2}}{m_{2}}. (8) In this case, Equation ( 6 ) becomes \biggl[\frac{p^{2}}{2\mu}+\frac{P^{2}}{2(m_{1}+m_{2})}+V(\bm{r})-E\biggr]\psi(\bm{r},\bm{R})=0. (9) Then, separating \bm{R} and its conjugate momentum \bm{P} from Equation ( 9 ) produces a differential equation in the single vector variable \bm{r} , \biggl[\frac{p^{2}}{2\mu}+V(\bm{r})-E\biggr]\psi(\bm{r})=0, (10) where E now represents the energy in the center-of-momentum frame where \bm{P}=0 . Note that the separability condition in Equation ( 8 ) is satisfied exactly if and only if the two mass matrices are linearly dependent, m_{1}\propto m_{2} . If m_{1} and m_{2} are linearly independent, Equation ( 8 ) cannot be satisfied exactly but Equation ( 6 ) may be approximately separable if \biggl\lVert\frac{\overline{m}_{1}}{m_{1}}-\frac{\overline{m}_{2}}{m_{2}}\biggr\rVert\ll 1, (11) where the double vertical lines denote the matrix norm. Equation ( 10 ) is a differential equation for a multichannel vector wavefunction \psi(\bm{r}) of the relative position vector \bm{r} . We wish to further reduce it to an equation for a multichannel radial wavefunction \psi(r) of the distance r=\lvert\bm{r}\rvert . Let us label the channels of the Schrödinger equation by a . The Schrödinger equation in the channel a reads \sum_{b}\biggl[\delta_{ab}\frac{p^{2}}{2\mu_{a}}+V_{ab}(\bm{r})-\delta_{ab}E\biggr]\psi_{b}(\bm{r})=0, (12) where \psi_{b}(\bm{r}) is a vector wavefunction component and V_{ab}(\bm{r}) are potential matrix elements. Let \alpha_{a} and \beta_{a} be the two particles in the channel a with spins J_{\alpha_{a}} and J_{\beta_{a}} , respectively. We can expand the vector wavefunction \psi_{a}(\bm{r}) as \psi_{a}(\bm{r})=\sum_{s,l}\sum_{\sigma,m}\psi_{a,s,l}^{\sigma,m}(r)Y_{l}^{m}(\theta,\phi)\xi_{s}^{\sigma}, (13) where \psi_{a,l,s}^{\sigma,m}(r) are radial wavefunctions, Y_{l}^{m}(\theta,\phi) are spherical harmonics, and \xi_{s}^{\sigma} are irreducible representations from the decomposition of the direct product of the spin states \chi_{J_{\alpha_{a}}}^{M_{\alpha_{a}}} and \chi_{J_{\beta_{a}}}^{M_{\beta_{a}}} of the two particles \alpha_{a} and \beta_{a} , \xi_{s}^{\sigma}=\sum_{M_{\alpha_{a}},M_{\beta_{a}}}\langle J_{\alpha_{a}}J_{\beta_{a}}M_{\alpha_{a}}M_{\beta_{a}}|J_{\alpha_{a}}J_{\beta_{a}}s\sigma\rangle\chi_{J_{\alpha_{a}}}^{M_{\alpha_{a}}}\chi_{J_{\beta_{a}}}^{M_{\beta_{a}}}, (14) where the term with angle brackets is a Clebsch-Gordan coefficient. The sum over the spin quantum number s ranges from \lvert J_{\alpha_{a}}-J_{\beta_{a}}\rvert to J_{\alpha_{a}}+J_{\beta_{a}} , and for each s the sum over the third component \sigma ranges from -s to +s . The sum over the orbital-angular-momentum quantum number l ranges from 0 to infinity, and for each l the sum over the third component m ranges from -l to +l . The radial wavefunctions in Equation ( 13 ) are labeled by quantum numbers \sigma and m for the third components of the spin and orbital angular momentum. It is more convenient to rewrite Equation ( 13 ) as an expansion in radial wavefunctions labeled by quantum numbers J and M for the total angular momentum, \psi_{a}(\bm{r})=\sum_{J,M}\sum_{s,l}\psi_{a,s,l}^{JM}(r)\sum_{\sigma,m}\langle sl\sigma m|slJM\rangle Y_{l}^{m}(\theta,\phi)\xi_{s}^{\sigma}. (15) The sum over J ranges from either 0 or \frac{1}{2} to infinity, and for each J the sum over the third component M ranges from -J to +J . We derive the Schrödinger equation for the radial wavefunctions through the following steps: 1. Subsitute Equation ( 15 ) into ( 12 ). 2. Multiply on the left by \sum_{\sigma^{\prime},m^{\prime}}\langle s^{\prime}l^{\prime}\sigma^{\prime}m^{\prime}|s^{\prime}l^{\prime}J^{\prime}M^{\prime}\rangle Y_{l^{\prime}}^{m^{\prime}\ast}(\theta,\phi)\xi_{s^{\prime}}^{\sigma^{\prime}{\dagger}} . 3. Integrate over the solid angle \Omega . 4. Impose conservation of angular momentum. Once the above procedure has been applied to each channel a , the Schrödinger equation for the multichannel radial wavefunction \psi^{JM}(r) with total angular momentum J and third component M can be written concisely as \biggl[\frac{1}{2\mu}\biggl(-\frac{\mathrm{d}^{2}\hphantom{r}}{\mathrm{d}r^{2}}-\frac{2}{r}\frac{\mathrm{d}\hphantom{r}}{\mathrm{d}r}+\frac{L(L+1)}{r^{2}}\biggr)+V^{J}(r)-E\biggr]\psi^{JM}(r)=0, (16) where L is a diagonal orbital-angular-momentum matrix, V^{J}(r) is a radial potential matrix, and each channel a of the three-dimensional Schrödinger equation has been expanded into spin-orbital channels (a,l,s) . Note that s and l are constrained by the triangle relations \lvert J_{\alpha_{a}}-J_{\beta_{a}}\rvert\leq s\leq J_{\alpha_{a}}+J_{\beta_{a}} and \lvert J-s\rvert\leq l\leq J+s , so that each channel a expands into a finite number of spin-orbital channels (a,l,s) for each J . To simplify the notation, we relabel the spin-orbital channels of the radial wavefunction by a single integer i . Then the radial potential matrix element for the spin-orbital channels i and j is given by V_{ij}^{J}(r)=\sum_{\sigma_{i},m_{i}}\sum_{\sigma_{j},m_{j}}\langle s_{i}l_{i}\sigma_{i}m_{i}|s_{i}l_{i}JM\rangle\langle s_{j}l_{j}\sigma_{j}m_{j}|s_{j}l_{j}JM\rangle\\ \times\int\mathrm{d}\Omega\,Y_{l_{i}}^{m_{i}\ast}(\theta,\phi)Y_{l_{j}}^{m_{j}}(\theta,\phi)\xi_{s_{i}}^{\sigma_{i}{\dagger}}V_{ab}(\bm{r})\xi_{s_{j}}^{\sigma_{j}}, (17) where (a,s_{i},l_{i})\mapsto i , (b,s_{j},l_{j})\mapsto j , and the spin vectors \xi_{s_{i}}^{\sigma_{i}{\dagger}} and \xi_{s_{j}}^{\sigma_{j}} can be expanded in terms of the spin vectors of the individual particles \chi_{J_{\alpha_{i}}}^{M_{\alpha_{i}}},\chi_{J_{\beta_{i}}}^{M_{\beta_{i}}} and \chi_{J_{\alpha_{j}}}^{M_{\alpha_{j}}},\chi_{J_{\beta_{j}}}^{M_{\beta_{j}}} using Equation ( 14 ). Note that the right side of Equation ( 17 ) does not actually depend on M by virtue of the Wigner-Eckart theorem. There is a somewhat common misunderstanding that the reduction of a three-dimensional Schrödinger equation to a radial form can be performed only for a spherically-symmetric potential that does not depend on the angles \theta and \phi . However, in our derivation of Equations ( 16 ) and ( 17 ) we have made no assumption on the potential V(\bm{r}) other than it conserves angular momentum. In the trivial case where the potential is independent of spin, then conservation of angular momentum does indeed require that it is also spherically symmetric. If the potential does depend on spin, then it can also depend on the angles \theta and \phi but the reduction to Equation ( 16 ) would still apply. A brute-force method to determine if any given potential V(\bm{r}) conserves angular momentum is to evaluate the right side of Equation ( 17 ) with J and M in the first Clebsch-Gordan coefficient substituted by J^{\prime} and M^{\prime} . The potential V(\bm{r}) conserves angular momentum if and only if the result is zero unless J^{\prime}=J and M^{\prime}=M and it is independent of M . Equation ( 16 ) describes a scattering process taking place in a partial wave labeled by quantum numbers J and M . Because of conservation of angular momentum, each partial wave is decoupled from the others. SPARSE solves the scattering problem only for one individual partial wave, leaving the task of summing partial waves to the user. Hence, from now on we will drop all superscripts for the conserved quantum numbers J and M . Finally, we can simplify the derivatives inside Equation ( 16 ) as follows. Let us observe that \biggl(\frac{\mathrm{d}^{2}\hphantom{r}}{\mathrm{d}r^{2}}+\frac{2}{r}\frac{\mathrm{d}\hphantom{r}}{\mathrm{d}r}\biggr)\psi(r)=\frac{1}{r}\frac{\mathrm{d}^{2}\hphantom{r}}{\mathrm{d}r^{2}}u(r), (18) where we have introduced the reduced radial wavefunction u(r)=r\psi(r). (19) Substituting Equation ( 18 ) into ( 16 ) and multiplying both sides by r yields \biggl[-\frac{1}{2\mu}\frac{\mathrm{d}^{2}\hphantom{r}}{\mathrm{d}r^{2}}+\frac{L(L+1)}{2\mu r^{2}}+V(r)-E\biggr]u(r)=0. (20) Equation ( 20 ) is the form of the Schrödinger equation solved by the SPARSE algorithm. It has N spin-orbital channels labeled by an integer i=1,2,\dots,N . The channel i has spin s_{i} and orbital angular momentum l_{i} . The reduced-mass matrix elements are \mu_{ij}=\delta_{ij}\mu_{i} . The orbital-angular-momentum matrix elements are L_{ij}=\delta_{ij}l_{i} . The radial potential matrix elements V_{ij}(r) can be determined by evaluating Equation ( 17 ) for a given potential V(\bm{r}) . 3 Numerical solution To solve Equation ( 20 ) numerically, we truncate and discretize the coordinate space from the real positive numbers to a finite grid of equally-spaced points \{r_{n}\}_{n=0}^{M+1} , where r_{n}=nd (21) with d a small discretization step. Our discretized coordinate space begins at the origin r_{0}=0 , has M points in its interior that we refer to as nodes, and ends at a finite but otherwise arbitrarily large radius r_{M+1}=R . We define the numerical reduced radial wavefunction in channel i as u_{i}(r_{n}) . Similarly, we define the numerical potential matrix element between the channels i and j as V_{ij}(r_{n}) . We then use the Calculus of Finite Differences to approximate the second derivative of the wavefunction as \frac{\mathrm{d}^{2}\hphantom{r}}{\mathrm{d}r^{2}}u(r_{n})=\frac{u(r_{n-1})-2u(r_{n})+u(r_{n+1})}{d^{2}}+\mathcal{O}(d^{4}). (22) For small enough discretization steps d , the \mathcal{O}(d^{4}) corrections can be neglected. To close the system of equations, we fix the values of the reduced radial wavefunction at the boundaries, u_{i}(0) and u_{i}(R) . This is referred to as imposing Dirichlet boundary conditions. We can choose the appropriate boundary conditions using the known analytical behavior of the solutions to Equation ( 20 ) for r\to 0 and r\to\infty . Since a physical solution u_{i}(r) goes to zero as r^{l_{i}+1} for r\to 0 , we impose u_{i}(0)=0. (23) The other boundary condition, u_{i}(R) , is more complicated. We define the threshold matrix as T=\lim_{r\to\infty}V(r) . For scattering problems, \lim_{r\to\infty}V_{ij}(r)=\delta_{ij}T_{i} (24) so the threshold matrix T is diagonal. Each threshold value T_{i} is either a definite number or positive infinity. If T_{i} is a finite number, then \lvert V_{ii}(r)-T_{i}\rvert must approach zero faster than 1/r and V_{ij}^{2}(r)/\lvert V_{jj}(r)-T_{i}\rvert must approach zero faster than 1/r for every j\neq i . The boundary condition u_{i}(R) depends on whether the corresponding threshold T_{i} is larger or smaller than the energy E in the Schrödinger equation. If T_{i}>E , then a physical solution goes to zero for r\to\infty and we impose u_{i}(R)=0 . If otherwise T_{i}\leq E , a physical solution keeps oscillating indefinitely for r\to\infty . It is however a specific, finite number at the maximum distance R in our truncated coordinate space. So, we impose u_{i}(R)=b_{i} , where b_{i} is a real constant. We can conveniently impose the boundary condition for both E\geq T_{i} and E\epsilon\bigr\}, (36) where \epsilon is a fixed small number. Next, we review the analytic asymptotic solution at large r . For r>r_{V} , Equation ( 20 ) reduces to a set of decoupled Schrödinger equations for free particles, \biggl[-\frac{1}{2\mu_{i}}\frac{\mathrm{d}^{2}\hphantom{r}}{\mathrm{d}r^{2}}+\frac{l_{i}(l_{i}+1)}{2\mu r^{2}}+T_{i}-E\biggr]u_{i}(r)=0 (37) for every channel i with a finite threshold T_{i} . Solutions to Equation ( 37 ) for closed channels i=O+1,\dots,N with T_{i}>E must approach zero at large distances and are irrelevant to the scattering states. For the open channels i=1,\dots,O with T_{i}\leq E , Equation ( 37 ) has two linearly independent solutions. Using real boundary conditions and wavefunction normalization by energy (see Reference [ 9 ] for alternative conventions), the two solutions are \sqrt{\frac{2\mu_{i}}{\pi p_{i}}}S_{l_{i}}(p_{i}r)\qquad\text{and}\qquad\sqrt{\frac{2\mu_{i}}{\pi p_{i}}}C_{l_{i}}(p_{i}r), (38) where p_{i} is the scattering momentum in the channel i , p_{i}=\sqrt{2\mu_{i}(E-T_{i})}, (39) and S_{l}(x) and C_{l}(x) are the Riccati-Bessel functions \displaystyle S_{l}(x) \displaystyle=xj_{l}(x), (40) \displaystyle C_{l}(x) \displaystyle=-xy_{l}(x), (41) with j_{l}(x) and y_{l}(x) the spherical Bessel functions of the first and second kind. The asymptotic solution of any Schrödinger equation that coincides with Equation ( 37 ) at large r can be written as a linear combination of the solutions in Equation ( 38 ). In particular, the asymptotic wavefunctions of a complete set of scattering states with energy E can be expressed as u_{ij}(r)\simeq\sqrt{\frac{2\mu_{i}}{\pi p_{i}}}\bigl(S_{l_{i}}(p_{i}r)+K_{ij}C_{l_{i}}(p_{i}r)\bigr), (42) where the relation “ \simeq ” stands for equality at large r , the first index i=1,\dots,O labels open channels, the second index j=1,\dots,O labels linearly independent solutions with the same energy, and K_{ij} are K -matrix elements (see Section 11.1.2 of Reference [ 10 ] ). Next, we compare the numerical solutions u_{ij}(r_{n}) to the analytic asymptotic solution in Equation ( 42 ) to extract the K -matrix elements. The numerical wavefunctions calculated from Equation ( 27 ) generally do not correspond to the asymptotic scattering states in Equation ( 42 ). Instead, the numerical wavefunctions at large r correspond to a more general linear combination of Riccati-Bessel functions, u_{ij}(r)\simeq\sqrt{\frac{2\mu_{i}}{\pi p_{i}}}\bigl(X_{ij}S_{l_{i}}(p_{i}r)+Y_{ij}C_{l_{i}}(p_{i}r)\bigr), (43) where X_{ij} and Y_{ij} are real constants that can be regarded as the elements of two matrices X and Y . Comparing Equations ( 42 ) and ( 43 ), we see that the K -matrix can be calculated from the matrices X and Y using K=YX^{-1}. (44) The matrices X and Y depend on the matrix constant B in Equation ( 35 ), but not the K -matrix. If instead of B we had chosen any other admissible B^{\prime} , then instead of X and Y we would have obtained X^{\prime}=XW and Y^{\prime}=YW with W an invertible O\times O matrix. However, the K -matrix from Equation ( 44 ) would have been the same. Finally, let us calculate explicitly the matrices X and Y from the numerical wavefunctions u_{ij}(r_{n}) . Let us take the asymptotic solution in Equation ( 43 ) and take the further limit x\gg l for the arguments of the Riccati-Bessel functions S_{l}(x) and C_{l}(x) , which yields u_{ij}(r)\simeq\sqrt{\frac{2\mu_{i}}{\pi p_{i}}}\biggl(X_{ij}\sin\Bigl(p_{i}r-l_{i}\frac{\pi}{2}\Bigr)+Y_{ij}\cos\Bigl(p_{i}r-l_{i}\frac{\pi}{2}\Bigr)\biggr). (45) Then consider the integrals \int_{x_{0}}^{x_{0}+\pi}\sin^{2}(x)\,\mathrm{d}x=\int_{x_{0}}^{x_{0}+\pi}\cos^{2}(x)\,\mathrm{d}x=\frac{\pi}{2} (46) and \int_{x_{0}}^{x_{0}+\pi}\sin(x)\cos(x)\,\mathrm{d}x=0, (47) where x_{0} can be any real number. Using Equations ( 46 ) and ( 47 ), we obtain \displaystyle X_{ij} \displaystyle=\sqrt{\frac{2p_{i}^{3}}{\pi\mu_{i}}}\int_{a}^{b}u_{ij}(r)\sin\Bigl(p_{i}r-l_{i}\frac{\pi}{2}\Bigr)\,\mathrm{d}r, (48) \displaystyle Y_{ij} \displaystyle=\sqrt{\frac{2p_{i}^{3}}{\pi\mu_{i}}}\int_{a}^{b}u_{ij}(r)\cos\Bigl(p_{i}r-l_{i}\frac{\pi}{2}\Bigr)\,\mathrm{d}r, (49) where the limits of the integrals are a=R-\pi/p_{i}\qquad\text{and}\qquad b=R, (50) with R the maximum radius in the truncated coordinate space. Evaluating Equatons ( 48 ) and ( 49 ) using the numerical wavefunctions u_{ij}(r_{n}) and the trapezoidal rule provides a way of calculating X_{ij} and Y_{ij} that is both fast and numerically stable. SPARSE uses the trapezoid function from the integration module of SciPy [ 8 ] . 5 Scattering amplitudes and resonances We define the transition matrix T in terms of the scattering matrix S as S=I+2iT. (51) With this definition, a T -matrix element T_{ij} corresponds to the partial-wave scattering amplitude f_{i\leftarrow j} from an initial channel j to a final channel i times the relative momentum in the final channel, T_{ij}=p_{i}f_{i\leftarrow j}. (52) Scattering resonances are associated with poles of the scattering amplitude for energies in the lower half of the complex plane. The reactance matrix K is defined as the Caley transform of the S -matrix, K=i\frac{I-S}{I+S}, (53) which can be inverted to give S=\frac{I+iK}{I-iK} (54) (see Section 14-e of Reference [ 11 ] ). We see from Equations ( 53 ) and ( 54 ) that unitarity ( S^{\dagger}=S^{-1} ) and time-reversal symmetry ( S^{T}=S ) require that the K -matrix is real and symmetric. The K -matrix calculated using Equations ( 44 ), ( 48 ), and ( 49 ) is real by definition. It is only approximately symmetric within numerical errors. Let us call this approximately symmetric matrix \tilde{K} . SPARSE calculates the degree of asymmetry as \max_{ij}\Biggl\{\frac{\bigl\lvert\tilde{K}_{ij}-\tilde{K}_{ji}\bigr\rvert}{\bigl\lvert\tilde{K}_{ij}+\tilde{K}_{ji}\bigr\rvert}\Biggr\} (55) and warns the user if it is larger than a tolerance (1% by default). Then, SPARSE calculates the exactly symmetric K -matrix as K=\frac{\tilde{K}+\tilde{K}^{t}}{2}. (56) The scattering amplitudes f_{i\leftarrow j} can be calculated from the numerical K -matrix elements by inserting Equation ( 54 ) into ( 51 ), which gives T=\frac{K}{I-iK}, (57) an using ( 57 ). The corresponding partial-wave cross-section, \sigma_{i\leftarrow j} , is proportional to the square modulus of the scattering amplitudes, \sigma_{i\leftarrow j}=\frac{4\pi(2J+1)}{(2J_{\alpha_{j}}+1)(2J_{\beta_{j}}+1)}\lvert f_{i\leftarrow j}\rvert^{2}, (58) where J is the total angular momentum and J_{\alpha_{j}} and J_{\beta_{j}} are the spins of the two scattering particles \alpha_{j} and \beta_{j} in the initial channel j . The total unpolarized cross section can be obtained by summing over the spins s_{i} , s_{j} , the orbital angular momenta l_{j} , l_{i} , and the total angular momentum J . From Equation ( 57 ), we see that the scattering amplitude has a pole whenever the denominator on the right side is a singular (i.e., noninvertible) matrix. We can therefore find scattering resonances from the zeros of the function F(E)=\det(I-iK(E)) (59) for values of E in the complex plane, where we have marked the energy dependence explicitly. SPARSE calculates the K -matrix only for real energies, therefore the zeros of F(E) must be found by extrapolating from the real axis to the complex plane. One way to do this is through the use of a rational approximation, where the function F(E) is approximated by the ratio of two polynomials N(E) and D(E) , F(E)\approx\frac{N(E)}{D(E)}, (60) which allows for the extrapolation to complex values of E . SPARSE uses the AAA algorithm for rational polynomial approximation [ 12 ] or, more precisely, its implementation as the function AAA in the interpolation module of SciPy [ 8 ] . The zeros and poles of F(E) are then found as zeros of N(E) and D(E) , respectively. One known complication when dealing with rational approximations is the occurrence of near-zero residue poles or pole pairs with opposite residues that are so close as to nearly cancel each other. Since the AAA rational approximation typically has as many zeros as poles, the appearance of spurious poles of F(E) would result in spurious zeros, which could be mistakenly identified as scattering resonances. To avoid the occurrence of such spurious poles, the user must first identify them and then adjust the parameters of the AAA algorithm to prevent their appearance. Luckily, it is very easy to identify spurious poles in the rational approximation of F(E) . In fact, the poles of F(E) from Equation ( 59 ) must coincide with the poles of the K -matrix, which are located exclusively on the real energy axis. Since SPARSE can calculate the K -matrix for real energies, it is usually possible to roughly establish the number and the positions of the K -matrix poles quite reliably. Therefore, the user has only to adjust the parameters of the AAA algorithm until the poles of the rational approximation of F(E) are compatible with the poles of the K -matrix. Once the poles have been identified as genuine, the zeros can be reliably identified with scattering resonances. 6 Showcase Table 1: Integer label i , orbital angular momentum l , threshold T , and reduced mass \mu for the channels in the SPARSE showcase example. Units are arbitrary. i l T \mu 1 1 0 1000 2 0 100 1000 Next, we examine an application of the SPARSE algorithm to a relatively simple system with two coupled channels. The dimensions are [\text{Energy}] and [\text{Length}]=[\text{Energy}]^{-1} with arbitrary units. The two channels are described in Table 1 . The potential matrix is V(r)=\begin{pmatrix}V_{11}(r)&V_{12}(r)\\ V_{21}(r)&V_{22}(r)\\ \end{pmatrix}. (61) V_{11}(r) is a potential well with a short-distance repulsion, V_{11}(r)=\biggl(\frac{0.05}{r}-100\biggr)\exp\bigl(-(100r)^{2}\bigr) (62) V_{22}(r) is the same potential as V_{11}(r) but shifted by +100 , V_{22}(r)=V_{11}(r)+100 (63) and V_{12}(r)=V_{21}(r) is Gaussian coupling potential, V_{12}(r)=50(100r)^{2}\exp\bigl(-(100r)^{2}\bigr). (64) The coordinate space of r is a grid of points in the interval [0,1] with a discretization step d=10^{-6} . The potential V_{11}(r) has been engineered so that it has a P -wave bound state ( l_{1}=1 ) with energy somewhat below T_{1}=0 . The potential V_{22}(r) has been engineered so that in isolation it would have an S -wave bound state ( l_{2}=0 ) with energy somewhat below T_{2}=100 . The coupling potential V_{12}(r) has been engineered so that the would-be bound state in the second channel appears instead as a narrow scattering resonance in the first channel. These potential matrix elements are plotted in Figure 1 . Figure 1: Potential matrix elements for the SPARSE showcase example. Axes have arbitrary units. We use SPARSE to calculate the K -matrix for a grid of energies in the interval [0,80] with a constant spacing of 0.1. The K -matrix has only one element, since there is only one open channel in the given energy region. We plot the K -matrix as a function of the energy in Figure 2 . We also calculate the square modulus of the T -matrix element and plot it in Figure 3 . Figure 2: K -matrix for the SPARSE showcase example. The horizontal axis has arbitrary units. Figure 3: Square modulus of the T -matrix for the SPARSE showcase example. The horizontal axis has arbitrary units. The scattering amplitude looks complicated because it results from the overlap of two different line shapes. The smooth enhancement is due to the bound state in channel 1, which has an energy of -12.5. The sharp oscillation of the amplitude in between 60 and 80 is due to a resonance. That oscillation in \lvert T\rvert^{2} matches a pole of the K -matrix at a similar energy. Using the AAA rational approximation to extrapolate from real energies to the complex plane, we find that there is a pole of the T -matrix located at Z=67.02-0.02i . It corresponds to a resonance with a mass of M=\Re(Z)=67.02 and a width of \Gamma=-2\Im(Z)=0.04 . The SPARSE repository contains a Python script that calculates the CSV files channels.csv and potential.csv used for this example. It also contains a handy IPython notebook which reproduces the results of this section using the SPARSE Application Programming Interface. 7 Summary SPARSE is a simple Python algorithm for the calculation of scattering amplitudes and resonances using the Schrödinger equation. It solves a system of coupled radial Schrödinger equations that represents a partial wave of a two-body scattering process. It reduces the differential equation to a nonhomogeneous linear system by approximating the second derivative using the finite-difference method and imposing Dirichlet boundary conditions. It calculates the numerical wavefunctions by solving the system, then compares them to the analytical wavefunctions of scattering states to obtain the K -matrix elements. It calculates the scattering amplitudes from the K -matrix elements for real energies, then calculates resonances by extrapolating to complex energies using a rational approximation. The only inputs required by SPARSE are the orbital angular momenta, reduced masses, and thresholds for the channels of the Schrödinger equation plus the numerical coordinate space and potential matrix. These numerical inputs are provided in the form of two CSV files named channels.csv and potential.csv . The user can calculate these numerical inputs using any computational software. The Application Programming Interface is designed so that it can be used with minimal Python literacy. The SPARSE repository also contains a Python script that creates working examples for the input CSV files. It also contains an IPython notebook which showcases the program’s functionality and serves as a useful tutorial. Appendix A Energy limits There are limits to which scattering energies are accessible to SPARSE. Here we explain how these limits are calculated from the numerical inputs. An overall lower energy limit is given by E\geq\min_{i}\{T_{i}\}, (65) since there can obviously be no scattering for energies below the lowest threshold. An upper bound on the energy from channels with a finite threshold T_{i} is given by Shannon’s theorem. A wavefunction is completely determined by its values at a grid of evenly spaced points only if its wavelength is greater than twice the discretization step d , \lambda>2d. (66) Since the momentum is related to the wavelength by p=\frac{2\pi}{\lambda}, (67) the upper bound on the relative momentum in SPARSE is p<\frac{\pi}{d}. (68) Therefore, the overall limit for the energy is E<\frac{\pi^{2}}{2\mu_{i}d^{2}}+T_{i} (69) for all i with a finite threshold T_{i} . Another upper bound on the energy from confining channels with T_{i}=\infty is given by the corresponding diagonal elements of the potential matrix. Since SPARSE assumes that the wavefunction components in confining channels is exactly zero at the maximum distance R , the energy must be much smaller than the corresponding potential at r=R , E\ll V_{ii}(R) (70) for all i with T_{i}=\infty . The scattering energies cannot be too close to a threshold T_{i} , either. There is an upper bound for energies below the threshold, EE is exactly zero at the maximum distance r=R , which is only a good approximation as long as the argument of the exponential satisfies \sqrt{2\mu_{i}(T_{i}-E)}R\gg 1. (72) Therefore we obtain an upper bound for energies below the threshold T_{i} , E-T_{i}\ll-\frac{1}{2\mu_{i}R^{2}}. (73) There is also a lower bound for energies above the threshold, E>T_{i} . SPARSE uses Equations ( 44 ), ( 48 ), and ( 49 ) to calculate the K -matrix from the numerical wavefunctions of scattering states. For Equations ( 48 ) and ( 49 ) to be applicable, however, the lower limit of the integrals, a=R-\pi/p_{i} , must exceed the radius of the potential, r_{\Lambda} , which requires E-T_{i}>\frac{\pi^{2}}{2\mu_{i}(R-r_{\Lambda})^{2}} (74) For channels with l_{i}>0 , a more stringent limit may be obtained from the condition that the argument p_{i}r of the Riccati-Bessel functions is much greater than l_{i} for values in the integration domain of Equations ( 48 ) and ( 49 ). This requires E-T_{i}\gg\frac{(l+\pi)^{2}}{2\mu_{i}R^{2}}. (75)