1 Introduction

Automorphic forms have played an uncannily effective role in the counting of BPS states in superstring theory wherein they arise as generating functions of the degeneracies of said states. More precisely, the integral degeneracies in these cases arise as coefficients of a Fourier expansion of these automorphic forms. Prominent examples include modular forms, Jacobi forms and Siegel modular forms in the context of BPS state counting in toroidal compactifications of type II/heterotic string theory to four dimensions, namely [1,2,3,4,5]

$$\begin{aligned} \frac{1}{2} \text {BPS in } {{\mathcal {N}}}=4: \qquad \frac{1}{\eta ^{24}(\sigma )}= & {} \sum _{n \ge -1} d(n) \, q^n,\,\,\,\,\,\,\, q = e^{2\pi i \sigma }\nonumber \\ \frac{1}{8} \text {BPS in } {{\mathcal {N}}}=8: \qquad \frac{\vartheta _1^2(\sigma ,v)}{\eta ^6(\sigma )}= & {} \sum _{\ell \in {\mathbb {Z}}/2{\mathbb {Z}} } \vartheta _{1, \ell } ( \sigma , v) \sum _{\begin{array}{c} \Delta \ge -1 \\ \Delta = - \ell ^2 \, \text {mod} \, 4 \end{array}} c_{\ell } (\Delta ) \, q^{\Delta /4} \nonumber \\ \frac{1}{4} \text {BPS in } {{\mathcal {N}}}=4: \frac{1}{\Phi _{10}(\rho , \sigma , v)}= & {} \sum _{\begin{array}{c} m,n,\ell \in {\mathbb {Z}} \\ m, n \ge -1 \end{array}} g(m,n,\ell ) \, p^m q^n y^{\ell },\,\,\,\,\,\, p = e^{2 \pi i \rho } ,\; y = e^{2 \pi i v}. \nonumber \\ \end{aligned}$$
(1.1)

Modular and Jacobi forms, as shown in the first two examples, have automorphic properties under \(\textrm{SL}(2,{\mathbb {Z}})\) and are defined in the \(\sigma \) upper half plane. Both of these forms have a finite number of Fourier coefficients associated with a negative power of q. These coefficients are referred to as a polar coefficients. The modular symmetries of these functions are powerful enough to constrain the Fourier coefficients so that each non-polar coefficient can be exactly expressed in terms of the polar ones in a Rademacher expansion [6]. As an illustrative example, we present the well-known Rademacher expansion for \(1/\eta ^{24}\), which has been used to extract asymptotic degeneracies for 1/2 BPS states in toroidally compactified heterotic string theory [7],

$$\begin{aligned} d(n) = \sum _{\gamma = 1}^{+\infty } \, d(-1) \, \frac{2\pi }{\gamma \,n^{13/2}} \textrm{Kl} (n,-1,\gamma ) I_{13}\left( \frac{4\pi \sqrt{n}}{\gamma } \right) . \end{aligned}$$
(1.2)

We see that the polar coefficient \(d(-1)\) is sufficient to reconstruct the modular form.

In this note we will focus on the third of the above examples, the reciprocal of the Igusa cusp Siegel modular form \(\Phi _{10}\) of weight 10. It is defined on the Siegel upper half plane, with each of its Fourier coefficients defined in terms of three integers corresponding to the three variables defining the Siegel upper half plane. Further, each of its polar terms satisfies \(\Delta < 0\), where \(\Delta = 4 m n - \ell ^2\), and is determined in terms of the coefficients of \(1/\eta ^{24}\) and the continued fraction representation of \(\ell /2m\) [8,9,10]. Using the automorphic properties of \(\Phi _{10}\) with respect to \(\textrm{Sp}(2, {\mathbb {Z}})\),Footnote 1 we will demonstrate that this symmetry group constraints the Fourier coefficients of \(1/\Phi _{10}\) even more powerfully than in the \(\textrm{SL}(2, {\mathbb {Z}})\) case, resulting in a fine-grained Rademacher expansion that not only reconstructs each element of the infinite set of its Fourier coefficients that satisfy \(\Delta >0\) from the finite polar data, whose elements satisfy \(\Delta < 0\), but also encodes the continued fraction structure underlying the polar terms. Thus, the result of this paper can be summarised as follows:

We use the \(\textrm{Sp}(2,{\mathbb {Z}})\) symmetries of \(1/\Phi _{10}\) to construct a fine-grained Rademacher expansion which expresses its Fourier coefficients as a regularized sum over residues of its poles. The construction uses two distinct \(\textrm{SL}(2, {\mathbb {Z}})\) subgroups of \(\textrm{Sp}(2, {\mathbb {Z}})\) which encode multiplier systems, Kloosterman sums and Eichler integrals appearing therein. Additionally, it shows how the polar data are explicitly built from the Fourier coefficients of \(1/\eta ^{24}\) by means of a continued fraction structure.

The Rademacher expansion for \(d(m,n,\ell )\) was derived in [11] by viewing \(d(m,n,\ell )\) as Fourier coefficients of a Mock Jacobi form \(\psi _m^F\) [12, 13] using the mixed Mock Rademacher expansion developed in [14]. However, just as in the case of modular forms, the Rademacher expansion in [11] does not contain information about the explicit values of the polar coefficients of \(\psi _m^F\), as computed in [9, 10].

2 Set Up of the Calculation and Outline of the Paper

In order to define a Rademacher expansion for the reciprocal of the Igusa cusp \(\Phi _{10}\) of weight 10, we adopt the following sequential program elucidated below:

  1. 1.

    Identify polar data in \(1/\Phi _{10}\). In contrast to the modular and Jacobi forms displayed above, the Siegel modular form \(\Phi _{10}\) has a countably infinite set of zeroes defined in the Siegel upper half plane by the loci [15],

    $$\begin{aligned}{} & {} D(n_2, n_1,m_1,m_2, j): \quad n_2 (\rho \sigma - v^2) + j v + n_1 \sigma - m_1 \rho + m_2 = 0 \nonumber \\{} & {} m_1, n_1, m_2, n_2 \in {\mathbb {Z}}, \; j \in 2 {\mathbb {Z}} +1, \;\;\; \;\; m_1 n_1 + m_2 n_2 = \frac{1-j^2}{4}. \end{aligned}$$
    (2.1)

    It has been shown [8,9,10] that for \(\Delta < 0\),

    $$\begin{aligned} d(m, n, \ell ) \equiv (-1)^{\ell +1} \, g(m, n, \ell ) \end{aligned}$$
    (2.2)

    can be constructed from the residues of \(1/\Phi _{10}\) corresponding to the linear poles (\(n_2=0\)), where \(g(m, n, \ell )\) are the Fourier coefficients of \(1/\Phi _{10}\) (cf. (1.1)). Therefore, the polar data in \(1/\Phi _{10}\) are determined by its linear pole residues. Viewing non-polar data as the complementary information to its polar counterpart, one is motivated to identify the non-polar data in \(1/\Phi _{10}\) as the contribution to \(g(m,n,\ell )\) with \(\Delta \ge 0\). Generically, these Fourier coefficients receive contributions from both linear and quadratic poles.

  2. 2.

    Extracting non-polar data from \(d(m,n,\ell )\) with \(\Delta \ge 0\). From (1.1), we can define,

    $$\begin{aligned} d(m, n, \ell ) = (-1)^{\ell +1} \, \int \limits _0^1 \textrm{d} \sigma _1 \int \limits _0^1 \textrm{d} v_1 \int \limits _0^1 \textrm{d} \rho _1 \, \frac{1}{\Phi _{10} (\rho , \sigma , v)} \, e^{-2 \pi i \left( m \rho + n \sigma + \ell v \right) } , \nonumber \\ \end{aligned}$$
    (2.3)

    where \(\rho = \rho _1 + i \rho _2, \sigma = \sigma _1 + i \sigma _2, v = v_1 + i v_2\), and where the imaginary parts of \(\rho \), \(\sigma \) and v are held fixed in the Siegel upper half plane, which is defined by the conditions \(\rho _2> 0, \, \sigma _2 > 0\) and \(\rho _2 \sigma _2 - v_2^2 > 0\). The \(n_2 =0\) poles of \(1/\Phi _{10}\) correspond to co-dimension one surfaces in the Siegel upper half plane. Therefore, in order to identify the non-polar data in terms of the Fourier coefficients, we first need to isolate a chamber in the Siegel upper half plane where we perform a Fourier expansion. Following [8] we will define this region, which is referred to as the \({{\mathcal {R}}}\)-chamber, by

    $$\begin{aligned} \frac{\rho _2}{\sigma _2} \gg 1\;\;,\;\; \frac{v_2}{\sigma _2} = -\frac{ \ell }{2m} \;\;,\;\;\; \frac{\ell }{2m} \in [0, 1). \end{aligned}$$
    (2.4)

    We will write down the Rademacher expansion for the Fourier coefficients with \(\Delta \ge 0\) in the \({{\mathcal {R}}}\)-chamber.

  3. 3.

    Setting up the Rademacher expansion. Viewing (2.3) as a \(\rho \) integral, we define:

    $$\begin{aligned}{} & {} \textrm{d}(m,n,\ell )|_{\Delta \ge 0} \nonumber \\{} & {} \quad =(-1)^{\ell +1} \! \sum _{\begin{array}{c} D \\ n_2 \ne 0 \end{array}}\! \left( \int \limits _{\Gamma _{\sigma }(D) } \textrm{d}\sigma \!\int \limits _{\Gamma _v (D)} \!\textrm{d} v \, \textrm{Res} \!\left( \frac{1}{\Phi _{10} (\rho , \sigma , v)} \, e^{-2 \pi i \left( m \rho + n \sigma + \ell v \right) }\right) \right) \Big \vert _\textrm{reg},\nonumber \\ \end{aligned}$$
    (2.5)

    where ‘reg’ refers to a regularized sum of residues,

    1. 1.

      \(\textrm{Res} f \) is the residue of f at an \(n_2 \ne 0\) pole D in the \(\rho \) plane;

    2. 2.

      \(\Gamma _v(D) \) is the integration contour of v with \(v_1 \in [0,1)\), subject to the condition \(\frac{v_2}{\sigma _2}=-\frac{\ell }{2m}\). Further, the condition that D lies in the Siegel upper half plane constraints the range of \(v_1\);

    3. 3.

      \(\Gamma _{\sigma }(D)\) lies in the projection of D in the \(\sigma \) upper half plane with the restriction that \(\sigma _1 \in [0,1)\).

    This defines our starting point. Our objective is to express the right-hand side of (2.5) in terms of the polar data. This implies that the sum over residues of quadratic poles must be rewritten as one over linear pole contributions.

In Sect. 3 we use the \(\textrm{Sp}(2, {\mathbb {Z}})\) symmetries to map each quadratic pole to the simplest linear pole \(v=0\). We will reparametrize the five numbers defining the quadratic poles by entries of the \(\textrm{Sp}(2, {\mathbb {Z}})\) matrix that performs this map and consequently rewrite the summation on the right-hand side of (2.5) as a sum over these matrix entries. In Sects. 4 and 5 we explicitly evaluate the summands by performing the v and \(\sigma \) integrals, respectively. We isolate multiplier systems, Kloosterman sums and error functions giving rise to Eichler integrals and to the continued fraction structure. These elements serve as building blocks for the Rademacher expansion. We identify a symmetry that is crucial to obtain the Rademacher expansion by enabling massive cancellations between various terms. The resulting expansion is given by (5.126) in the case when \(\Delta > 0\). Additionally, we write down the Rademacher expansion for the case when \(\Delta = m = \ell =0\) in (6.35). In Sect. 7 we conclude with comments on the implications of this expansion for defining exact quantum entropy functions from a gravity path integral. In the appendices we review and discuss various useful relations and calculations.

3 \(\textrm{Sp}(2, {\mathbb {Z}})\) Symmetries, Poles and Residues of \(1/\Phi _{10}\)

In this section, we map each quadratic pole of \(1/\Phi _{10}\) to the simplest linear pole \(v=0\). In order to so, we will use the \(\textrm{Sp}(2, {\mathbb {Z}})\) symmetries of \(\Phi _{10}\) to reparametrize the five numbers defining the quadratic poles by entries of the \(\textrm{Sp}(2, {\mathbb {Z}})\) matrix that performs this map. Subsequently, we rewrite the summation on the right-hand side of (2.5) as a sum over the entries of these mapping matrices.

3.1 \(\textrm{Sp}(2, {\mathbb {Z}})\) Symmetries of \(\Phi _{10}\)

The Igusa cusp form \(\Phi _{10}\) transforms as follows under \(\textrm{Sp}(2, {\mathbb {Z}})\) transformations,

$$\begin{aligned} \Phi _{10}\left( (A\Omega + B)(C\Omega +D)^{-1}\right) = \det (C\Omega +D)^{10} \, \Phi _{10}(\Omega ) , \end{aligned}$$
(3.1)

where

$$\begin{aligned} \Omega = \begin{pmatrix} \rho &{} v \\ v &{} \sigma \end{pmatrix} \;\;,\;\;\; \begin{pmatrix} A &{} B\\ C &{} D \end{pmatrix} \in \textrm{Sp}(2, {\mathbb {Z}}) . \end{aligned}$$
(3.2)

The elements of \(\textrm{Sp}(2, {\mathbb {Z}})\) satisfy

$$\begin{aligned} \begin{pmatrix} A &{} B\\ C &{} D \end{pmatrix}^T\begin{pmatrix} 0 &{} I_2\\ -I_2 &{} 0 \end{pmatrix}\begin{pmatrix} A &{} B\\ C &{} D \end{pmatrix} = \begin{pmatrix} 0 &{} I_2\\ -I_2 &{} 0 \end{pmatrix}, \hspace{5mm} I_2 = \begin{pmatrix} 1 &{} 0\\ 0 &{} 1 \end{pmatrix}. \end{aligned}$$
(3.3)

\(\Phi _{10}\) is invariant under S-duality transformations, which consist of \(\textrm{SL}(2,{\mathbb {Z}})\) transformations

$$\begin{aligned} \begin{pmatrix} a &{} b \\ c &{} d \end{pmatrix} \;\;,\;\;\; ad - b c = 1 \end{aligned}$$
(3.4)

that operate on \(\Omega \) through the \(\textrm{Sp}(2, {\mathbb {Z}})\) transformations

$$\begin{aligned} \begin{pmatrix} a &{} b \\ c &{} d \end{pmatrix}_S = \begin{pmatrix} a &{} -b &{} 0 &{} 0 \\ -c &{} d &{} 0 &{} 0 \\ 0 &{} 0 &{} d &{} c \\ 0 &{} 0 &{} b &{} a \end{pmatrix} . \end{aligned}$$
(3.5)

Thus, under S-duality, we infer the transformation laws

$$\begin{aligned} \rho '&= a^2 \rho + b^2 \sigma - 2 ab v \nonumber \\ \sigma '&= c^2 \rho + d^2 \sigma - 2 c d v \nonumber \\ v'&= - a c \rho - bd \sigma + (a d + b c ) v \;. \end{aligned}$$
(3.6)

They leave \(\Phi _{10}\) invariant,

$$\begin{aligned} \Phi _{10}(\rho ',\sigma ',v') = \Phi _{10}(\rho ,\sigma ,v). \end{aligned}$$
(3.7)

Next, we consider a different set of \(\textrm{Sp}(2,{\mathbb {Z}})\) transformations, which we denote by \(\textrm{SL}(2, {\mathbb {Z}})_{\sigma }\). We denote its group elements by

$$\begin{aligned} \begin{pmatrix} \alpha &{} \beta \\ \gamma &{} \delta \end{pmatrix} \;\;,\;\;\; \alpha \delta - \beta \gamma = 1. \end{aligned}$$
(3.8)

They operate on \(\Omega \) through the \(\textrm{Sp}(2, {\mathbb {Z}})\) transformations

$$\begin{aligned} \begin{pmatrix} \alpha &{} \beta \\ \gamma &{} \delta \end{pmatrix}_\sigma = \begin{pmatrix} 1 &{} 0 &{} 0 &{} 0 \\ 0 &{} \alpha &{} 0 &{} \beta \\ 0 &{} 0 &{} 1 &{} 0 \\ 0 &{} \gamma &{} 0 &{} \delta \end{pmatrix} , \end{aligned}$$
(3.9)

which results in the transformation laws

$$\begin{aligned} \rho '= & {} \rho - \frac{\gamma v^2}{\gamma \sigma + \delta } \nonumber \\ \sigma '= & {} \frac{\alpha \sigma + \beta }{\gamma \sigma + \delta } \nonumber \\ v'= & {} \frac{v}{\gamma \sigma + \delta } . \end{aligned}$$
(3.10)

Under this set of transformations, \(\Phi _{10}\) transforms as

$$\begin{aligned} \Phi _{10} (\rho ', \sigma ', v') = \left( \det \left( C \Omega + D \right) \right) ^{10} \, \Phi _{10} (\rho , \sigma , v) = \left( \gamma \sigma + \delta \right) ^{10} \, \Phi _{10} (\rho , \sigma , v).\nonumber \\ \end{aligned}$$
(3.11)

Furthermore, \(\Phi _{10}\) is also invariant under the integer shifts

$$\begin{aligned} \Phi _{10}(\rho +\lambda , \sigma +\mu , v+\nu ) = \Phi _{10}(\rho ,\sigma ,v), \hspace{5mm} \lambda ,\mu ,\nu \in {\mathbb {Z}} , \end{aligned}$$
(3.12)

which implies that it possesses a Fourier expansion.

Performing first an \(\textrm{SL}(2,{\mathbb {Z}})_\sigma \) transformation, then an S-duality transformation and finally an integer shift of v by \(-\Sigma \), \(\Phi _{10}\) changes as

$$\begin{aligned} {\Phi _{10}(\rho ',\sigma ',v')} = (\gamma \sigma + \delta )^{10}{\Phi _{10}(\rho ,\sigma ,v)} , \end{aligned}$$
(3.13)

where

$$\begin{aligned} \rho '= & {} a^2\left( \rho -\frac{\gamma v^2}{\gamma \sigma +\delta } \right) +b^2\left( \frac{\alpha \sigma +\beta }{\gamma \sigma +\delta }\right) -2ab \frac{v}{\gamma \sigma +\delta } \nonumber \\ \sigma '= & {} c^2\left( \rho -\frac{\gamma v^2}{\gamma \sigma +\delta } \right) +d^2\left( \frac{\alpha \sigma +\beta }{\gamma \sigma +\delta }\right) -2cd\frac{v}{\gamma \sigma +\delta } \nonumber \\ v'= & {} -ac\left( \rho -\frac{\gamma v^2}{\gamma \sigma +\delta } \right) -bd\left( \frac{\alpha \sigma +\beta }{\gamma \sigma +\delta }\right) +(ad+bc)\frac{v}{\gamma \sigma +\delta }-\Sigma . \nonumber \\ \end{aligned}$$
(3.14)

The reciprocal of \(\Phi _{10}\) transforms accordingly.

3.2 Reparametrization of the Poles of \(1/\Phi _{10}\)

The Siegel modular form \(\Phi _{10}^{-1}(\rho ,\sigma ,v)\) has the following behaviour near \(v=0\),

$$\begin{aligned} \frac{1}{\Phi _{10}(\rho ,\sigma ,v)} = -\frac{1}{4\pi ^2}\frac{1}{v^2} \frac{1}{\eta ^{24} (\rho )}\frac{1}{ \eta ^{24}(\sigma )}+{\mathcal {O}}(v^0). \end{aligned}$$
(3.15)

Therefore, it has poles at all the \(\textrm{Sp}(2,{\mathbb {Z}})\) images of the divisor \(v=0\) in the Siegel upper half plane. The location of the poles is determined by

$$\begin{aligned} n_2 ( \rho \sigma - v^2) + j v + n_1 \sigma - m_1 \rho + m_2 =0 . \end{aligned}$$
(3.16)

The poles are labelled by five integers, \((m_1,m_2,j,n_1,n_2)\) that satisfy the constraint

$$\begin{aligned} m_1 n_1 + m_2 n_2 = \frac{1}{4} \left( 1 - j^2 \right) . \end{aligned}$$
(3.17)

Since (3.16) and (3.17) are invariant under \((m_1,m_2,j,n_1,n_2) \mapsto (-m_1,- m_2,- j,- n_1,- n_2)\), we may restrict to \(n_2 \ge 0\) [16].

A specific parametrization of these poles was given in [17]. We will use an equivalent parametrization, as follows.

Proposition 3.1

Any pole (3.16) with \(n_2 \ge 1\) can be reparametrized in terms of nine integers as

$$\begin{aligned} n_2= & {} - a c \gamma , \nonumber \\ j= & {} a d + b c , \nonumber \\ n_1= & {} - b d \alpha - \gamma \Sigma \; \nonumber \\ m_1= & {} a c \delta \; \nonumber \\ m_2= & {} - b d \beta - \delta \Sigma , \end{aligned}$$
(3.18)

where eight of the integers can be arranged into two \(\textrm{SL}(2,{\mathbb {Z}})\) matrices,

$$\begin{aligned} \Gamma = \begin{pmatrix} \alpha &{} \beta \\ \gamma &{} \delta \end{pmatrix}\in \textrm{SL}(2,{\mathbb {Z}}), \hspace{5mm} G= \begin{pmatrix} a &{} b \\ c &{} d \end{pmatrix} \in \textrm{SL}(2,{\mathbb {Z}}), \end{aligned}$$
(3.19)

with entries that satisfy \(a>0,\, c<0, \, \gamma >0,\, \alpha \in {\mathbb {Z}}/\gamma {\mathbb {Z}}\), while \(\Sigma \in {\mathbb {Z}}\).

Moreover, any pole (3.16) with \(n_2 \ge 1\) can be mapped to the pole \(v=0\) by the following sequence of \(\textrm{Sp}(2,{\mathbb {Z}})\) transformations, namely first an \(\textrm{SL}(2,{\mathbb {Z}})_\sigma \) transformation, then an S-duality transformation and finally an integer shift of v.

Proof

By performing \(\textrm{SL}(2,{\mathbb {Z}})_{\sigma }\) transformation (3.9), generic pole (3.16) with \(n_2 \ge 1\) gets mapped to

$$\begin{aligned} n_2 ( \rho ' \sigma ' - v'^2) + j v' + n_1 \sigma ' - m_1 \rho ' + m_2 =0 , \end{aligned}$$
(3.20)

which equals

$$\begin{aligned} (\rho \sigma - v^2)(n_2\alpha -m_1\gamma ) + j v + \sigma (n_1\alpha +m_2\gamma ) -\rho (m_1\delta -n_2\beta ) + n_1\beta +m_2\delta =0 \nonumber \\ \end{aligned}$$
(3.21)

in the original variables. Therefore, this transformation maps

$$\begin{aligned} n_2 \mapsto n_2\alpha -m_1\gamma , \;\; n_1 \mapsto n_1\alpha +m_2\gamma , \;\; m_1 \mapsto m_1\delta -n_2\beta , \;\; m_2 \mapsto n_1\beta +m_2\delta ,\nonumber \\ \end{aligned}$$
(3.22)

leaving j invariant. Let

$$\begin{aligned} r = \gcd (n_2,-m_1) >0 , \end{aligned}$$
(3.23)

so that

$$\begin{aligned} n_2 = r\gamma , \hspace{7mm}-m_1 = r\delta . \end{aligned}$$
(3.24)

Note that \(\gamma > 0\). Now define \(\alpha \in {\mathbb {Z}}/\gamma {\mathbb {Z}}\) and \(\beta \) to satisfy \(\alpha \delta -\beta \gamma =1\). Then, inspection of (3.21) shows that the \(\textrm{SL}(2,{\mathbb {Z}})_{\sigma }\) transformation

$$\begin{aligned} \begin{pmatrix} \delta &{} -\beta \\ -\gamma &{} \alpha \end{pmatrix} \end{aligned}$$
(3.25)

takes generic pole (3.16) to the linear pole

$$\begin{aligned} \rho r +jv+\sigma (n_1\delta -m_2\gamma )-n_1\beta + m_2 \alpha = 0. \end{aligned}$$
(3.26)

This is equivalent to starting from (3.16) and mapping

$$\begin{aligned} \begin{pmatrix} n_2 &{} n_1 \\ - m_1 &{} m_2 \end{pmatrix} \mapsto \begin{pmatrix} n'_2 &{} n'_1 \\ - m'_1 &{} m'_2 \end{pmatrix} = \begin{pmatrix} 0 &{} n_1\delta -m_2\gamma \\ r &{} \; - n_1 \beta + m_2 \alpha \end{pmatrix} = \begin{pmatrix} \delta &{} -\gamma \\ -\beta &{} \alpha \end{pmatrix} \begin{pmatrix} r \gamma &{} n_1 \\ r \delta &{} m_2 \end{pmatrix} .\nonumber \\ \end{aligned}$$
(3.27)

Since the determinant of the matrix on the left-hand side equals \((1-j^2)/4\) by virtue of (3.17), we infer

$$\begin{aligned} \frac{1-j^2}{4} = \frac{(1-j)}{2} \ \frac{(1+j)}{2} = r \left( m_2 \gamma - n_1 \delta \right) . \end{aligned}$$
(3.28)

Now we define \(-c = \gcd (r, (j-1)/2)\) and \(d= \gcd (m_2 \gamma - n_1 \delta , (j+1)/2)\). Then \(\gcd (-c, d) = 1\). Consequently, we write

$$\begin{aligned}{} & {} r = -ac \nonumber \\{} & {} \tfrac{1}{2} (j-1) = B c \;,\;\; \tfrac{1}{2} (j+1) = A d \; \Longrightarrow \; j = Ad+Bc \text { with } Ad-Bc=1 \nonumber \\{} & {} m_2 \gamma - n_1 \delta = b d . \end{aligned}$$
(3.29)

Note that \(c<0\) and \(a> 0\), as well as \(\gcd (a, (j-1)/2) = 1 = \gcd (b, (j+1)/2)\). It is straightforward to seeFootnote 2 that

$$\begin{aligned} (a, B)= & {} 1,\nonumber \\ (b, A)= & {} 1 . \end{aligned}$$
(3.30)

Determinant equation (3.28) gives

$$\begin{aligned} a c b d = A c B d , \end{aligned}$$
(3.31)

which, using (3.30), implies \(a = \pm A\) and \(b = \pm B\), where the signs are correlated. We pick the \(+\) sign. Then, pole (3.26) can be written as

$$\begin{aligned} -a c \rho + (a d + b c ) v - b d \sigma -n _1 \beta + m_2 \alpha = 0 . \end{aligned}$$
(3.32)

This allows us to deploy the \(\textrm{SL}(2, {\mathbb {Z}})\) matrix \(\begin{pmatrix} d &{} - b \\ - c &{} a \end{pmatrix}\) to implement an S-duality transformation on \(\Omega \), as in (3.6), to yield

$$\begin{aligned} v -n _1 \beta + m_2 \alpha = 0 . \end{aligned}$$
(3.33)

We finally execute a simple translation operation \(v\rightarrow v + \Sigma \), where \(\Sigma = n_1 \beta - m_2 \alpha \in {\mathbb {Z}}\), to generate the pole \(v=0\). We now solve

$$\begin{aligned} m_2 \gamma - n_1 \delta= & {} b d \nonumber \\ n_1 \beta - m_2 \alpha= & {} \Sigma . \end{aligned}$$
(3.34)

If \(\alpha =0\), we infer using \(\beta \gamma = -1\),

$$\begin{aligned} n_1 \beta= & {} \Sigma \longrightarrow n_1 = - \gamma \Sigma \nonumber \\ m_2= & {} - b d \beta - \delta \Sigma . \end{aligned}$$
(3.35)

On the other hand, if \(\alpha \ne 0\), then we may multiply the first equation with \(\alpha \) and the second equation with \(\gamma \) to get

$$\begin{aligned} n_1 = - b d \alpha - \gamma \Sigma . \end{aligned}$$
(3.36)

Inserting this result back into the first equation determines \(m_2\) to equal

$$\begin{aligned} m_2 = - b d \beta - \delta \Sigma . \end{aligned}$$
(3.37)

These expressions reproduce the values of \(n_1\) and \(m_2\) when \(\alpha =0\).

Thus, we have shown that the five integers \(m_1, m_2, j, n_1, n_2\) can be parametrized as in (3.18), and any pole (3.16) with \(n_2 \ge 1\) can be mapped to the pole \(v=0\) by the sequence of \(\textrm{Sp}(2, {\mathbb {Z}})\) transformations given above. \(\square \)

Using parametrization (3.18), each of poles (3.16) with \(n_2 \ge 1\) corresponds to an element of the set \(P \cup \{ \Sigma \in {\mathbb {Z}} \}\), where P is defined by

$$\begin{aligned} {P}= & {} \left\{ \begin{pmatrix} a &{} b \\ c&{}d \end{pmatrix}, \begin{pmatrix} \alpha &{} \beta \\ \gamma &{} \delta \end{pmatrix} \in \textrm{SL}(2,{\mathbb {Z}}) \; \vert a,\gamma >0, c<0, \alpha \in {\mathbb {Z}}/\gamma {\mathbb {Z}} \right\} . \end{aligned}$$
(3.38)

Defining the sets of matrices,

$$\begin{aligned} S_\Gamma = \left\{ \begin{pmatrix} \alpha &{} \beta \\ \gamma &{} \delta \end{pmatrix}\in \textrm{SL}(2,{\mathbb {Z}}): \gamma>0 \right\} , \hspace{2mm} S_G = \left\{ \begin{pmatrix} a &{} b \\ c &{} d \end{pmatrix} \in \textrm{SL}(2,{\mathbb {Z}}): a>0,c<0\right\} ,\nonumber \\ \end{aligned}$$
(3.39)

we will be summing over elements in \(\Gamma _\infty \backslash S_\Gamma \), \(S_G\), and in \( \{ \Sigma \in {\mathbb {Z}} \}\), where

$$\begin{aligned} \Gamma _\infty = \left\{ \begin{pmatrix} 1 &{} k \\ 0 &{} 1 \end{pmatrix}\in \textrm{SL}(2,{\mathbb {Z}}): k\in {\mathbb {Z}} \right\} . \end{aligned}$$
(3.40)

We can therefore parametrize the sum over poles in the set P as

$$\begin{aligned} \sum _{P} = \sum _{\begin{array}{c} \Gamma _\infty \backslash S_\Gamma \\ S_G \end{array}}. \end{aligned}$$
(3.41)

3.3 Residues at \(v'=0\)

As shown above, any pole (3.16) with \(n_2 \ge 1\) can be mapped to the pole \(v=0\) under the \(\textrm{Sp}(2, {\mathbb {Z}})\) transformation

$$\begin{aligned} \frac{1}{\Phi _{10}(\rho ,\sigma ,v)} = (\gamma \sigma + \delta )^{10}\frac{1}{\Phi _{10}(\rho ',\sigma ',v')} , \end{aligned}$$
(3.42)

with \(\rho ', \sigma ',v' \) given by (3.14).

Defining

$$\begin{aligned} \Lambda (\sigma , v) = \frac{\gamma v^2}{\gamma \sigma + \delta } -\frac{b d}{ac} \left( \frac{\alpha \sigma + \beta }{\gamma \sigma + \delta } \right) + \frac{(a d + b c )}{ac}\; \frac{v}{\gamma \sigma + \delta } - \frac{1}{ac} \Sigma , \end{aligned}$$
(3.43)

we infer

$$\begin{aligned} v' = -ac \left( \rho -\Lambda (\sigma , v) \right) . \end{aligned}$$
(3.44)

From the above we see that for a \(\Lambda \) satisfying the constraint \(\rho = \Lambda \), a translation of \(\Sigma \) in integral units of ac will modify \(\Lambda \) such that it will no longer satisfy the constraint in the given range of \(\rho _1\). Hence we restrict \(\Sigma \) to take values

$$\begin{aligned} \Sigma \in {\mathbb {Z}}/|ac|{\mathbb {Z}}. \end{aligned}$$
(3.45)

Next we evaluate the \(\rho \)-integral in (2.3). We only consider the contributions from the residues associated with the poles of \(1/\Phi _{10}\) with \(n_2 \ge 1\). Since any such pole can be mapped to the pole \(v' =0\), we compute the residue associated with \(\rho = \Lambda (\sigma , v) \), for fixed \(\sigma \) and v by noting that in the neighbourhood of \(v=0\), \(1/\Phi _{10}\) behaves as

$$\begin{aligned} \frac{1}{\Phi _{10}(\rho ,\sigma ,v)} \xrightarrow [v \rightarrow 0]{} -\frac{1}{4\pi ^2}\frac{1}{v^2}\frac{1}{\eta ^{24}(\rho )}\frac{1}{\eta ^{24}(\sigma )} . \end{aligned}$$
(3.46)

Therefore, for fixed \(\sigma \) and v, evaluating the residue at \(\rho = \Lambda (\sigma , v) \) using (3.46), we obtain

$$\begin{aligned}{} & {} -2\pi i \lim _{\rho \rightarrow \Lambda (\sigma ,v)} (-1)^{\ell +1}\frac{\partial }{\partial \rho }\left( (\rho -\Lambda (\sigma , v))^2 \, (\gamma \sigma +\delta )^{10} \,\frac{(-1)}{4\pi ^2}\right. \nonumber \\{} & {} \qquad \left. \frac{1}{v'^2}\frac{1}{\eta ^{24}(\rho ')}\frac{1}{\eta ^{24}(\sigma ')} \, e^{-2\pi i (m\rho +n\sigma +\ell v)} \right) . \end{aligned}$$
(3.47)

Using

$$\begin{aligned} \frac{\textrm{d}}{\textrm{d}\tau } \log \eta ^{24}(\tau ) = 2\pi i\, E_2(\tau ) , \end{aligned}$$
(3.48)

we obtain

$$\begin{aligned}{} & {} (-1)^{\ell +1}\frac{(\gamma \sigma +\delta )^{10}}{ac}\nonumber \\{} & {} \quad \left( \frac{m}{ac} + \frac{a}{c}E_2(\rho '_*)+\frac{c}{a}E_2(\sigma '_*)\right) \frac{1}{\eta ^{24}(\rho '_*)}\frac{1}{\eta ^{24}(\sigma '_*)}e^{-2\pi i (m\Lambda +n\sigma +\ell v)} , \nonumber \\ \end{aligned}$$
(3.49)

where

$$\begin{aligned} \rho '_*= & {} - \frac{b}{c} \left( \frac{\alpha \sigma + \beta }{\gamma \sigma + \delta } \right) + \frac{a}{c} \left( \frac{v}{\gamma \sigma + \delta } \right) - \frac{a}{c} \Sigma \nonumber \\ \sigma '_*= & {} \frac{d}{a} \left( \frac{\alpha \sigma + \beta }{\gamma \sigma + \delta } \right) - \frac{c}{a} \left( \frac{v}{\gamma \sigma + \delta } \right) - \frac{c}{a} \Sigma . \nonumber \\ v'_*= & {} 0 . \end{aligned}$$
(3.50)

4 Integrating over v

Next, we perform the integration over v in (2.5). We will first define the contour \(\Gamma _v (D)\) for a given \(n_2 \ge 1\) pole. For notational simplicity we will henceforth refer to this contour by \(\Gamma _v\).

Recall that we are considering poles with \(n_2 \ge 1\). The pole \(v' _*=0\) specified in (3.50) will be in the Siegel upper half plane provided

$$\begin{aligned} \text {Im}\rho '_*>0, \; \; \; \text {Im}\sigma '_*>0 . \end{aligned}$$
(4.1)

Evaluating

$$\begin{aligned} \textrm{Im} \rho '_*= & {} \frac{1}{n_2 | \gamma \sigma + \delta |^2} \left( \gamma a b \sigma _2 - \gamma \delta a^2 v_2 + \gamma ^2 a^2 \left( v_1 \sigma _2 - v_2 \sigma _1 \right) \right) , \nonumber \\ \textrm{Im} \sigma '_*= & {} \frac{1}{n_2 | \gamma \sigma + \delta |^2} \left( - \gamma c d \sigma _2 + \gamma \delta c^2 v_2 - \gamma ^2 c^2 \left( v_1 \sigma _2 - v_2 \sigma _1 \right) \right) , \end{aligned}$$
(4.2)

and imposing (4.1) results in

$$\begin{aligned} \frac{v_2}{\sigma _2} \, \sigma _1 + \frac{\delta }{\gamma } \frac{v_2}{\sigma _2} - \frac{b}{\gamma a }< v_1 < \frac{v_2}{\sigma _2} \, \sigma _1 + \frac{\delta }{\gamma } \frac{v_2}{\sigma _2} - \frac{d}{\gamma c }. \end{aligned}$$
(4.3)

Using the value for \(v_2/\sigma _2\) given in (2.4), we obtain

$$\begin{aligned} { {\mathcal {V}}}< v_1 < {{\mathcal {V}}} + \frac{1}{n_2} \end{aligned}$$
(4.4)

with

$$\begin{aligned} {{\mathcal {V}}} = -\frac{\ell }{2m\gamma }(\gamma \sigma _1+\delta ) - \frac{b}{\gamma a} . \end{aligned}$$
(4.5)

The above defines a contour \(\Gamma _v\) of integration for the v-integral that goes from

$$\begin{aligned} -\frac{\ell }{2m\gamma }(\gamma \sigma +\delta ) - \frac{b}{\gamma a} \hspace{4mm} \text {to }\hspace{4mm} -\frac{\ell }{2m\gamma }(\gamma \sigma +\delta ) - \frac{b}{\gamma a} - \frac{1}{ac\gamma }. \end{aligned}$$
(4.6)

Since \(n_2 \ge 1\), the range of integration specified by (4.4) lies in the original unit interval length integration contour for \(v_1\), as required.

4.1 The v Integral

The residue associated with the pole \(v_*'=0\) was given in (3.49). We now turn to the v-integral over the sum of the residues associated with the poles that belong to the set \(P \cup \{ \Sigma \in {\mathbb {Z}} \}\) given in (3.38). We follow the prescription given in (2.5),

$$\begin{aligned}{} & {} \sum _{\begin{array}{c} P\\ \Sigma \in {\mathbb {Z}} \end{array}} \, (-1)^{\ell +1}\frac{(\gamma \sigma +\delta )^{10}}{ac} \, \int \limits _{\Gamma _v} \textrm{d}v \left( \frac{m}{ac} + \frac{a}{c}E_2(\rho '_*)+\frac{c}{a}E_2(\sigma '_*)\right) \nonumber \\{} & {} \quad \frac{1}{\eta ^{24}(\rho '_*)}\frac{1}{\eta ^{24}(\sigma '_*)}e^{-2\pi i (m\Lambda +n\sigma +\ell v)}. \end{aligned}$$
(4.7)

Since \(\rho '_*\) and \(\sigma '_*\) satisfy (4.1), we may Fourier expand \(1/\eta ^{24}\) and \(E_2\) using

$$\begin{aligned} \frac{1}{\eta ^{24}(\tau )} = \sum _{n=-1}^\infty \textrm{d}(n) e^{2\pi i \tau n} \end{aligned}$$
(4.8)

and

$$\begin{aligned} \frac{E_2(\tau )}{\eta ^{24}(\tau )} = -\sum _{n=-1}^\infty nd(n) e^{2\pi i \tau n} . \end{aligned}$$
(4.9)

Then, (4.7) becomes

$$\begin{aligned}{} & {} \sum _{\begin{array}{c} P\\ \Sigma \in {\mathbb {Z}} \end{array}} (-1)^{\ell } \frac{(\gamma \sigma +\delta )^{10}}{ac} \int \limits _{\Gamma _v} \textrm{d}v \, \sum _{M,N\ge -1} \left( -\frac{m}{ac} + \frac{a}{c}M+\frac{c}{a}N\right) \, \textrm{d}(M) \, \textrm{d}(N) \nonumber \\{} & {} \qquad \qquad e^{2\pi i \rho '_* M}e^{2\pi i \sigma '_* N}e^{-2\pi i (m\Lambda +n\sigma +\ell v)}. \end{aligned}$$
(4.10)

Substituting the values for \(\rho '_*\) and \(\sigma '_*\) given in (3.50) results in

$$\begin{aligned} (-1)^\ell \sum _{\begin{array}{c} P\\ \Sigma \in {\mathbb {Z}} \end{array}} \frac{(\gamma \sigma +\delta )^{10}}{ac} \int \limits _{\Gamma _v} \textrm{d}v \, \sum _{M,N\ge -1} \left( -\frac{m}{ac} + \frac{a}{c}M+\frac{c}{a}N\right) d(M)d(N)\exp \left( -2\pi i A \right) , \nonumber \\ \end{aligned}$$
(4.11)

where

$$\begin{aligned} A&=\left( \frac{b}{c}M-\frac{d}{a}N - \frac{bd}{ac}m\right) \left( \frac{\alpha \sigma +\beta }{\gamma \sigma +\delta }\right) +\frac{v}{\gamma \sigma +\delta }\left( -\frac{a}{c}M+\frac{c}{a}N+\frac{ad+bc}{ac} m \right) \nonumber \\&\quad + m \frac{\gamma v^2}{\gamma \sigma +\delta }+\ell v +n\sigma + \Sigma \left( -\frac{m}{ac} + \frac{a}{c}M+\frac{c}{a}N\right) . \end{aligned}$$
(4.12)

This leads us to define the combinations

$$\begin{aligned} L&= -\frac{m}{ac}+\frac{a}{c}M+\frac{c}{a}N \nonumber \\ {\tilde{\ell }}&= -\frac{ad+bc}{ac} m+\frac{a}{c}M-\frac{c}{a}N \nonumber \\ {\tilde{n}}&= \frac{bd}{ac}m-\frac{b}{c}M+\frac{\textrm{d}}{a}N . \end{aligned}$$
(4.13)

Notice that (4.11) contains the following sum over \(\Sigma \),

$$\begin{aligned} \sum _{\Sigma \in {\mathbb {Z}}/|ac|{\mathbb {Z}}} e^{-2\pi i \Sigma L} , \end{aligned}$$
(4.14)

which is only non-vanishing provided that the combination L is an integer, in which case this sum equals \(-ac\). In other words, the only contributions to (4.11) will come from poles that satisfy the divisibility condition

$$\begin{aligned} ac \mid -m + a^2 M +c^2 N. \end{aligned}$$
(4.15)

Thus, restricting to \(L\in {\mathbb {Z}}\), (4.11) becomes

$$\begin{aligned}{} & {} (-1)^{\ell +1}\sum _{P} {(\gamma \sigma +\delta )^{10}} \,\int \limits _{\Gamma _v} \textrm{d}v \, \sum _{\begin{array}{c} M,N\ge -1\\ L\in {\mathbb {Z}} \end{array}} L \, \textrm{d}(M) \, \textrm{d}(N) \nonumber \\{} & {} \qquad \exp \left( -2\pi i \left[ - {\tilde{n}}\left( \frac{\alpha \sigma +\beta }{\gamma \sigma +\delta }\right) -{\tilde{\ell }} \frac{v}{\gamma \sigma +\delta }+m \frac{\gamma v^2}{\gamma \sigma +\delta }+\ell v +n\sigma \right] \right) , \nonumber \\ \end{aligned}$$
(4.16)

Using (4.13), we obtain

$$\begin{aligned} N= & {} a^2 {{{\tilde{n}}}} + b^2 m + ab {{{\tilde{\ell }}}} , \nonumber \\ L= & {} (ad + bc ) {{{\tilde{\ell }}}} + 2 ac {{{\tilde{n}}}} + 2 bd m , \nonumber \\ M= & {} c^2 {{{\tilde{n}}}} + d^2 m + cd {{{\tilde{\ell }}}} . \end{aligned}$$
(4.17)

We note that the triplets \((m,{\tilde{n}},{\tilde{\ell }})\) and (MNL) are related by the following \(\textrm{SL}(2,{\mathbb {Z}})\) transformation,

$$\begin{aligned} \begin{pmatrix} N \\ L \\ M \end{pmatrix}= \begin{pmatrix} a^2 &{} ab &{} b^2 \\ 2ac &{} ad+bc &{} 2bd \\ c^2 &{} cd &{} d^2 \end{pmatrix} \begin{pmatrix} {\tilde{n}} \\ {\tilde{\ell }}\\ m \end{pmatrix}, \end{aligned}$$
(4.18)

or equivalently,

$$\begin{aligned} \begin{pmatrix} {\tilde{n}} \\ {\tilde{\ell }}\\ m \end{pmatrix}= \begin{pmatrix} d^2 &{} -bd &{} b^2 \\ -2cd &{} ad+bc &{} -2ab \\ c^2 &{} -ac &{} a^2 \end{pmatrix} \begin{pmatrix} N \\ L \\ M \end{pmatrix} . \end{aligned}$$
(4.19)

Therefore, since the triplet (MNL) consists of integers, also \({\tilde{n}}\) and \({\tilde{\ell }}\) have to be integers. Thus, we have two triplets of integers that are related by the \(\textrm{SL}(2,{\mathbb {Z}})\) matrices G given in (3.19).

Next, we define

$$\begin{aligned} {\tilde{\Delta }} = 4 m {{{\tilde{n}}}} - {{{\tilde{\ell }}}}^2 . \end{aligned}$$
(4.20)

Note that \({\tilde{\Delta }}\) is invariant under the \(\textrm{SL}(2,{\mathbb {Z}})\) transformation G given in (3.19),

$$\begin{aligned} {\tilde{\Delta }} = 4 m {{{\tilde{n}}}} - {{{\tilde{\ell }}}}^2 = 4 MN - L^2 . \end{aligned}$$
(4.21)

Now we recall that we are considering BPS dyons with \(\Delta = 4\,m n - \ell ^2> 0\), and hence \(m>0\), in which case we may perform the following rewriting of the exponent in (4.16),

$$\begin{aligned} -{\tilde{\ell }} \frac{v}{\gamma \sigma +\delta }+m \frac{\gamma v^2}{\gamma \sigma +\delta }+\ell v =&\, \frac{m\gamma }{\gamma \sigma +\delta } \left( v+\frac{1}{2m\gamma }\left( (\gamma \sigma +\delta )\ell -{\tilde{\ell }}\right) \right) ^2\nonumber \\ {}&-\frac{1}{4m\gamma }(\gamma \sigma +\delta )\ell ^2 - \frac{1}{4m\gamma }\frac{{\tilde{\ell }}^2}{\gamma \sigma +\delta }+\frac{1}{2m\gamma }\ell {\tilde{\ell }}. \end{aligned}$$
(4.22)

Using this, (4.16) can be written as

$$\begin{aligned}{} & {} (-1)^{\ell +1}\sum _{{P}}{(\gamma \sigma +\delta )^{10}} \,\int \limits _{\Gamma _v} \textrm{d}v \, \sum _{\begin{array}{c} M,N\ge -1\\ L\in {\mathbb {Z}} \end{array}} L d(M)d(N)\nonumber \\{} & {} \qquad e^{2\pi i \left( \frac{\alpha }{\gamma }\frac{{\tilde{\Delta }}}{4m}+ \frac{\delta }{\gamma }\frac{\Delta }{4m} \right) } e^{2\pi i \left( \frac{\alpha }{\gamma }\frac{{\tilde{\ell }}^2}{4m}-\frac{\ell {\tilde{\ell }}}{2m\gamma } +\frac{\delta }{\gamma }\frac{\ell ^2}{4m} \right) }\nonumber \\{} & {} \qquad e^{-2\pi i \left[ \frac{{\tilde{\Delta }}}{4m}\frac{1}{\gamma }\frac{1}{\gamma \sigma +\delta } +\frac{\Delta }{4m}\frac{\gamma \sigma +\delta }{\gamma } +\frac{m\gamma }{\gamma \sigma +\delta }\left( v+ \frac{1}{2m\gamma }\left( (\gamma \sigma +\delta )\ell -{\tilde{\ell }}\right) \right) ^2 \right] }. \end{aligned}$$
(4.23)

4.1.1 T-Shifts

In the following, we rewrite expression (4.23) by recasting the sum over \(b\in {\mathbb {Z}}\) as a sum over a new integer T, as follows. Let \(T \in {\mathbb {Z}}\) and consider the matrix \(\begin{pmatrix} 1 &{} T \\ 0 &{} 1 \end{pmatrix}\). First we note that the operation

$$\begin{aligned} \begin{pmatrix} a &{} b \\ c &{} d \end{pmatrix}\begin{pmatrix} 1 &{} T \\ 0 &{} 1 \end{pmatrix} = \begin{pmatrix} a &{} aT+b \\ c &{} cT +d \end{pmatrix} \end{aligned}$$
(4.24)

induces the change

$$\begin{aligned} b/a \mapsto b/a + T, \hspace{5mm}d/c \mapsto d/c + T, \end{aligned}$$
(4.25)

while leaving a and c invariant. Therefore, expressions such as L that only depend on a and c are invariant under this change. Hence, also \({{\tilde{\Delta }}}\) is invariant under this change. On the other hand, \({\tilde{\ell }}\) and \({\tilde{n}}\) transform as follows,

$$\begin{aligned} {\tilde{\ell }}\mapsto & {} {\tilde{\ell }} -2mT \nonumber \\ {\tilde{n}}\mapsto & {} {\tilde{n}}-{\tilde{\ell }}T +mT^2 . \end{aligned}$$
(4.26)

Next, note that \({\tilde{\ell }} \) can be written as

$$\begin{aligned} {\tilde{\ell }} = -\frac{1}{ac} m+\frac{a}{c}M-\frac{c}{a}N -2m\frac{b}{a} , \end{aligned}$$
(4.27)

and hence the condition \(b\in {\mathbb {Z}}/a{\mathbb {Z}}\) translates to \({\tilde{\ell }} \in {\mathbb {Z}}/2m{\mathbb {Z}}\). Thus we can express (4.23) as

$$\begin{aligned}{} & {} (-1)^{\ell +1} \sum _{\begin{array}{c} P\\ b\in {\mathbb {Z}}/a{\mathbb {Z}}, \, T \in {\mathbb {Z}} \end{array}} {(\gamma \sigma +\delta )^{10}} \, \int \limits _{\Gamma _v} \textrm{d}v \, \sum _{\begin{array}{c} M,N\ge -1\\ L\in {\mathbb {Z}} \end{array}} \, L \, \textrm{d}(M) \, \textrm{d}(N) \nonumber \\{} & {} \qquad \qquad e^{2\pi i \left( \frac{\alpha }{\gamma }\frac{{\tilde{\Delta }}}{4m}+ \frac{\delta }{\gamma }\frac{\Delta }{4m} \right) } e^{2\pi i \left( \frac{\alpha }{\gamma }\frac{({\tilde{\ell }}-2mT)^2}{4m}-\frac{\ell ({\tilde{\ell }}-2mT)}{2m\gamma } +\frac{\delta }{\gamma }\frac{\ell ^2}{4m} \right) } \nonumber \\{} & {} \exp \left( -2\pi i \left[ \frac{{\tilde{\Delta }}}{4m}\frac{1}{\gamma }\frac{1}{\gamma \sigma +\delta } +\frac{{\Delta }}{4m}\frac{\gamma \sigma +\delta }{\gamma } +\frac{m\gamma }{\gamma \sigma +\delta }\left( v+ \frac{1}{2m\gamma }\left( (\gamma \sigma +\delta )\ell -{\tilde{\ell }}\right) +\frac{T}{\gamma }\right) ^2 \right] \right) . \nonumber \\ \end{aligned}$$
(4.28)

Using (4.25), integration contour (4.6) goes from

$$\begin{aligned} -\frac{\ell }{2m\gamma }(\gamma \sigma +\delta ) - \frac{b}{\gamma a} - \frac{T}{\gamma } \hspace{4mm} \text {to }\hspace{4mm} -\frac{\ell }{2m\gamma }(\gamma \sigma +\delta ) - \frac{b}{\gamma a} - \frac{1}{ac\gamma }- \frac{T}{\gamma } , \nonumber \\ \end{aligned}$$
(4.29)

and the range of integration specified by (4.4) requires restricting the values of T to

$$\begin{aligned} T \in {\mathbb {Z}}/\gamma {\mathbb {Z}}. \end{aligned}$$
(4.30)

4.1.2 Performing the v-Integral

We now perform the v-integral in (4.28) along the contour \(\Gamma _v\) specified by (4.29). To do so, we assume the legitimacy of interchanging the integration with the summation over MN in (4.28). Note that the dependence on v is contained in the last line of (4.28), only,

$$\begin{aligned} \int \limits _{\Gamma _v} \textrm{d}v \, \exp \left( -2\pi i\frac{m\gamma }{\gamma \sigma +\delta } \left( v+\frac{1}{2m\gamma }\left( (\gamma \sigma +\delta )\ell -{\tilde{\ell }}\right) +\frac{T}{\gamma }\right) ^2\right) . \end{aligned}$$
(4.31)

Using the expression for the error function

$$\begin{aligned} \int ^x \textrm{d}t \,e^{-a(t+b)^2} = \frac{1}{2}\sqrt{\frac{\pi }{a}}\text {Erf}\left[ \sqrt{a}(x+b) \right] +C, \end{aligned}$$
(4.32)

we obtain for (4.31),

$$\begin{aligned}&\frac{1}{2}\frac{\sqrt{\gamma \sigma +\delta }}{\sqrt{2m\gamma i}}\nonumber \\&\quad \left( \text {Erf}\left[ \sqrt{\frac{2\pi i m\gamma }{\gamma \sigma +\delta }}\left( -\frac{b}{a\gamma }-\frac{1}{ac\gamma }-\frac{{\tilde{\ell }}}{2m\gamma } \right) \right] -\text {Erf}\left[ \sqrt{\frac{2\pi i m\gamma }{\gamma \sigma +\delta }}\left( -\frac{b}{a\gamma }-\frac{{\tilde{\ell }}}{2m\gamma } \right) \right] \right) , \end{aligned}$$
(4.33)

where we take the principal branch of the square roots.

Hence, integrating (4.28) over v results in

$$\begin{aligned}{} & {} (-1)^{\ell +1} \sum _{\begin{array}{c} P\\ b\in {\mathbb {Z}}/a{\mathbb {Z}}, \, T \in {\mathbb {Z}}/\gamma {\mathbb {Z}} \end{array}} \; {(\gamma \sigma +\delta )^{10}} \, \sum _{\begin{array}{c} M,N\ge -1\\ L\in {\mathbb {Z}} \end{array}} \, L \, d(M) \, d(N) \, e^{2\pi i \left( \frac{\alpha }{\gamma }\frac{{\tilde{\Delta }}}{4m}+ \frac{\delta }{\gamma }\frac{\Delta }{4m} \right) } \nonumber \\{} & {} \quad e^{2\pi i \left( \frac{\alpha }{\gamma }\frac{({\tilde{\ell }}-2mT)^2}{4m}-\frac{\ell ({\tilde{\ell }}-2mT)}{2m\gamma } +\frac{\delta }{\gamma }\frac{\ell ^2}{4m} \right) } e^{\left( -2\pi i \left[ \frac{{\tilde{\Delta }}}{4m}\frac{1}{\gamma }\frac{1}{\gamma \sigma +\delta } +\frac{{\Delta }}{4m}\frac{\gamma \sigma +\delta }{\gamma } \right] \right) } \nonumber \\{} & {} \quad \frac{1}{2}\frac{\sqrt{\gamma \sigma +\delta }}{\sqrt{2m\gamma i}}\left( \text {Erf}\left[ \sqrt{\frac{2\pi i m\gamma }{\gamma \sigma +\delta }}\left( -\frac{b}{a\gamma }-\frac{1}{ac\gamma }-\frac{{\tilde{\ell }}}{2m\gamma } \right) \right] \right. \nonumber \\{} & {} \left. \quad -\text {Erf}\left[ \sqrt{\frac{2\pi i m\gamma }{\gamma \sigma +\delta }}\left( -\frac{b}{a\gamma }-\frac{{\tilde{\ell }}}{2m\gamma } \right) \right] \right) . \end{aligned}$$
(4.34)

4.1.3 \(\textrm{SL}(2,{\mathbb {Z}})\) Multiplier System

Inspection of (4.34) reveals the presence of the multiplier system associated with the \(\textrm{SL}(2,{\mathbb {Z}})\) matrix \(\Gamma = \begin{pmatrix} \alpha &{} \beta \\ \gamma &{} \delta \end{pmatrix}\) [18, 19],

$$\begin{aligned} \psi (\Gamma )_{\ell j} = \frac{1}{\sqrt{2m\gamma i}}\sum _{T\in {\mathbb {Z}}/\gamma {\mathbb {Z}}} e^{2\pi i \left( \frac{\alpha }{\gamma }\frac{(\ell -2mT)^2}{4m}-\frac{j(\ell -2mT)}{2m\gamma } +\frac{\delta }{\gamma }\frac{j^2}{4m} \right) } . \end{aligned}$$
(4.35)

It has the property \(\psi _{(\ell + 2\,m k) j}(\Gamma ) = \psi _{ {\ell } j}(\Gamma )\) (with \(k \in {\mathbb {Z}}\)) [20]. This multiplier system arises when considering the transformation law of the standard Jacobi theta function \(\vartheta _{m,\ell }(\sigma ,v)\) of weight 1/2 and index m under modular transformations [13],

$$\begin{aligned} \vartheta _{m,\ell }\left( \frac{\alpha \sigma +\beta }{\gamma \sigma +\delta }, \frac{v}{\gamma \sigma +\delta } \right) = (\gamma \sigma +\delta )^{1/2}e^{2\pi i m \frac{\gamma v^2}{\gamma \sigma +\delta }} \sum _{j\in {\mathbb {Z}}/2m{\mathbb {Z}}} \psi (\Gamma )_{\ell j}\;\vartheta _{m,j}(\sigma ,v).\nonumber \\ \end{aligned}$$
(4.36)

The multiplier system that enters in (4.34) is \( \psi (\Gamma )_{{\tilde{\ell }}\ell }\).

4.1.4 Splitting the Error Functions

The error functions in (4.34) can be split into three different terms. We refer to Appendix A for the details on this. Here we briefly summarise its salient features.

Using the property \(\text {Erf}(-x) = -\text {Erf}(x)\), we write the difference of the error functions in (4.34) as

$$\begin{aligned} \text {Erf}\left[ \sqrt{\frac{2\pi i m}{\gamma (\gamma \sigma +\delta )}}\left( \frac{b}{a}+\frac{{\tilde{\ell }}}{2m} \right) \right] +\text {Erf}\left[ \sqrt{\frac{2\pi i m}{\gamma (\gamma \sigma +\delta )}}\left( -\frac{b}{a}-\frac{1}{ac}-\frac{{\tilde{\ell }}}{2m} \right) \right] .\nonumber \\ \end{aligned}$$
(4.37)

Next we define the following functions,

$$\begin{aligned} E_{m,\gamma (\gamma \sigma +\delta )}(x) = - \frac{1}{\sqrt{\pi }}\frac{1}{\sqrt{\frac{2\pi i m}{\gamma (\gamma \sigma +\delta )}}x}e^{-\frac{2\pi i m}{\gamma (\gamma \sigma +\delta )}x^2} \end{aligned}$$
(4.38)

and

$$\begin{aligned}{} & {} I_{m,\gamma (\gamma \sigma +\delta )}(x) \nonumber \\{} & {} \quad =-\frac{1}{2\sqrt{\pi }} \frac{1}{\sqrt{2\pi i m}x}e^{-\frac{2\pi i m}{\gamma (\gamma \sigma +\delta )}x^2}\int \limits _0^{i\infty }\left( \frac{1}{\gamma (\gamma \sigma +\delta )}-z \right) ^{-3/2}e^{2\pi i m x^2 z}dz . \nonumber \\ \end{aligned}$$
(4.39)

We introduce

$$\begin{aligned} X = \frac{b}{a}+\frac{{\tilde{\ell }}}{2m}, \hspace{6mm}Y = -\frac{b}{a}-\frac{1}{ac}-\frac{{\tilde{\ell }}}{2m}, \end{aligned}$$
(4.40)

and we note that since \(-1/ac >0\), X and Y cannot be both negative. We now consider the product

$$\begin{aligned} XY = \left( \frac{b}{a}+\frac{{\tilde{\ell }}}{2m} \right) \left( -\frac{b}{a}-\frac{1}{ac}-\frac{{\tilde{\ell }}}{2m} \right) . \end{aligned}$$
(4.41)

Depending on the sign of XY, the expression for sum (4.37) will take a different form, as follows. If \(X Y > 0\), (4.37) becomes

$$\begin{aligned} 2 + E_{m,\gamma (\gamma \sigma +\delta )} \left( X \right) + I_{m,\gamma (\gamma \sigma +\delta )} \left( X\right) + E_{m,\gamma (\gamma \sigma +\delta )} \left( Y \right) + I_{m,\gamma (\gamma \sigma +\delta )} \left( Y \right) .\nonumber \\ \end{aligned}$$
(4.42)

If \(X Y = 0\), (4.37) has the form

$$\begin{aligned} 1 + E_{m,\gamma (\gamma \sigma +\delta )} \left( -\frac{1}{ac}\right) + I_{m,\gamma (\gamma \sigma +\delta )} \left( -\frac{1}{ac}\right) , \end{aligned}$$
(4.43)

where we used that when \(X=0\), Y is given by \(Y=- 1/ac\), and when \(Y=0\), X is given by \(X=-1/ac\). Since \(- 1/ac > 0\), we can re-express the condition \(X Y \ge 0\) as

$$\begin{aligned} 0 \le \frac{b}{a}+\frac{{\tilde{\ell }}}{2m} \le -\frac{1}{ac} . \end{aligned}$$
(4.44)

This condition [10] is satisfied by all the convergents of the continued fraction of

$$\begin{aligned} \frac{{\tilde{\ell }}}{2m}. \end{aligned}$$
(4.45)

Finally, when \(X Y < 0\), (4.37) takes the form

$$\begin{aligned} E_{m,\gamma (\gamma \sigma +\delta )}\left( X \right) + I_{m,\gamma (\gamma \sigma +\delta )} \left( X \right) + E_{m,\gamma (\gamma \sigma +\delta )} \left( Y\right) + I_{m,\gamma (\gamma \sigma +\delta )}\left( Y \right) .\nonumber \\ \end{aligned}$$
(4.46)

The above shows that the error functions in (4.34) give rise to three distinct types of terms, namely constants, terms involving \(E_{m,\gamma (\gamma \sigma +\delta )}\) and terms involving \(I_{m,\gamma (\gamma \sigma +\delta )}\). As we will see below, upon performing the \(\sigma \)-integral, these three distinct contributions will give rise to terms involving the Bessel function \(I_{23/2}\), the Bessel function \(I_{12}\) and the integral of the Bessel function \(I_{25/2}\), respectively.

4.2 A Symmetry

Expression (4.34) possesses a symmetry that can be used to simplify the terms that involve \(E_{m,\gamma (\gamma \sigma +\delta )}(x)\) and \(I_{m,\gamma (\gamma \sigma +\delta )}(x)\), as follows. Let us first consider the case when \(X Y >0\) or \(XY<0\). Then, (4.34) will contain terms of form (c.f. (4.42) and (4.46))

$$\begin{aligned} \begin{aligned}&(-1)^{\ell +1} \sum _{\begin{array}{c} P\\ b\in {\mathbb {Z}}/a{\mathbb {Z}} \end{array}} {(\gamma \sigma +\delta )^{10}} \sum _{\begin{array}{c} M,N\ge -1\\ L\in {\mathbb {Z}} \end{array}} L \, d(M) \, d(N) \\&\quad e^{2\pi i \left( \frac{\alpha }{\gamma }\frac{{\tilde{\Delta }}}{4m}+ \frac{\delta }{\gamma }\frac{\Delta }{4m} \right) } \, \psi (\Gamma )_{{\tilde{\ell }}\ell } \, e^{\left( -2\pi i \left[ \frac{{\tilde{\Delta }}}{4m}\frac{1}{\gamma }\frac{1}{\gamma \sigma +\delta } +\frac{{\Delta }}{4m}\frac{\gamma \sigma +\delta }{\gamma } \right] \right) } \\&\quad \frac{1}{2}\sqrt{\gamma \sigma +\delta }\, \left( E_{m,\gamma (\gamma \sigma +\delta )} \left( Y\right) + I_{m,\gamma (\gamma \sigma +\delta )}\left( Y \right) \right) . \end{aligned} \end{aligned}$$
(4.47)

We observe that under the mapping,

$$\begin{aligned} \begin{pmatrix} a &{} b \\ c &{} d \end{pmatrix}\mapsto & {} \begin{pmatrix} a' &{} b' \\ c' &{} d' \end{pmatrix} = \begin{pmatrix} -c &{} d \\ -a &{} b \end{pmatrix} \nonumber \\ (M,N)\mapsto & {} (M',N') = (N,M) , \end{aligned}$$
(4.48)

the property \(a',-c'>0\) as well as the unit determinant property are preserved. Further, the following quantities remain invariant:

$$\begin{aligned} L' = L, \hspace{4mm} {\tilde{\Delta }}' = {\tilde{\Delta }} , \end{aligned}$$
(4.49)

while \({\tilde{\ell }}, X\) and Y are mappedFootnote 3

$$\begin{aligned} {\tilde{\ell }}' = -{\tilde{\ell }}, \hspace{4mm} X' = Y, \hspace{4mm} Y' = X. \end{aligned}$$
(4.50)

Thus, we can write (4.47) as

$$\begin{aligned} \begin{aligned}&(-1)^{\ell +1} \sum _{\begin{array}{c} P\\ b\in {\mathbb {Z}}/a{\mathbb {Z}} \end{array}} {(\gamma \sigma +\delta )^{10}} \sum _{\begin{array}{c} M,N\ge -1\\ L\in {\mathbb {Z}} \end{array}} L \, d(M) \, d(N) \\&\quad e^{2\pi i \left( \frac{\alpha }{\gamma }\frac{{\tilde{\Delta }}}{4m}+ \frac{\delta }{\gamma }\frac{\Delta }{4m} \right) } \, \psi (\Gamma )_{-{\tilde{\ell }}\ell } \, e^{\left( -2\pi i \left[ \frac{{\tilde{\Delta }}}{4m}\frac{1}{\gamma }\frac{1}{\gamma \sigma +\delta } +\frac{{\Delta }}{4m}\frac{\gamma \sigma +\delta }{\gamma } \right] \right) }\\&\quad \frac{1}{2}\sqrt{\gamma \sigma +\delta } \left( E_{m,\gamma (\gamma \sigma +\delta )} \left( X\right) + I_{m,\gamma (\gamma \sigma +\delta )}\left( X \right) \right) , \end{aligned} \end{aligned}$$
(4.51)

and hence we can express the combination

$$\begin{aligned} \psi (\Gamma )_{{\tilde{\ell }}\ell }\left( E_{m,\gamma (\gamma \sigma +\delta )} \left( X\right) + I_{m,\gamma (\gamma \sigma +\delta )}\left( X \right) + E_{m,\gamma (\gamma \sigma +\delta )} \left( Y\right) + I_{m,\gamma (\gamma \sigma +\delta )}\left( Y \right) \right) ,\nonumber \\ \end{aligned}$$
(4.52)

which occurs in (4.34) when \(X Y >0\) or \(XY < 0\), as

$$\begin{aligned} \left( \psi (\Gamma )_{{\tilde{\ell }}\ell } +\psi (\Gamma )_{-{\tilde{\ell }}\ell } \right) \left( E_{m,\gamma (\gamma \sigma +\delta )} \left( X\right) + I_{m,\gamma (\gamma \sigma +\delta )}\left( X \right) \right) . \end{aligned}$$
(4.53)

On the other hand, when \(XY=0\), (4.34) will contain terms of form (4.43), which, using mapping (4.48), can be brought to form (4.51). Hence, the combined contributions from \(X=0\) (in which case \(Y=-1/ac\)) and from \(Y= 0\) (in which case \(X=-1/ac\)) take again form (4.53). Thus, irrespective of whether \(XY >0, XY=0\) or \(XY<0\), the contributions to (4.34) from the terms involving \(E_{m,\gamma (\gamma \sigma +\delta )}(x)\) and \(I_{m,\gamma (\gamma \sigma +\delta )}(x)\) take the form

$$\begin{aligned}&(-1)^{\ell +1} \sum _{\begin{array}{c} P\\ b\in {\mathbb {Z}}/a{\mathbb {Z}} \end{array}} \; {(\gamma \sigma +\delta )^{10}} \sum _{\begin{array}{c} M,N\ge -1\\ L\in {\mathbb {Z}}, \; X \ne 0 \end{array}} L \, d(M) \, d(N) \nonumber \\&\qquad e^{2\pi i \left( \frac{\alpha }{\gamma }\frac{{\tilde{\Delta }}}{4m}+ \frac{\delta }{\gamma }\frac{\Delta }{4m} \right) }\left( \psi (\Gamma )_{{\tilde{\ell }}\ell }+\psi (\Gamma )_{-{\tilde{\ell }}\ell }\right) e^{\left( -2\pi i \left[ \frac{{\tilde{\Delta }}}{4m}\frac{1}{\gamma }\frac{1}{\gamma \sigma +\delta } +\frac{{\Delta }}{4m}\frac{\gamma \sigma +\delta }{\gamma } \right] \right) }\nonumber \\&\qquad \frac{1}{2}\sqrt{\gamma \sigma +\delta } \left( E_{m,\gamma (\gamma \sigma +\delta )} \left( X\right) + I_{m,\gamma (\gamma \sigma +\delta )}\left( X \right) \right) . \end{aligned}$$
(4.54)

5 Integrating over \(\sigma \)

Next, we turn to the \(\sigma \)-integral of (4.34). We first explicate our choice of integration contour \(\Gamma _\sigma (D)\) in (2.5) for a given \(n_2 \ge 1\) pole D in \(P \cup \{\Sigma \in {\mathbb {Z}} \}\).

5.1 Contour of Integration

The contour \(\Gamma _\sigma (D)\) defined in the \(\sigma \) upper half plane restricted to \(\sigma _1 \in [0,1)\) crosses locus (3.16) associated with quadratic poles. Writing out the real and imaginary parts of (3.16) gives

$$\begin{aligned}{} & {} -ac\gamma (\rho _1\sigma _1-v_1^2-\rho _2\sigma _2+v_2^2)\nonumber \\{} & {} \quad +(ad+bc)v_1+(-bd\alpha -\gamma \Sigma )\sigma _1 -ac\delta \rho _1-bd\beta -\delta \Sigma =0, \nonumber \\{} & {} \quad -ac\gamma (\rho _1\sigma _2+\rho _2\sigma _1-2v_1v_2)+(ad+bc)v_2 \nonumber \\{} & {} \quad +(-bd\alpha -\gamma \Sigma )\sigma _2-ac\delta \rho _2= 0. \end{aligned}$$
(5.1)

Solving the second equation for \(\rho _1\) yields

$$\begin{aligned} \rho _1= \frac{-a c\rho _2(\gamma \sigma _1+ \delta )+2 a c \gamma v_1 v_2+(a d+bc) v_2+(-bd\alpha -\gamma \Sigma )\sigma _2}{a c \gamma \sigma _2}. \qquad \end{aligned}$$
(5.2)

Now we recall that \(v_1\) lies in range (4.3), which we write as

$$\begin{aligned} v_1 = \frac{v_2}{\gamma \sigma _2}(\gamma \sigma _1+\delta )-\frac{b}{\gamma a}+x, \end{aligned}$$
(5.3)

where \(x\in (0,-1/ac\gamma )\). Inserting (5.3) as well as (5.2) into the first equation of (5.1) gives

$$\begin{aligned} \left( \rho _2 \sigma _2 - v_2^2 \right) \left( \sigma _1 + \frac{\delta }{\gamma } \right) ^2 + \sigma _2^2 \left( x + \frac{1}{2 a c \gamma } \right) ^2 = \sigma _2^2 \left[ \frac{1}{4 (a c \gamma )^2 } - \left( \rho _2 \sigma _2 - v_2^2 \right) \right] . \nonumber \\ \end{aligned}$$
(5.4)

This describes an ellipse in the \((\sigma _1, x)\)-plane provided that the right-hand side of this equation is non-vanishing and positive,

$$\begin{aligned} \rho _2\sigma _2-v_2^2 = \rho _2\sigma _2 - \left( \frac{\ell }{2m } \right) ^2 \sigma _2^2 <\frac{1}{4a^2c^2\gamma ^2}, \end{aligned}$$
(5.5)

where we set

$$\begin{aligned} \frac{v_2}{\sigma _2} = - \frac{\ell }{2m}. \end{aligned}$$
(5.6)

Combining the \(\sigma _2\)-direction with (5.4) results in an ellipsoid in three dimensions, with \(\sigma _2\) taking values in the range specified by (5.5).

On the other hand, we note that the point \((\sigma _1 = - \delta /\gamma , x, \sigma _2 =0)\) lies in locus (5.4). This point, which lies on the boundary of the Siegel upper half plane, is the anchoring point of a curve in the complex \(\sigma \)-plane at fixed \(x\in (0,-1/ac\gamma )\), as follows. Since \(\sigma _2 >0\), we may divide (5.4) to arrive at

$$\begin{aligned} \left( \sigma _1 + \, \frac{\delta }{\gamma } \right) ^2 + \left( \sigma _2 - \frac{X(x)}{2 \lambda } \right) ^2 = \frac{(X(x))^2}{4 \lambda ^2 }, \end{aligned}$$
(5.7)

where we defined

$$\begin{aligned} \lambda \equiv \rho _2 - \left( \frac{\ell }{2m } \right) ^2 \sigma _2 > 0 \;\;,\;\;\; X(x) \equiv \frac{1}{(2 a c \gamma )^2} - \left( x + \frac{1}{2 a c \gamma } \right) ^2. \end{aligned}$$
(5.8)

Note that \(X(x)> 0\) for \(x\in (0,-1/ac\gamma )\), and that the positivity of \(\lambda \) can be enforced by taking \(\rho _2\) to be sufficiently large. At fixed x, above equation (5.7) describes a circle in the complex \(\sigma \)-plane anchored at \((\sigma _1 = - \delta /\gamma , \sigma _2 =0)\), provided that \(\lambda \) is kept fixed. The latter is compatible with condition (5.5), as follows. We write (5.5) as

$$\begin{aligned} 0< \sigma _2 < \frac{1}{4a^2c^2\gamma ^2 \, \lambda }. \end{aligned}$$
(5.9)

The bound on the right-hand side is precisely saturated when \(\sigma _2 = X_{\max } /\lambda \), where \(X_{\max } \) is the maximal value of X, which is attained for \(x = - 1/(2 a c \gamma )\). The associated point on the circle is \((\sigma _1 = - \delta /\gamma , \sigma _2 = X_{\max } /\lambda )\), which is the point on the circle that intersects the line \(\sigma _1 = - \delta /\gamma \) in the complex \(\sigma \)-plane. Thus, we see that keeping \(\lambda \) fixed is compatible with restricting the range of \(\sigma _2\) to

$$\begin{aligned} 0 < \sigma _2 \le \frac{1}{4a^2c^2\gamma ^2 \, \lambda }. \end{aligned}$$
(5.10)

At fixed \(\lambda \), the circle described by (5.7) is homotopic to a Ford circle \({\mathcal {C}}( -\delta , \gamma )\) in the complex \(\sigma \)-plane anchored on the real axis at \(\sigma _1 = - \delta /\gamma \) (see Appendix C.1 for details). Note that since the homotopy is between circles, the leading behaviour of the integrand in (5.11) when approaching the point \((\sigma _1 = - \delta /\gamma , \sigma _2 =0)\) along any of these two circles in the same. The chosen range \(\sigma _1 \in [0,1)\) constrains the poles contributing to (4.34) to those associated with \(0 \le -\frac{\delta }{\gamma }< 1\). Since this holds for any \(x\in (0,-1/ac\gamma )\), our integration contour over \(\sigma \) for a given pole is \(\Gamma _\sigma (D) = {\mathcal {C}}( -\delta , \gamma ) \), which for notational simplicity we will denote by \(\Gamma _{\sigma }\).

The interpretation of this construction is the one given in [21]. When \(\sigma _2\) is large, the integration contour does not intersect the ellipsoid described above. When lowering the value of \(\sigma _2\), the integration contour will cross some of the poles in the Siegel upper half plane described by (5.7). This will cease to be the case when \(\sigma _2\) reaches the boundary \(\sigma _2 = 0\) of the Siegel upper half plane. Fixing the value of \(\lambda \) to be large enough, we note that as we decrease \(\sigma _2\) we continue to remain in the \({{\mathcal {R}}}\)-chamber, ensuring that the integration contour does not cross any \(n_2=0\) pole.

We will now perform the \(\sigma \)-integral of (4.34) over the Ford circle \(\Gamma _{\sigma }\) described above, following the prescription given in (2.5), which results in

$$\begin{aligned}&(-1)^{\ell +1} \sum _{\begin{array}{c} P\\ b \in {\mathbb {Z}}/a{\mathbb {Z}} \end{array}} \int \limits _{\Gamma _{\sigma }} \textrm{d} \sigma \; {(\gamma \sigma +\delta )^{10}} \sum _{\begin{array}{c} M,N\ge -1\\ L\in {\mathbb {Z}} \end{array}} \, L \, d(M) \, d(N) \nonumber \\&\quad e^{2\pi i \left( \frac{\alpha }{\gamma }\frac{{\tilde{\Delta }}}{4m}+ \frac{\delta }{\gamma }\frac{\Delta }{4m} \right) } \, \psi (\Gamma )_{{\tilde{\ell }}\ell } \; e^{\left( -2\pi i \left[ \frac{{\tilde{\Delta }}}{4m}\frac{1}{\gamma }\frac{1}{\gamma \sigma +\delta } +\frac{{\Delta }}{4m}\frac{\gamma \sigma +\delta }{\gamma } \right] \right) } \nonumber \\&\quad \frac{1}{2} \sqrt{\gamma \sigma +\delta } \left( \text {Erf}\left[ \sqrt{\frac{2\pi i m\gamma }{\gamma \sigma +\delta }}\left( -\frac{b}{a\gamma }-\frac{1}{ac\gamma }-\frac{{\tilde{\ell }}}{2m\gamma } \right) \right] \right. \nonumber \\&\quad \left. -\text {Erf}\left[ \sqrt{\frac{2\pi i m\gamma }{\gamma \sigma +\delta }}\left( -\frac{b}{a\gamma }-\frac{{\tilde{\ell }}}{2m\gamma } \right) \right] \right) . \end{aligned}$$
(5.11)

To perform this integral, we will use the decomposition of the error functions given above.

5.2 Bessel Function \(I_{23/2}\)

We first focus on the constant terms in decompositions (4.42) and (4.43).

Firstly we show that the two cases corresponding to \(X=0\) and \(Y=0\) give rise to the same contribution, as follows. The condition \(X=0\) yields \(m -a^2\,M = - c^2 N\), and hence \(L = 2 c N / a\). We will show later that only terms with \({{{\tilde{\Delta }}}} <0\) contribute. Therefore combining \(L = 2 c N / a\) with \({{{\tilde{\Delta }}}} <0\) results in \(L > 0\), which in turn implies \(N=-1\). The latter implies a|2. Consequently \({{{\tilde{\ell }}}} = - b \, 2\,m /a = k m, k \in {\mathbb {Z}}\). Therefore \({{{\tilde{\ell }}}} = - {{{\tilde{\ell }}}} \, \text {mod} \, 2\,m \) and hence \( \psi (\Gamma )_{-{\tilde{\ell }}\ell } = \psi (\Gamma )_{{\tilde{\ell }}\ell } \). Using mapping (4.48), this shows that the contribution from the sector \(X=0\) equals the one from the sector \(Y=0\). Therefore, the combined contribution from the sectors \(X Y \ge 0\) can be expressed as follows,

$$\begin{aligned} \begin{aligned}&(-1)^{\ell +1} \sum _{\begin{array}{c} P\\ b \in {\mathbb {Z}}/a{\mathbb {Z}} \end{array}} \int \limits _{\Gamma _{\sigma }} d \sigma \; {(\gamma \sigma +\delta )^{21/2}} \sum _{\begin{array}{c} M,N\ge -1\\ L\in {\mathbb {Z}} \\ 0 \le \frac{b}{a}+\frac{{\tilde{\ell }}}{2m} < -\frac{1}{ac} \end{array}} L \, d(M) \, d(N) \\&\quad e^{2\pi i \left( \frac{\alpha }{\gamma }\frac{{\tilde{\Delta }}}{4m}+ \frac{\delta }{\gamma }\frac{\Delta }{4m} \right) } \, \psi (\Gamma )_{{\tilde{\ell }}\ell } \; \, e^{\left( -2\pi i \left[ \frac{{\tilde{\Delta }}}{4m}\frac{1}{\gamma }\frac{1}{\gamma \sigma +\delta } +\frac{{\Delta }}{4m}\frac{\gamma \sigma +\delta }{\gamma } \right] \right) } , \end{aligned} \end{aligned}$$
(5.12)

where continued fraction condition (4.44) now takes the form given in (5.12). To proceed, we interchange the integration with the summation over MN. This is allowed by the following arguments.

First we note that the condition \(0 \le \frac{b}{a}+\frac{{\tilde{\ell }}}{2\,m} < -\frac{1}{ac}\) in the summation above can be written as

$$\begin{aligned} -m < a^2 M -c^2N \le m. \end{aligned}$$
(5.13)

Then, using the expression for L given in (4.13), we write out \({\tilde{\Delta }} = 4MN-L^2\) and obtain

$$\begin{aligned} {\tilde{\Delta }} = \frac{1}{a^2c^2} \left[ -(a^2M-c^2N)^2-\left( m^2-2m(a^2M+c^2N) \right) \right] . \end{aligned}$$
(5.14)

Now let us consider terms that satisfy \({\tilde{\Delta }}\le 0\), in which case we obtain from (5.14),

$$\begin{aligned} 2m(a^2M+c^2N) \le (a^2M-c^2N)^2+m^2 . \end{aligned}$$
(5.15)

Combining this with (5.13) we infer

$$\begin{aligned} a^2M+c^2N \le m. \end{aligned}$$
(5.16)

Then, by combining this last inequality with (5.13) we obtain the bounds

$$\begin{aligned} a^2 M \le m, \hspace{7mm} c^2 N < m . \end{aligned}$$
(5.17)

Therefore, for a given ac there is only a finite set of values MN which satisfy \({\tilde{\Delta }} \le 0 \) as well as continued fraction condition (4.44) and the condition \(L \in {\mathbb {Z}}\). Thus, in this case, we can interchange the integration with the summation over MN.

Next, let us consider the terms with \({\tilde{\Delta }} >0 \). For large values of M, the Fourier coefficients of \(1/\eta ^{24}\) grow exponentially as

$$\begin{aligned} d(M) \sim e^{4 \pi \sqrt{M}}. \end{aligned}$$
(5.18)

From (5.14), and using (5.13), we infer that for large MN, \({\tilde{\Delta }} \) behaves, schematically, as \({\tilde{\Delta }} \sim M + N\), and hence becomes large. Parametrizing the Ford circle \(\Gamma _{\sigma }\) in (5.12) by

$$\begin{aligned} \sigma (\theta ) = -\frac{\delta }{\gamma }+\frac{i}{\gamma ^2}\left( \frac{1+e^{i\theta }}{2} \right) \end{aligned}$$
(5.19)

or, equivalently, by

$$\begin{aligned} \sigma _1(\theta ) = -\frac{\delta }{\gamma }-\frac{1}{\gamma ^2}\frac{\sin \theta }{2}, \hspace{4mm} \sigma _2(\theta ) = \frac{1}{\gamma ^2}\frac{1+\cos \theta }{2}, \end{aligned}$$
(5.20)

where \(\theta \in [0,\pi ) \cup (\pi , 2 \pi )\), we infer that on the contour \(\Gamma _{\sigma }\),

$$\begin{aligned} \Big \vert e^{-2\pi i \left[ \frac{{\tilde{\Delta }}}{4m}\frac{1}{\gamma }\frac{1}{\gamma \sigma +\delta } +\frac{{\Delta }}{4m}\frac{\gamma \sigma +\delta }{\gamma } \right] } \Big \vert \le e^{- \frac{2 \pi }{4m} {{{\tilde{\Delta }}}} + \frac{2 \pi }{4m \gamma ^2 } \Delta }. \end{aligned}$$
(5.21)

Since \(d(M) \, d(N) \, e^{- \frac{2 \pi }{4\,m} {{{\tilde{\Delta }}}}} \) is exponentially suppressed for large MN, the sum over MN in (5.12) is uniformly convergent on \(\Gamma \) by the Weierstrass M test, and since each summand is integrable, we conclude that interchanging the integration with the summation over MN is justified also when \({\tilde{\Delta }} >0 \).

Thus, interchanging the integration with the summation over MN results in

$$\begin{aligned} \begin{aligned}&(-1)^{\ell +1} \sum _{\begin{array}{c} P\\ b \in {\mathbb {Z}}/a{\mathbb {Z}} \end{array}} \;\; \sum _{\begin{array}{c} M,N\ge -1 \\ -m < a^2M - c^2N \le m \\ L\in {\mathbb {Z}} \end{array}} L \, d(M) \, d(N) \, e^{2\pi i \left( \frac{\alpha }{\gamma }\frac{{\tilde{\Delta }}}{4m}+ \frac{\delta }{\gamma }\frac{\Delta }{4m} \right) } \,\psi (\Gamma )_{{\tilde{\ell }}\ell } \\&\quad \int \limits _{\Gamma _{\sigma }} \textrm{d} \sigma \; {(\gamma \sigma +\delta )^{21/2}} \, e^{-2\pi i \left( \frac{{\tilde{\Delta }}}{4m}\frac{1}{\gamma }\frac{1}{\gamma \sigma +\delta } +\frac{{\Delta }}{4m}\frac{\gamma \sigma +\delta }{\gamma } \right) } . \end{aligned} \end{aligned}$$
(5.22)

5.2.1 Bessel Integral

We perform the \(\sigma \)-integration over the Ford circle \(\Gamma _{\sigma }\) that skirts the point \(- \delta /\gamma \). This Ford circle has radius \(1/(2 \gamma ^2)\), is centred at \(\sigma = - \frac{\delta }{\gamma } + i \frac{1}{2 \gamma ^2}\),

$$\begin{aligned} \Gamma _{\sigma }: \vert \sigma + \frac{\delta }{\gamma } - i \frac{1}{2 \gamma ^2} \vert = \frac{1}{4\gamma ^4} , \end{aligned}$$
(5.23)

and is oriented counter clockwise. Then, (5.22) becomes replaced by

$$\begin{aligned} \begin{aligned}&(-1)^{\ell + 1} \sum _{\begin{array}{c} P' \\ b \in {\mathbb {Z}}/a {\mathbb {Z}} \end{array}} \;\; \sum _{\begin{array}{c} M,N\ge -1 \\ -m < a^2M - c^2N \le m \\ L\in {\mathbb {Z}} \end{array}} L \, d(M) \, d(N) \, e^{2\pi i \left( \frac{\alpha }{\gamma }\frac{{\tilde{\Delta }}}{4m}+ \frac{\delta }{\gamma }\frac{\Delta }{4m} \right) } \, \psi (\Gamma )_{{\tilde{\ell }}\ell }\\&\quad \int \limits _{\Gamma _{\sigma }} \textrm{d} \sigma {(\gamma \sigma +\delta )^{21/2}} \, e^{-2\pi i \left( \frac{{\tilde{\Delta }}}{4m}\frac{1}{\gamma }\frac{1}{\gamma \sigma +\delta } +\frac{{\Delta }}{4m}\frac{\gamma \sigma +\delta }{\gamma } \right) } , \end{aligned} \end{aligned}$$
(5.24)

where \(P'\) denotes the set P, but with \(\delta \) restricted to lie in the range \(0 \le -\delta < \gamma \). We change the integration variable to

$$\begin{aligned} {{{\tilde{\sigma }}}} = \gamma \left( \gamma \sigma + \delta \right) . \end{aligned}$$
(5.25)

The essential singularity is now located at the origin \({{{\tilde{\sigma }}}} = 0\). We choose the branch cut, which originates at \({{{\tilde{\sigma }}}} = 0\), to lie along the negative imaginary axis of the \({\hat{\sigma }}\)-plane. Next, we change the integration variable once more,

$$\begin{aligned} w = \frac{\gamma }{\Delta } \frac{i}{{{\tilde{\sigma }}}} . \end{aligned}$$
(5.26)

Now the branch cut originates at \(w = 0\) and lies along the negative real axis of the w-plane. The integration contour now runs along a line parallel to the imaginary axis,

$$\begin{aligned} - \frac{i^{23/2}}{\gamma \, \Delta ^{23/2}} \int \limits _{{{{\tilde{\epsilon }}}}-i\infty }^{{{{\tilde{\epsilon }}}}+i \infty } \frac{d w}{w^{25/2}} \; e^{2\pi \left( - \frac{{\tilde{\Delta }} \Delta }{4m \gamma } w +\frac{{1}}{4m \gamma \; w} \right) } \end{aligned}$$
(5.27)

with \({{{\tilde{\epsilon }}}} >0\). Now recall that \(\Delta >0\). When \({{{\tilde{\Delta }}} } \ge 0\), the coefficient \({{\tilde{\Delta }} \Delta } / (4m \gamma )\) in the exponent is \(\ge 0\), and hence the integration contour can be closed in the half plane \(\textrm{Re} \, w > 0\), where the integrand is analytic and hence the integral vanishes. Thus, we now take \({{{\tilde{\Delta }}}} < 0\).

Then, performing the redefinition

$$\begin{aligned} t = \frac{\pi |{{{\tilde{\Delta }}}}| \Delta }{2 m \gamma } \, w \; \end{aligned}$$
(5.28)

and defining \(z = \frac{\pi }{m\gamma }\sqrt{|{{\tilde{\Delta }}}|\Delta }\), we obtain for integral (5.27), with \(\epsilon > 0\),

$$\begin{aligned}{} & {} - \frac{i^{23/2}}{\gamma } \left( \frac{ \pi {|{{\tilde{\Delta }}}}| }{ 2 m \gamma } \right) ^{23/2} \ \int \limits _{ \epsilon -i\infty }^{\epsilon +i \infty } \frac{\textrm{d} t }{t^{25/2}} \; e^{ t + \frac{z^2}{4 t} }\nonumber \\{} & {} \qquad = - 2 \pi \, \frac{i^{1/2}}{\gamma } \left( \frac{|{{{\tilde{\Delta }}}} |}{\Delta } \right) ^{23/4} \, I_{23/2} \left( \frac{\pi }{m \gamma } \, \sqrt{ {|{{\tilde{\Delta }}}}| \Delta } \right) , \end{aligned}$$
(5.29)

where \(I_\nu (z)\) denotes the modified Bessel function of first kind of index \(\nu \),

$$\begin{aligned} I_\nu (z) = \frac{(\frac{1}{2}z)^\nu }{2\pi i }\int \limits _{\epsilon -i\infty }^{\epsilon +i \infty } \textrm{d} t \,\,t^{-\nu -1} e^{t + (z^2/4 t)}, \end{aligned}$$
(5.30)

where \(\epsilon > 0\). Then, (5.22) becomes

$$\begin{aligned}{} & {} (-1)^{\ell } \, i^{1/2} \, 2 \pi \sum _{\begin{array}{c} P' \\ b \in {\mathbb {Z}}/a {\mathbb {Z}} \end{array}} \;\;\; \sum _{\begin{array}{c} M,N\ge -1 \\ -m< a^2M - c^2N \le m \\ L\in {\mathbb {Z}}, \; {{{\tilde{\Delta }}}} < 0 \end{array}}\nonumber \\{} & {} \quad \psi (\Gamma )_{{\tilde{\ell }}\ell } \; L \, d(M) \, d(N) \, \frac{ e^{2\pi i \left( \frac{\alpha }{\gamma }\frac{{\tilde{\Delta }}}{4m}+ \frac{\delta }{\gamma }\frac{\Delta }{4m} \right) }}{\gamma } \left( \frac{|{{{\tilde{\Delta }}}} |}{\Delta } \right) ^{23/4} \,\nonumber \\{} & {} \quad I_{23/2} \left( \frac{\pi }{m \gamma } \, \sqrt{ {|{{\tilde{\Delta }}}}| \Delta } \right) . \end{aligned}$$
(5.31)

Note that in (5.31) the dependence on \(\alpha \) and \(\delta \) is entirely encoded in multiplier system \(\psi (\Gamma )_{{\tilde{\ell }}\ell }\) and in the phase

$$\begin{aligned} e^{2\pi i \left( \frac{\alpha }{\gamma }\frac{{\tilde{\Delta }}}{4m}+ \frac{\delta }{\gamma }\frac{\Delta }{4m} \right) }. \end{aligned}$$
(5.32)

Since \(0\le - \delta < \gamma \) and \(\alpha \in {\mathbb {Z}}/\gamma {\mathbb {Z}}\), and since \(\alpha \) is the modular inverse of \(\delta \), i.e. \(\alpha \delta = 1 \text { mod } \gamma \), each \(\delta \) uniquely specifies one \(\alpha \). Thus, the sum over \(\delta \) yields the generalized Kloosterman sum \(\textrm{Kl}( \frac{\Delta }{4\,m}, \frac{{\tilde{\Delta }}}{4\,m};\gamma ,\psi )_{\ell {\tilde{\ell }}}\),

$$\begin{aligned} \textrm{Kl} \left( \frac{\Delta }{4m}, \frac{{\tilde{\Delta }}}{4m};\gamma ,\psi \right) _{\ell {\tilde{\ell }}} = \sum _{\begin{array}{c} 0\le -\delta <\gamma \\ (\delta ,\gamma )=1, \alpha \delta = 1 \text { mod } \gamma \end{array}}e^{2\pi i \left( \frac{\alpha }{\gamma }\frac{{\tilde{\Delta }}}{4m} +\frac{\delta }{\gamma }\frac{\Delta }{4m}\right) }\psi (\Gamma )_{{\tilde{\ell }}\ell }. \qquad \end{aligned}$$
(5.33)

Thus, (5.31) can be written as

$$\begin{aligned}&(-1)^{\ell } i^{1/2} \, 2 \pi \sum _{\gamma =1}^{\infty } \; \sum _{\begin{array}{c} S_G \\ b \in {\mathbb {Z}}/a {\mathbb {Z}} \end{array}} \;\; \sum _{\begin{array}{c} M, N \ge -1 \\ -m< a^2M - c^2N \le m \\ L \in {\mathbb {Z}}, \, {\tilde{\Delta }}<0 \end{array}} L \, d(M)d(N) \; \frac{\textrm{Kl}(\frac{\Delta }{4m} \frac{{\tilde{\Delta }}}{4m},\gamma ,\psi )_{\ell {\tilde{\ell }}}}{\gamma } \nonumber \\&\quad \left( \frac{ \vert {\tilde{\Delta }} \vert }{\Delta } \right) ^{23/4} I_{23/2}\left( \frac{\pi }{\gamma m}\sqrt{\Delta \vert {\tilde{\Delta }}\vert } \right) , \end{aligned}$$
(5.34)

where \({\tilde{\Delta }} = 4 M N - L^2\), with L given in (4.13). Note that the sum over the allowed MN is finite.

Next, using (4.17), we express the triplet (NLM) in terms of the triplet \(({{{\tilde{n}}}}, m, {{{\tilde{\ell }}}})\). We then trade the sum over MN for a sum over \({{{\tilde{n}}}}, {{{\tilde{\ell }}}}\). In Sect. 5.3 we will show that \({{{\tilde{n}}}}\) is bounded by \({{{\tilde{n}}}} \ge -1\). Writing \({{{\tilde{\Delta }}}}\) as \({\tilde{\Delta }} = 4\,m {{{\tilde{n}}}} - \ell ^2\), we rewrite (5.34) as

$$\begin{aligned}&(-1)^{\ell } i^{1/2} \, 2 \pi \sum _{\gamma =1}^{\infty } \; \sum _{\begin{array}{c} {{{\tilde{n}}}} \ge -1 \\ {{{\tilde{\ell }}}} \in {\mathbb {Z}}/2m {\mathbb {Z}} \\ {{{\tilde{\Delta }}}}< 0 \end{array}}\;\; \sum _{\begin{array}{c} a>0, c<0 \\ b \in {\mathbb {Z}}/ a {\mathbb {Z}}, \; a d - b c = 1 \\ 0 \le \frac{b}{a} + \frac{{{\tilde{\ell }}}}{2m} < - \frac{1}{ac } \end{array}} \nonumber \\&\qquad \left( (ad + bc ) {{{\tilde{\ell }}}} + 2 ac {{{\tilde{n}}}} + 2 bd m \right) d( c^2 {{{\tilde{n}}}} + d^2 m + cd {{{\tilde{\ell }}}}) \, d(a^2 {{{\tilde{n}}}} + b^2 m + ab {{{\tilde{\ell }}}}) \nonumber \\&\qquad \frac{\textrm{Kl}(\frac{\Delta }{4m} \frac{{\tilde{\Delta }}}{4m},\gamma ,\psi )_{\ell {\tilde{\ell }}}}{\gamma } \left( \frac{ \vert {\tilde{\Delta }} \vert }{\Delta } \right) ^{23/4} I_{23/2}\left( \frac{\pi }{\gamma m}\sqrt{\Delta \vert {\tilde{\Delta }}\vert } \right) , \end{aligned}$$
(5.35)

which we write as

$$\begin{aligned} (-1)^{\ell } i^{1/2} \, 2 \pi \sum _{\gamma =1}^{\infty } \; \sum _{\begin{array}{c} {{{\tilde{n}}}} \ge -1 \\ {{{\tilde{\ell }}}} \in {\mathbb {Z}}/2m {\mathbb {Z}} \\ {{{\tilde{\Delta }}}} < 0 \end{array}} \;\; c_m^F({\tilde{n}},{\tilde{\ell }}) \, \frac{\textrm{Kl}(\frac{\Delta }{4m} \, \frac{{\tilde{\Delta }}}{4m},\gamma ,\psi )_{\ell {\tilde{\ell }}}}{\gamma } \left( \frac{ \vert {\tilde{\Delta }} \vert }{\Delta } \right) ^{23/4} I_{23/2}\left( \frac{\pi }{\gamma m}\sqrt{\Delta \vert {\tilde{\Delta }}\vert } \right) ,\nonumber \\ \end{aligned}$$
(5.36)

where \(c_m^F({\tilde{n}},{\tilde{\ell }}) \) is defined by

$$\begin{aligned} c_m^F({\tilde{n}},{\tilde{\ell }})= & {} \sum _{\begin{array}{c} a>0, c<0 \\ b \in {\mathbb {Z}}/ a {\mathbb {Z}}, \; a d - b c = 1 \\ 0 \le \frac{b}{a} + \frac{{{\tilde{\ell }}}}{2m} < - \frac{1}{ac } \end{array}} \left( (ad + bc ) {{{\tilde{\ell }}}} + 2 ac {{{\tilde{n}}}} + 2 bd m \right) \nonumber \\{} & {} \, d( c^2 {{{\tilde{n}}}} + d^2 m + cd {{{\tilde{\ell }}}}) \, d(a^2 {{{\tilde{n}}}} + b^2 m + ab {{{\tilde{\ell }}}}). \end{aligned}$$
(5.37)

Note that the above sum includes two subsets of matrices in \(S_G\). The first subset contains matrices satisfying \({\tilde{\ell }}/2\,m=-b/a\), while the second subset contains matrices that correspond to the continued fraction expansion of \({\tilde{\ell }}/2\,m\). The latter subset is finite by definition, while the bounds \(M,N \ge -1\) and (5.13) can be used to show the finiteness of the first subset. This is consistent with the proofs of finiteness of [9, 10].

5.3 Lower Bound on \({\tilde{n}}\)

We next show that \({\tilde{n}} \ge -1\) whenever the condition

$$\begin{aligned} 0 \le \frac{b}{a} + \frac{{{\tilde{\ell }}}}{2m} < - \frac{1}{ac} \end{aligned}$$
(5.38)

is true. To this end, we first recall that (5.38) can be written as

$$\begin{aligned} -m < a^2 M - c^2 N \le m. \end{aligned}$$
(5.39)

and further \(M, N \ge -1\). Then beginning with

$$\begin{aligned} {{{\tilde{n}}}} = \frac{bd}{ac} m - \frac{b}{c} M + \frac{d}{a} N, \end{aligned}$$
(5.40)

we study three cases:

  1. 1.

    \(d=0\): Then, (5.40) becomes

    $$\begin{aligned} {{{\tilde{n}}}} = - \frac{b}{c} M = \frac{M}{c^2}, \end{aligned}$$
    (5.41)

    which satisfies \({{{\tilde{n}}}} \ge -1\), since \(M \ge -1\) and \(c^2 \ge 1\).

  2. 2.

    \(bc<0\): In this case, we obtain,

    $$\begin{aligned} (ac)^2 {{{\tilde{n}}}}= & {} a b c d m - b c a^2 M + d a c^2 N \nonumber \\= & {} a b c d m + c^2 N - b c (a^2 M - c^2 N ) \nonumber \\= & {} a b c d m + c^2 N + | b c | (a^2 M - c^2 N ). \end{aligned}$$
    (5.42)

    Using the lower bound in (5.39), we get,

    $$\begin{aligned} (ac)^2 {{{\tilde{n}}}} > a b c d m + c^2 N - | b c | m= & {} c^2 N + m b c \left( a d + 1 \right) \nonumber \\= & {} c^2 N + m \left( (a d)^2 - 1 \right) \ge c^2 N, \end{aligned}$$
    (5.43)

    Since \((ad)^2 \ge 1\),

    $$\begin{aligned} {\tilde{n}} > \frac{N}{a^2} \ge -1. \end{aligned}$$
    (5.44)
  3. 3.

    \(bc \ge 0\): Here we have, using the upper bound in (5.39),

    $$\begin{aligned} (ac)^2 {{{\tilde{n}}}}= & {} a b c d m - b c a^2 M + d a c^2 N \nonumber \\= & {} a b c d m + c^2 N - b c (a^2 M - c^2 N ) \nonumber \\\ge & {} a b c d m + c^2 N - b c m \nonumber \\= & {} c^2 N + b c m (a d -1) = c^2 N + (b c)^2 m \ge c^2 N. \end{aligned}$$
    (5.45)

    Hence,

    $$\begin{aligned} {\tilde{n}} \ge \frac{N}{a^2} \ge -1. \end{aligned}$$
    (5.46)

5.4 Bessel Function \(I_{12}\)

Now we focus on the terms \(E_{m,\gamma (\gamma \sigma + \delta )}\) in decompositions (4.42), (4.43) and (4.46). In Sect. 5.5, we will show that these terms only give a non-vanishing contribution when \(X Y \ne 0\), whereas when \(X Y =0\) they cancel out. Thus, we will assume \(X Y \ne 0\) in the following.

We proceed as in Sect. 5.2.1, namely, we restrict the sum over \(\delta \) to the range \(0 \le -\delta < \gamma \) and perform the integration over the Ford circle \(\Gamma _{\sigma }\) in (5.23). Collecting the terms proportional \(E_{m,\gamma (\gamma \sigma + \delta )}\) in (5.11), and changing the integration variable to \({{{\tilde{\sigma }}}}\) given in (5.25), we obtain

$$\begin{aligned} \begin{aligned}&(-1)^{\ell +1}\sum _{P_{0}} \, \textrm{Kl} ( \frac{\Delta }{4m}, \frac{{\tilde{\Delta }}}{4m};\gamma ,\psi )_{\ell {\tilde{\ell }}} \; L \, d(M) \, d(N) \; \int \limits _{{{\tilde{\Gamma }}}} \textrm{d}{\tilde{\sigma }} \;\frac{{{\tilde{\sigma }}^{21/2}}}{\gamma ^{25/2}}\, e^{\left( -2\pi i \left[ \frac{{\tilde{\Delta }}}{4m}\frac{1}{{\tilde{\sigma }}} +\frac{{\Delta }}{4m}\frac{{\tilde{\sigma }}}{\gamma ^2} \right] \right) } \\&\quad \frac{1}{2}\left( E_{m,{\tilde{\sigma }}}\left( \frac{b}{a}+\frac{{\tilde{\ell }}}{2m}\right) +E_{m,{\tilde{\sigma }}}\left( -\frac{b}{a}-\frac{1}{ac}-\frac{{\tilde{\ell }}}{2m}\right) \right) , \end{aligned}\nonumber \\ \end{aligned}$$
(5.47)

where L and \({{{\tilde{\ell }}}}\) are given in (4.13), and where the generalized Kloosterman sum \(\textrm{Kl} ( \frac{\Delta }{4\,m}, \frac{{\tilde{\Delta }}}{4\,m};\gamma ,\psi )_{\ell {\tilde{\ell }}}\) is given in (5.33). The set \(P_0\) is given by

$$\begin{aligned} {P}_0 = \left\{ \begin{pmatrix} a &{} b \\ c&{}d \end{pmatrix} \in \textrm{SL}(2,{\mathbb {Z}}), M, N, \gamma \in {\mathbb {Z}} \; \vert a,\gamma >0, c<0, M \ge -1, N \ge -1, L \in {\mathbb {Z}}, X Y \ne 0 \right\} .\nonumber \\ \end{aligned}$$
(5.48)

The integration contour \({{{\tilde{\Gamma }}}}\) denotes a Ford circle centred at \({{{\tilde{\sigma }}}} = i/2\) that skirts the origin \({\tilde{\sigma }} =0\).

Using symmetry property (4.54), we write (5.47) as

$$\begin{aligned} \begin{aligned}&(-1)^{\ell +1}\sum _{P_{0}} \, \left[ \textrm{Kl} ( \frac{\Delta }{4m}, \frac{{\tilde{\Delta }}}{4m};\gamma ,\psi )_{\ell {\tilde{\ell }}} + \textrm{Kl} ( \frac{\Delta }{4m}, \frac{{\tilde{\Delta }}}{4m};\gamma ,\psi )_{\ell ( - {\tilde{\ell }}) } \right] \; L \, d(M) \, d(N) \; \\&\quad \int \limits _{{{\tilde{\Gamma }}}} \textrm{d}{\tilde{\sigma }} \;\frac{{{\tilde{\sigma }}^{21/2}}}{\gamma ^{25/2}}\, e^{\left( -2\pi i \left[ \frac{{\tilde{\Delta }}}{4m}\frac{1}{{\tilde{\sigma }}} +\frac{{\Delta }}{4m}\frac{{\tilde{\sigma }}}{\gamma ^2} \right] \right) } \; \frac{1}{2} E_{m,{\tilde{\sigma }}}\left( \frac{b}{a}+\frac{{\tilde{\ell }}}{2m}\right) . \end{aligned} \end{aligned}$$
(5.49)

Using the expression for \(E_{m,{\tilde{\sigma }}}\) given in (4.38) and the relation

$$\begin{aligned} \frac{{\tilde{\Delta }}}{4m}+m\left( \frac{b}{a}+\frac{{\tilde{\ell }}}{2m}\right) ^2 = \frac{N}{a^2} , \end{aligned}$$
(5.50)

we obtain

$$\begin{aligned} \begin{aligned}&(-1)^{\ell }\sum _{P_{0}} \, \left[ \textrm{Kl} ( \frac{\Delta }{4m}, \frac{{\tilde{\Delta }}}{4m};\gamma ,\psi )_{\ell {\tilde{\ell }}} + \textrm{Kl} ( \frac{\Delta }{4m}, \frac{{\tilde{\Delta }}}{4m};\gamma ,\psi )_{\ell ( - {\tilde{\ell }}) } \right] \, \frac{L}{\left( \frac{b}{a}+\frac{{\tilde{\ell }}}{2m} \right) } \, d(M) \, d(N) \\&\quad \int \limits _{{{\tilde{\Gamma }}}} \textrm{d}{\tilde{\sigma }} \;\frac{{{\tilde{\sigma }}^{11}}}{\gamma ^{25/2}}\frac{1}{\sqrt{8\pi ^2i m}}\, e^{-2\pi i \left( \frac{{\Delta }}{4m} \frac{{\tilde{\sigma }}}{\gamma ^2} + \frac{N}{a^2} \frac{1}{{\tilde{\sigma }}} \right) }. \end{aligned} \end{aligned}$$
(5.51)

Note that the integrand does not exhibit a branch cut. Performing the variable change given in (5.26), the integral over the Ford circle \({{\tilde{\Gamma }}}\) takes a form similar to (5.27), with \({{{\tilde{\Delta }}}}/4m\) replaced by \(N/a^2\). The integral will be non-vanishing provided \(N/a^2 <0\). This in turn implies \(N=-1\). As shown in Sect. 5.5, the only contributions to the sum come from the terms in set the \(P_0\) satisfying \(a=1\) and \(M=m\). Using the expression for L and \({{{\tilde{\ell }}}}\) given in (4.13), we infer that in this case,

$$\begin{aligned} \frac{b}{a}+\frac{{\tilde{\ell }}}{2m} = \frac{c}{2m} \;\;,\;\;\; L = -c>0, \end{aligned}$$
(5.52)

in which case

$$\begin{aligned} \frac{L}{\frac{b}{a}+\frac{{\tilde{\ell }}}{2m}} = -2m, \end{aligned}$$
(5.53)

so that (5.51) yields (using \(d(-1) = 1\))

$$\begin{aligned} \begin{aligned}&(-1)^{\ell +1}\sum _{P_{0}'} \left[ \textrm{Kl} ( \frac{\Delta }{4m}, \frac{{\tilde{\Delta }}}{4m};\gamma ,\psi )_{\ell {\tilde{\ell }}} + \textrm{Kl} ( \frac{\Delta }{4m}, \frac{{\tilde{\Delta }}}{4m};\gamma ,\psi )_{\ell ( - {\tilde{\ell }}) } \right] \; d(m) \\&\quad \int \limits _{{{\tilde{\Gamma }}}} \textrm{d}{\tilde{\sigma }} \;\frac{{{\tilde{\sigma }}^{11}}}{\gamma ^{25/2}}\sqrt{\frac{m}{2\pi ^2i}}\, e^{-2\pi i \left( \frac{{\Delta }}{4m}\frac{{\tilde{\sigma }}}{\gamma ^2} - \frac{1}{{\tilde{\sigma }}} \right) }, \end{aligned} \end{aligned}$$
(5.54)

where the set \(P_{0}'\) is the set \(P_0\) subject to the restrictions \(a=1,N=-1,M=m\).

From (5.52) we infer

$$\begin{aligned} {\tilde{\Delta }} = 4MN-L^2 = -4m-c^2 , \end{aligned}$$
(5.55)

in which case

$$\begin{aligned} \frac{{\tilde{\Delta }}}{4m} = -1-\frac{c^2}{4m}. \end{aligned}$$
(5.56)

Using (5.52), we can write the Kloosterman sums in (5.54) as (recall that \(b \in {\mathbb {Z}}/a{\mathbb {Z}} \) with \(a=1\) fixes b to a single value)

$$\begin{aligned} (-1)^{\ell +1} \sum _{\begin{array}{c} c<0 \end{array}} \;\; \sum _{\begin{array}{c} 0\le -\delta <\gamma \\ (\delta ,\gamma )=1, \alpha \delta = 1 \text { mod } \gamma \end{array}}e^{2\pi i \left( \frac{\alpha }{\gamma }\frac{{\tilde{\Delta }}}{4m} +\frac{\delta }{\gamma }\frac{\Delta }{4m}\right) } \left( \psi (\Gamma )_{(c - 2m b) {\ell }} + \psi (\Gamma )_{(- c + 2mb) {\ell }} \right) . \nonumber \\ \end{aligned}$$
(5.57)

Using

$$\begin{aligned} \sum _{\begin{array}{c} c<0 \end{array}} f(c ) = \sum _{j \in {\mathbb {Z}}/2m{\mathbb {Z}}} \;\; \sum _{\begin{array}{c} c < 0 \\ c = j \; \text {mod} \; 2m \end{array}} \, f(c) . \end{aligned}$$
(5.58)

and using the multiplier system property \(\psi (\Gamma )_{(j + 2\,m k) {\ell }} = \psi (\Gamma )_{j {\ell }}\) (with \(k \in {\mathbb {Z}}\)) [20], we write (5.57) as

$$\begin{aligned} (-1)^{\ell +1} \sum _{j \in {\mathbb {Z}}/2m{\mathbb {Z}}}\sum _{\begin{array}{c} c<0\\ c = j \text { mod } 2m \end{array}}\sum _{\begin{array}{c} 0\le -\delta <\gamma \\ (\delta ,\gamma )=1, \alpha \delta = 1 \text { mod } \gamma \end{array}}e^{2\pi i \left( \frac{\alpha }{\gamma }\frac{{\tilde{\Delta }}}{4m} +\frac{\delta }{\gamma }\frac{\Delta }{4m}\right) } \left( \psi (\Gamma )_{j {\ell }}+ \psi (\Gamma )_{(-j) {\ell }} \right) . \nonumber \\ \end{aligned}$$
(5.59)

Using (5.56), this becomes

$$\begin{aligned}{} & {} (-1)^{\ell +1} \sum _{j \in {\mathbb {Z}}/2m{\mathbb {Z}}}\sum _{\begin{array}{c} c<0\\ c = j \text { mod } 2m \end{array}}\sum _{\begin{array}{c} 0\le -\delta <\gamma \\ (\delta ,\gamma )=1, \alpha \delta = 1 \text { mod } \gamma \end{array}} e^{-2\pi i \frac{\alpha }{\gamma }\frac{c^2}{4m}} \, e^{2\pi i \left( - \frac{\alpha }{\gamma } +\frac{\delta }{\gamma }\frac{\Delta }{4m}\right) }\nonumber \\{} & {} \qquad \left( \psi (\Gamma )_{j {\ell }}+ \psi (\Gamma )_{(-j) {\ell }} \right) . \end{aligned}$$
(5.60)

Next we focus on the sum over c in this expression,

$$\begin{aligned} \sum _{j \in {\mathbb {Z}}/2m{\mathbb {Z}}}\sum _{\begin{array}{c} c<0\\ c = j \text { mod } 2m \end{array}} e^{-2\pi i \frac{\alpha }{\gamma }\frac{c^2}{4m}} \left( \psi (\Gamma )_{j {\ell }} + \psi (\Gamma )_{(-j) {\ell }}\right) , \end{aligned}$$
(5.61)

which we write as

$$\begin{aligned} \frac{1}{2} \sum _{j \in {\mathbb {Z}}/2m{\mathbb {Z}}}\sum _{\begin{array}{c} c \in {\mathbb {Z}} \backslash \{0\} \\ c = j \text { mod } 2m \end{array}} e^{-2\pi i \frac{\alpha }{\gamma }\frac{c^2}{4m}} \left( \psi (\Gamma )_{j {\ell }} + \psi (\Gamma )_{(-j) {\ell }} \right) , \end{aligned}$$
(5.62)

where we made use of the symmetry \(j \rightarrow - j\) to obtain an expression with the symmetry \(c \rightarrow -c\).

Expression (5.62) is divergent. Below we will discuss a regularization procedure to extract a finite part of this expression.

5.4.1 Regularization

We now regard the sum over \(c \in {\mathbb {Z}} \backslash \{0\} \) in (5.62),

$$\begin{aligned} \sum _{\begin{array}{c} c \in {\mathbb {Z}} \backslash \{0\} \\ c = j \text { mod } 2m \end{array}} e^{-2\pi i \frac{\alpha }{\gamma }\frac{c^2}{4m}}, \end{aligned}$$
(5.63)

as

$$\begin{aligned} \lim _{\tau \rightarrow -\alpha /\gamma } \left( \vartheta _{m,j}(\tau )-\delta _{0,j} \right) , \end{aligned}$$
(5.64)

where \( \vartheta _{m,j}(\tau ) \) denotes the standard weight 1/2 index m Jacobi theta function. Using this, we then regard (5.62) as

$$\begin{aligned} \frac{1}{2} \lim _{\tau \rightarrow -\alpha /\gamma } \sum _{j \in {\mathbb {Z}}/2m{\mathbb {Z}}} \left( \vartheta _{m,j}(\tau )-\delta _{0,j} \right) \left( \psi (\Gamma )_{j {\ell }} + \psi (\Gamma )_{(-j) {\ell }} \right) . \end{aligned}$$
(5.65)

We focus on the combination

$$\begin{aligned} \sum _{j \in {\mathbb {Z}}/2m{\mathbb {Z}}} \left( \vartheta _{m,j}(\tau )-\delta _{0,j} \right) \psi (\Gamma )_{j {\ell }}, \end{aligned}$$
(5.66)

which is one of the combinations contained in (5.65). Using that \(\psi (\Gamma )_{j {\ell }}\) are the components of a unitary matrix, i.e.

$$\begin{aligned} \psi (\Gamma ) = \overline{\left( \psi (\Gamma ^{-1}) \right) ^T}, \end{aligned}$$
(5.67)

we infer the property

$$\begin{aligned} \psi (\Gamma )_{j {\ell }} = \psi ({{{\tilde{\Gamma }}}})_{{\ell } j}, \end{aligned}$$
(5.68)

where

$$\begin{aligned} \Gamma = \begin{pmatrix} \alpha &{} \beta \\ \gamma &{} \delta \end{pmatrix} \quad , \quad {{{\tilde{\Gamma }}}} = \begin{pmatrix} \delta &{} \beta \\ \gamma &{} \alpha \end{pmatrix} \,. \end{aligned}$$
(5.69)

Now we recall the transformation property under \(\textrm{SL}(2,{\mathbb {Z}})\) transformations,

$$\begin{aligned} \vartheta _{m, \ell }\left( \frac{\alpha \tau +\beta }{\gamma \tau +\delta }, \frac{v}{\gamma \tau +\delta } \right) = (\gamma \tau +\delta )^{1/2}e^{2\pi i m \frac{\gamma v^2}{\gamma \tau +\delta }} \sum _{j\in {\mathbb {Z}}/2m{\mathbb {Z}}} \psi (\Gamma )_{\ell j}\;\vartheta _{m,j}(\tau ,v).\nonumber \\ \end{aligned}$$
(5.70)

Setting \(v=0\) and choosing the \(\textrm{SL}(2,{\mathbb {Z}})\) transformation \({{{\tilde{\Gamma }}}}\), this becomes

$$\begin{aligned} \vartheta _{m,\ell }\left( \frac{\delta \tau +\beta }{\gamma \tau +\alpha } \right) = (\gamma \tau +\alpha )^{1/2} \sum _{j\in {\mathbb {Z}}/2m{\mathbb {Z}}} \psi ({{{\tilde{\Gamma }}}})_{\ell j}\;\vartheta _{m,j}(\tau ). \end{aligned}$$
(5.71)

Then, by combining (5.66) with (5.68) and (5.71), we obtain

$$\begin{aligned} \sum _{j \in {\mathbb {Z}}/2m{\mathbb {Z}}} \left( \vartheta _{m,j}(\tau )-\delta _{0,j} \right) \psi (\Gamma )_{j {\ell }} = (\gamma \tau +\alpha )^{-1/2} \, \vartheta _{m,\ell }\left( \frac{\delta \tau +\beta }{\gamma \tau +\alpha } \right) - \psi (\Gamma )_{0 {\ell }}.\qquad \end{aligned}$$
(5.72)

Now we study this equation in the limit \(\tau \rightarrow -\alpha /\gamma \). Using

$$\begin{aligned} \lim _{\tau \rightarrow +i\infty } \vartheta _{m,\ell }(\tau ) = {\left\{ \begin{array}{ll} 0 \;\; \text {for }\ell \ne 0 \mod 2m, \\ 1 \;\; \text {for }\ell = 0 \mod 2m, \\ \end{array}\right. } \end{aligned}$$
(5.73)

we infer that in the limit \(\tau \rightarrow -\alpha /\gamma \), the right-hand side of (5.72) tends to \(- \psi (\Gamma )_{0 {\ell }}\) when \(\ell \ne 0\), whereas when \(\ell = 0\) it diverges and behaves as \((\gamma \tau +\alpha )^{-1/2} - \psi (\Gamma )_{0 0}\). We note that the divergent term \((\gamma \tau +\alpha )^{-1/2}\) that arises when \(\ell =0\), is due to the presence of a constant term in \(\vartheta _{m,0}(\tau )\). Then, by subtracting this constant term we obtain the following regularized expression,

$$\begin{aligned} \left( \lim _{\tau \rightarrow -\alpha /\gamma } \sum _{j \in {\mathbb {Z}}/2m{\mathbb {Z}}} \left( \vartheta _{m,j}(\tau )-\delta _{0,j} \right) \psi (\Gamma )_{j {\ell }} \right) \vert _{\text {regularized}} = - \psi (\Gamma )_{0 {\ell }}. \end{aligned}$$
(5.74)

A similar reasoning applies to the other combination, proportional to \(\psi (\Gamma )_{(-j) {\ell }}\), contained in (5.65).

Thus, we are led to the following regularized expression for (5.65),

$$\begin{aligned} \frac{1}{2} \lim _{\tau \rightarrow -\alpha /\gamma } \sum _{j \in {\mathbb {Z}}/2m{\mathbb {Z}}} \left( \vartheta _{m,j}(\tau )-\delta _{0,j} \right) \left( \psi (\Gamma )_{j {\ell }} + \psi (\Gamma )_{(-j) {\ell }} \right) = - \psi (\Gamma )_{0 {\ell }}.\nonumber \\ \end{aligned}$$
(5.75)

Using this in (5.60), we arrive at our proposal for the regularized expression for (5.60),

$$\begin{aligned} (-1)^{\ell } \sum _{\begin{array}{c} 0\le -\delta <\gamma \\ (\delta ,\gamma )=1, \alpha \delta = 1 \text { mod } \gamma \end{array}}e^{2\pi i \left( - \frac{\alpha }{\gamma } +\frac{\delta }{\gamma }\frac{\Delta }{4m}\right) } \psi (\Gamma )_{0 {\ell }} = (-1)^{\ell } \, \textrm{Kl} ( \frac{\Delta }{4m}, -1;\gamma ,\psi )_{\ell 0 } . \nonumber \\ \end{aligned}$$
(5.76)

To summarize, the regularization procedure described above removes one divergent contribution that arises when \(\ell =0\). At present we do not have neither a physics nor a mathematics justification for using precisely this regulator.

5.4.2 Bessel Integral

Now we return to (5.54), which we regularize using expression (5.76),

$$\begin{aligned} \begin{aligned} (-1)^{\ell } \; d(m) \, \sqrt{\frac{m}{2\pi ^2i}} \, \sum _{\gamma =1}^{\infty } \textrm{Kl} ( \frac{\Delta }{4m}, -1;\gamma ,\psi )_{\ell 0 } \, \int \limits _{{{\tilde{\Gamma }}}} d{\tilde{\sigma }} \;\frac{{{\tilde{\sigma }}^{11}}}{\gamma ^{25/2}} \, e^{-2\pi i \left( \frac{{\Delta }}{4m}\frac{{\tilde{\sigma }}}{\gamma ^2} - \frac{1}{{\tilde{\sigma }}} \right) }. \end{aligned}\nonumber \\ \end{aligned}$$
(5.77)

Changing the integration variable to

$$\begin{aligned} t = 2\pi \frac{i}{{\tilde{\sigma }}}, \end{aligned}$$
(5.78)

we get

$$\begin{aligned} \begin{aligned} (-1)^{\ell + 1 } \; d(m) \, \sqrt{\frac{m}{2\pi ^2i}} \, \frac{(2\pi )^{12}}{\gamma ^{25/2}} \, \sum _{\gamma =1}^{\infty } \textrm{Kl} ( \frac{\Delta }{4m}, -1;\gamma ,\psi )_{\ell 0 } \, \int \limits _{\epsilon -i\infty }^{\epsilon +i \infty } \textrm{d} t \frac{1}{t^{13}} \, e^{\frac{1}{4t}\left( \frac{2\pi \sqrt{\Delta }}{\gamma \sqrt{m}} \right) ^2+t} . \end{aligned}\nonumber \\ \end{aligned}$$
(5.79)

Using (5.30) we obtain,

$$\begin{aligned} (-1)^{\ell +1}\sqrt{2m}\,i^{1/2}\, d(m) \sum _{\gamma >0} \frac{\textrm{Kl} ( \frac{\Delta }{4m}, -1;\gamma ,\psi )_{\ell 0}}{\sqrt{\gamma }}\left( \frac{4m}{\Delta } \right) ^6 I_{12}\left( \frac{2\pi }{\gamma }\sqrt{\frac{\Delta }{m}} \right) .\nonumber \\ \end{aligned}$$
(5.80)

5.5 Isolating Non-vanishing Contributions

We return to (4.54) show that the sum exhibits cancellations between various terms, thereby identifying non-vanishing contributions. Taking into account the form of \( E_{m,\gamma (\gamma \sigma +\delta )} \left( X\right) \) and \(I_{m,\gamma (\gamma \sigma +\delta )}\left( X \right) \) given in (4.38) and (4.39), we write (4.54) as

$$\begin{aligned} \begin{aligned}&(-1)^{\ell +1} \sum _{\begin{array}{c} P\\ b \in {\mathbb {Z}}/a {\mathbb {Z}} \end{array}} \; {(\gamma \sigma +\delta )^{10}} \sum _{\begin{array}{c} M,N\ge -1\\ L\in {\mathbb {Z}}, \; X \ne 0 \end{array}} \frac{L}{X} \, d(M) \, d(N) \\&\quad e^{2\pi i \left( \frac{\alpha }{\gamma }\frac{{\tilde{\Delta }}}{4m}+ \frac{\delta }{\gamma }\frac{\Delta }{4m} \right) }\left( \psi (\Gamma )_{{\tilde{\ell }}\ell }+\psi (\Gamma )_{-{\tilde{\ell }}\ell }\right) e^{\left( -2\pi i \left[ \frac{{\tilde{\Delta }}}{4m}\frac{1}{\gamma }\frac{1}{\gamma \sigma +\delta } +\frac{{\Delta }}{4m}\frac{\gamma \sigma +\delta }{\gamma } \right] \right) } F_{{m,\gamma (\gamma \sigma +\delta )}}(X^2) , \end{aligned} \nonumber \\ \end{aligned}$$
(5.81)

where \(F_{m,\gamma (\gamma \sigma +\delta )}\) is a function that only depends on \(X^2\). Consider changing the variable \(\sigma \) to \({{{\tilde{\sigma }}}} = \gamma (\gamma \sigma + \delta )\), and integrating along a Ford circle \({{{\tilde{\Gamma }}}}\), centred at \({{{\tilde{\sigma }}}} = i/2\), that skirts the origin \({{{\tilde{\sigma }}}} =0\). Then, as described in Sect. 5.4, only when \(N=-1\) do we get a non-vanishing contribution. This was shown in Sect. 5.4 for the case of the contribution proportional to \( E_{m,\gamma (\gamma \sigma +\delta )} \left( X\right) \), but the same argument also applies to \(I_{m,\gamma (\gamma \sigma +\delta )}\left( X \right) \). Thus, in the following, we set \(N=-1\).

We evaluate

$$\begin{aligned} \frac{L}{X} =\frac{L}{\left( \frac{b}{a}+\frac{{\tilde{\ell }}}{2m}\right) }= 2m \frac{ \frac{m -a^2M}{c} +c }{\frac{m-a^2M}{c}-c}. \end{aligned}$$
(5.82)

We recall that the condition \(L\in {\mathbb {Z}}\) in (5.81) implies the divisibility condition \(ac \mid m -a^2\,M +c^2\). Hence, if we fix M and a, the sum over c runs only over those \(c<0\) that satisfy

$$\begin{aligned} c \mid m-a^2M. \end{aligned}$$
(5.83)

We now fix M and a. There are three cases to be considered. First, consider the case when

$$\begin{aligned} m-a^2M <0. \end{aligned}$$
(5.84)

Let \(c<0\) be an integer that divides \(m-a^2M\) and contributes amount (5.82). For any such integer there exists another integer \(c' = -\frac{m-a^2M}{c}<0\), which also divides \(m-a^2M\) and contributes the amount

$$\begin{aligned} \frac{L'}{\left( \frac{b}{a}+\frac{{\tilde{\ell }}}{2m}\right) '} =2m \frac{ \frac{m -a^2M}{c'} +c' }{\frac{m-a^2M}{c'}-c'} =2m \frac{ -c -\frac{m -a^2M}{c} }{-c +\frac{m-a^2M}{c}} = -\frac{L}{\left( \frac{b}{a}+\frac{{\tilde{\ell }}}{2m}\right) }.\qquad \end{aligned}$$
(5.85)

Thus, in (5.81), for a fixed M and a, any summand \(c<0\) with an associated value L comes accompanied by a summand \(c'<0\) with an associated value \(L' = -L\). Both these summands give rise to the same value \({\tilde{\Delta }} = 4MN-L^2 = - 4\,M -L^2\). Since both c and \(c'\) have the same value \(\frac{b}{a}+\frac{{\tilde{\ell }}}{2m}\), we infer that the value \({\tilde{\ell }}' \) associated with \(c'\) is

$$\begin{aligned} {\tilde{\ell }}' = {\tilde{\ell }}+2m\frac{b-b'}{a} . \end{aligned}$$
(5.86)

We now show that it is possible to pick \(b=b'\) in the above as follows. Observing that \(a|(m+c^2)\), we write

$$\begin{aligned} m = - c^2 + a k,\,\,\,\, k \in {\mathbb {Z}} \end{aligned}$$
(5.87)

and hence

$$\begin{aligned} c' = - \frac{m-a^2 M}{c} = c - \frac{a}{c} (k- a M). \end{aligned}$$
(5.88)

Hence the operation

$$\begin{aligned} \begin{pmatrix} 1 &{} 0 \\ -\frac{(k -a M)}{c} &{} 1\end{pmatrix} \begin{pmatrix} a &{} b \\ c &{} d\end{pmatrix} = \begin{pmatrix} a' &{} b' \\ c' &{} d'\end{pmatrix} \end{aligned}$$
(5.89)

yields a new matrix with the same a and \(b'=b\) and with the required \(c'\). Hence we can choose \(b'=b\), in which case \({\tilde{\ell }}' = {\tilde{\ell }}\). Since the multiplier systems are the same, we get a cancellation between the contributions from c and \(c'\).

Next, let us consider the case when

$$\begin{aligned} m-a^2M >0. \end{aligned}$$
(5.90)

Let \(c<0\) be an integer that divides \(m-a^2M\) and contributes amount (5.82). For any such integer there exists another integer \(c' = \frac{m-a^2M}{c}<0\), which also divides \(m-a^2M\) and contributes the amount

$$\begin{aligned} \frac{L'}{\left( \frac{b}{a}+\frac{{\tilde{\ell }}}{2m}\right) '} =2m \frac{ \frac{m -a^2M}{c'} +c' }{\frac{m-a^2M}{c'}-c'} =2m \frac{ c +\frac{m -a^2M}{c} }{c -\frac{m-a^2M}{c}} = -\frac{L}{\left( \frac{b}{a}+\frac{{\tilde{\ell }}}{2m}\right) }. \end{aligned}$$
(5.91)

Note that now \(L' = L\), while

$$\begin{aligned} \left( \frac{{\tilde{\ell }}}{2m}+\frac{b}{a} \right) ' = -\left( \frac{{\tilde{\ell }}}{2m}+\frac{b}{a} \right) , \end{aligned}$$
(5.92)

Using (5.87), we obtain

$$\begin{aligned} c' = \frac{m-a^2 M}{c} = - c + \frac{a}{c} (k- a M). \end{aligned}$$
(5.93)

We then choose

$$\begin{aligned} a'= & {} a \nonumber \\ b'= & {} - b + j a \nonumber \\ d'= & {} d + \frac{(j a-b)}{c} (k- a M) - j c, \;\;\; j \in {\mathbb {Z}}, \end{aligned}$$
(5.94)

which satisfies \(a' d' - b' c' = 1\). The shift by j returns \(b'\) to \(b' \in {\mathbb {Z}}/a {\mathbb {Z}}\). Then, from (5.92), we infer

$$\begin{aligned} {{{\tilde{\ell }}}}' = - {{{\tilde{\ell }}}} - 2 m \frac{ b' + b}{a} = - {{{\tilde{\ell }}}} - 2 m j. \end{aligned}$$
(5.95)

Using the property \(\psi (\Gamma )_{(-{{{\tilde{\ell }}}} - 2\,m j) \ell } = \psi (\Gamma )_{- {{{\tilde{\ell }}}} \ell }\), and recalling that (5.81) uses the two multiplier systems \(\psi (\Gamma )_{ {\tilde{\ell }}\ell }\) and \(\psi (\Gamma )_{-{\tilde{\ell }}\ell }\), also in this case we get a cancellation between the contributions from c and \(c'\).

Finally, let us consider the case when \(m-a^2M = 0\). Then, the divisibility condition \(ac \mid m -a^2M +c^2\) becomes

$$\begin{aligned} ac \mid c^2, \end{aligned}$$
(5.96)

and since \(\gcd (a,c)=1\), this imposes

$$\begin{aligned} a = 1 \end{aligned}$$
(5.97)

and therefore

$$\begin{aligned} M = m. \end{aligned}$$
(5.98)

Thus, when \(N=-1\) the only terms that contribute satisfy \(M=m\) and \(a=1\).

Finally, we note that when \(N=-1, M=m\) and \(a=1\), then

$$\begin{aligned} \left( \frac{{\tilde{\ell }}}{2m}+\frac{b}{a} \right) = \frac{1}{2m}\left( -\frac{1}{ac}\left( m-a^2M-c^2\right) \right) = \frac{c}{2m}. \end{aligned}$$
(5.99)

Since \(c<0\), we infer \(\frac{{\tilde{\ell }}}{2\,m}+\frac{b}{a} \notin [0, - \frac{1}{ac}]\), and hence \(X \ne 0, - \frac{1}{ac}\).

Thus, we conclude that only when \(X Y \ne 0\), do we get non-vanishing contributions in (5.81).

5.6 Bessel Function \(I_{25/2}\)

Finally, we focus on the terms \(I_{m,\gamma (\gamma \sigma + \delta )}\) in decompositions (4.42), (4.43) and (4.46). In the previous subsection we showed that these terms only give a non-vanishing contribution when \(X Y \ne 0\). Thus, we will assume \(X Y \ne 0\) in the following.

We proceed as in Sect. 5.2.1, namely, we restrict the sum over \(\delta \) to the range \(0 \le -\delta < \gamma \) and perform the integration over the Ford circle \(\Gamma _{\sigma }\) in (5.23). Collecting the terms proportional \(I_{m,\gamma (\gamma \sigma + \delta )}\) in (5.11), and changing the integration variable to \({{{\tilde{\sigma }}}}\) given in (5.25), we obtain

$$\begin{aligned} \begin{aligned}&(-1)^{\ell +1}\sum _{P_{0}} \, \textrm{Kl} ( \frac{\Delta }{4m}, \frac{{\tilde{\Delta }}}{4m};\gamma ,\psi )_{\ell {\tilde{\ell }}} \; L \, d(M) \, d(N) \; \int \limits _{{{\tilde{\Gamma }}}} \textrm{d}{\tilde{\sigma }} \;\frac{{{\tilde{\sigma }}^{21/2}}}{\gamma ^{25/2}}\, e^{\left( -2\pi i \left[ \frac{{\tilde{\Delta }}}{4m}\frac{1}{{\tilde{\sigma }}} +\frac{{\Delta }}{4m}\frac{{\tilde{\sigma }}}{\gamma ^2} \right] \right) } \\&\quad \frac{1}{2}\left( I_{m,{\tilde{\sigma }}}\left( \frac{b}{a}+\frac{{\tilde{\ell }}}{2m}\right) +I_{m,{\tilde{\sigma }}}\left( -\frac{b}{a}-\frac{1}{ac}-\frac{{\tilde{\ell }}}{2m}\right) \right) , \end{aligned}\nonumber \\ \end{aligned}$$
(5.100)

where L and \({{{\tilde{\ell }}}}\) are given in (4.13), and where the generalized Kloosterman sum \(\textrm{Kl} ( \frac{\Delta }{4\,m}, \frac{{\tilde{\Delta }}}{4\,m};\gamma ,\psi )_{\ell {\tilde{\ell }}}\) is given in (5.33). The set \(P_0\) is given in (5.48). The integration contour \({{{\tilde{\Gamma }}}}\) denotes a Ford circle centred at \({{{\tilde{\sigma }}}} = i/2\) that skirts the origin \({{{\tilde{\sigma }}}} =0\).

Using symmetry property (4.54), we write (5.100) as

$$\begin{aligned}{} & {} (-1)^{\ell +1}\sum _{P_{0}} \, \left( \textrm{Kl} ( \frac{\Delta }{4m}, \frac{{\tilde{\Delta }}}{4m};\gamma ,\psi )_{\ell {\tilde{\ell }}} + \textrm{Kl} ( \frac{\Delta }{4m}, \frac{{\tilde{\Delta }}}{4m};\gamma ,\psi )_{ \ell (-{\tilde{\ell }})} \right) \; L \, d(M) \, d(N) \; \nonumber \\{} & {} \int \limits _{{{\tilde{\Gamma }}}} \textrm{d}{\tilde{\sigma }} \;\frac{{{\tilde{\sigma }}^{21/2}}}{\gamma ^{25/2}}\, e^{\left( -2\pi i \left[ \frac{{\tilde{\Delta }}}{4m}\frac{1}{{\tilde{\sigma }}} +\frac{{\Delta }}{4m}\frac{{\tilde{\sigma }}}{\gamma ^2} \right] \right) } \frac{1}{2} I_{m,{\tilde{\sigma }}}\left( \frac{b}{a}+\frac{{\tilde{\ell }}}{2m}\right) . \end{aligned}$$
(5.101)

Using the expression for \(I_{m,{\tilde{\sigma }}}\) given in (4.39) and relation (5.50), we obtain

$$\begin{aligned} \begin{aligned}&(-1)^{\ell } \frac{1}{4\sqrt{2\pi ^2 i m}} \sum _{P_{0}} \left[ \textrm{Kl} ( \frac{\Delta }{4m}, \frac{{\tilde{\Delta }}}{4m};\gamma ,\psi )_{\ell {\tilde{\ell }}} + \textrm{Kl} ( \frac{\Delta }{4m}, \frac{{\tilde{\Delta }}}{4m};\gamma ,\psi )_{\ell ( - {\tilde{\ell }}) } \right] \\&\qquad \, \frac{L}{\left( \frac{b}{a}+\frac{{\tilde{\ell }}}{2m} \right) } \, d(M) \, d(N) \int \limits _{{{\tilde{\Gamma }}}} d{\tilde{\sigma }} \;\frac{{{\tilde{\sigma }}^{21/2}}}{\gamma ^{25/2}}\, e^{\left( -2\pi i \left[ \frac{N}{a^2}\frac{1}{{\tilde{\sigma }}} +\frac{{\Delta }}{4m}\frac{{\tilde{\sigma }}}{\gamma ^2} \right] \right) }\\&\qquad \int \limits _0^{i\infty }\left( \frac{1}{{\tilde{\sigma }}}-z \right) ^{-3/2}e^{2\pi i m \left( \frac{b}{a}+\frac{{\tilde{\ell }}}{2m}\right) ^2 z}\textrm{d}z . \end{aligned} \end{aligned}$$
(5.102)

Now consider the integral

$$\begin{aligned} \int \limits _0^{i\infty }\left( \frac{1}{{\tilde{\sigma }}}-z \right) ^{-3/2}e^{2\pi i m \left( \frac{b}{a}+\frac{{\tilde{\ell }}}{2m}\right) ^2 z}\textrm{d}z, \end{aligned}$$
(5.103)

which we rewrite using [22]

$$\begin{aligned} \int \limits _{\mathbb {R}} \frac{e^{-2\pi t x^2}}{(x-is)^2} \, \textrm{d}x = - \sqrt{2}\pi t \int \limits _0^\infty \frac{e^{-2\pi u s^2}}{(u+t)^{3/2}}\textrm{d}u, \end{aligned}$$
(5.104)

where \(s \in {\mathbb {R}} \backslash \{0\}\), and where \(t \in {\mathbb {C}}\) with \(\textrm{Re} \, t > 0\). Setting \(u = - i m z\) and \(t = im /{{{\tilde{\sigma }}}}\) (note that \(\textrm{Re} \, t = m \sigma _2/|{{{\tilde{\sigma }}}}|^2 > 0\)), integral (5.103) can be expressed as

$$\begin{aligned} \frac{1}{\sqrt{2 i m} \, \pi } \, {\tilde{\sigma }}\int \limits _{\mathbb {R}} \frac{e^{-2\pi i m\frac{1}{{\tilde{\sigma }}}x^2}}{\left( x-i \left( \frac{b}{a}+\frac{{\tilde{\ell }}}{2m}\right) \right) ^2}\textrm{d}x . \end{aligned}$$
(5.105)

Then, collecting the exponential terms in (5.102) with \(1/{\tilde{\sigma }}\) in the exponent gives

$$\begin{aligned} e^{-2\pi i \left( \frac{N}{a^2}+mx^2 \right) /{{{\tilde{\sigma }}}} } . \end{aligned}$$
(5.106)

Interchanging the two integrations in (5.102), and performing the integration over \({{{\tilde{\sigma }}}}\) along the Ford circle \({{{\tilde{\Gamma }}}}\) as described in Sect. 5.4, the latter will only be non-vanishing provided that \(\left( \frac{N}{a^2}+mx^2 \right) < 0\), which in turn implies \(N=-1\). Then, as shown in the previous subsection, the only non-vanishing contribution to (5.102) stems from \(N=-1, a=1, M=m\).

Then, setting \(N=-1, a=1, M=m\), we have

$$\begin{aligned} {\tilde{\ell }} = -2bm+c \;,\;\; \frac{b}{a}+\frac{{\tilde{\ell }}}{2m} = \frac{c}{2m} \;,\;\; L = -c>0, \nonumber \\ \frac{L}{\frac{b}{a}+\frac{{\tilde{\ell }}}{2m}} = -2m \;,\;\; {\tilde{\Delta }} = 4MN-L^2 = -4m-c^2 . \end{aligned}$$
(5.107)

Using (5.58) and the multiplier system property \(\psi _{(j + 2\,m k) {\ell }}(\Gamma ) = \psi _{j {\ell }}(\Gamma )\) (with \(k \in {\mathbb {Z}}\)) [20], we write (5.102) as

$$\begin{aligned}{} & {} (-1)^{\ell +1} \frac{ \sqrt{2m } \, d(m) }{4\sqrt{\pi ^2 i }}\, \sum _{\gamma = 1 }^{\infty } \sum _{j \in {\mathbb {Z}}/2m{\mathbb {Z}}}\sum _{\begin{array}{c} c<0\\ c = j \text { mod } 2m \end{array}} \nonumber \\{} & {} \quad \left[ \textrm{Kl} ( \frac{\Delta }{4m}, -1 - \frac{c^2}{4m};\gamma ,\psi )_{\ell j } + \textrm{Kl} ( \frac{\Delta }{4m}, -1 - \frac{c^2}{4m};\gamma ,\psi )_{\ell ( - j ) } \right] \nonumber \\{} & {} \quad \int \limits _{{{\tilde{\Gamma }}}} d{\tilde{\sigma }} \;\frac{{{\tilde{\sigma }}^{21/2}}}{\gamma ^{25/2}}\, e^{\left( 2\pi i \left[ \frac{1}{{\tilde{\sigma }}} -\frac{{\Delta }}{4m}\frac{{\tilde{\sigma }}}{\gamma ^2} \right] \right) } \int \limits _0^{i\infty }\left( \frac{1}{{\tilde{\sigma }}}-z \right) ^{-3/2}e^{2\pi i \frac{c^2}{4m} z}\textrm{d}z . \end{aligned}$$
(5.108)

Noticing that the dependence on c is quadratic, we write

$$\begin{aligned} \sum _{j \in {\mathbb {Z}}/2m{\mathbb {Z}}} \sum _{\begin{array}{c} c<0\\ c = j \text { mod }2m \end{array}} f(c) = \sum _{j \in {\mathbb {Z}}/2m{\mathbb {Z}}} \frac{1}{2}\sum _{\begin{array}{c} c\in {\mathbb {Z}}\setminus \{0\}\\ c = j \text { mod }2m \end{array}} f(c), \end{aligned}$$
(5.109)

where we made use of the symmetry \(j \rightarrow - j\) to obtain an expression with the symmetry \(c \rightarrow -c\). We now re-express the sum over c as [11]

$$\begin{aligned} \frac{1}{2}\sum _{\begin{array}{c} c\in {\mathbb {Z}}\setminus \{0\}\\ c = j \text { mod }2m \end{array}} f(c) = \frac{1}{2}\sum _{\begin{array}{c} p\in {\mathbb {Z}}\\ g \in {\mathbb {Z}}/2m\gamma {\mathbb {Z}} \\ 2m\gamma p+ g\ne 0 \\ g = j \text { mod }2m \end{array}} f(2m\gamma p + g). \end{aligned}$$
(5.110)

Then, the c depending part of Kloosterman sum (5.33) gets re-expressed as

$$\begin{aligned} e^{2\pi i \frac{\alpha }{\gamma } \left( \frac{-c^2}{4m} \right) } = e^{2\pi i \frac{\alpha }{\gamma } \left( \frac{-(2m\gamma p + g)^2}{4m} \right) } = e^{2\pi i \frac{\alpha }{\gamma } \left( \frac{-g^2}{4m}\right) }, \end{aligned}$$
(5.111)

while the exponential term in the dz-integral becomes

$$\begin{aligned} e^{2\pi i \frac{c^2}{4m} z} = e^{2\pi i \frac{(2m\gamma p + g)^2}{4m} z} = e^{2\pi i m \left( \gamma p + \frac{g}{2m} \right) ^2 z} . \end{aligned}$$
(5.112)

Thus we rewrite (5.108) as

$$\begin{aligned}{} & {} (-1)^{\ell +1} \frac{ \sqrt{2m } \, d(m) }{8 \sqrt{\pi ^2 i }}\, \sum _{\gamma = 1 }^{\infty } \sum _{j \in {\mathbb {Z}}/2m{\mathbb {Z}}} \sum _{\begin{array}{c} p\in {\mathbb {Z}}\\ g \in {\mathbb {Z}}/2m\gamma {\mathbb {Z}} \\ 2m\gamma p+ g\ne 0 \\ g = j \text { mod }2m \end{array}} \nonumber \\{} & {} \quad \left[ \textrm{Kl} ( \frac{\Delta }{4m}, -1 - \frac{g^2}{4m};\gamma ,\psi )_{\ell j } + \textrm{Kl} ( \frac{\Delta }{4m}, -1 - \frac{g^2}{4m};\gamma ,\psi )_{\ell ( - j ) } \right] \nonumber \\{} & {} \quad \int \limits _{{{\tilde{\Gamma }}}} d{\tilde{\sigma }} \;\frac{{{\tilde{\sigma }}^{21/2}}}{\gamma ^{25/2}}\, e^{\left( 2\pi i \left[ \frac{1}{{\tilde{\sigma }}} -\frac{{\Delta }}{4m}\frac{{\tilde{\sigma }}}{\gamma ^2} \right] \right) } \int \limits _0^{i\infty }\left( \frac{1}{{\tilde{\sigma }}}-z \right) ^{-3/2}e^{2\pi i m \left( \gamma p + \frac{g}{2m} \right) ^2 z}\textrm{d}z .\nonumber \\ \end{aligned}$$
(5.113)

Note that the sum over p and g builds up the standard weight 1/2 index m Jacobi theta function, with the exception of the term \(2m\gamma p+ g =0\),

$$\begin{aligned} \vartheta _{m, j }\left( i\tau - \frac{\alpha }{\gamma };0\right) = \sum _{\begin{array}{c} g \in {\mathbb {Z}}/2m \gamma {\mathbb {Z}} \\ g = j \text {mod }2m \end{array}} e^{-2\pi i \frac{\alpha }{\gamma \, 4m}g^2}\sum _{p\in {\mathbb {Z}}}e^{-2\pi \tau m\left( \frac{g}{2m}+\gamma p \right) ^2}. \end{aligned}$$
(5.114)

Next, we follow [11, 14]. Using the results reviewed in Appendix B, we rewrite (5.113) as

$$\begin{aligned}{} & {} (-1)^{\ell } \, i \frac{d(m)}{8 \pi ^2} \, \sum _{\gamma >0}\sum _{j \in {\mathbb {Z}}/2m{\mathbb {Z}}} \sum _{\begin{array}{c} g \in {\mathbb {Z}}/2m\gamma {\mathbb {Z}} \\ g = j \text { mod }2m \end{array}} \nonumber \\{} & {} \quad \left[ \textrm{Kl} ( \frac{\Delta }{4m}, -1 - \frac{g^2}{4m};\gamma ,\psi )_{\ell j } + \textrm{Kl} ( \frac{\Delta }{4m}, -1 - \frac{g^2}{4m};\gamma ,\psi )_{\ell ( - j ) } \right] \nonumber \\{} & {} \quad \int \limits _{{{\tilde{\Gamma }}}} d{\tilde{\sigma }} \;\frac{{{\tilde{\sigma }}^{23/2}}}{\gamma ^{25/2}} \, e^{-2\pi i\frac{{\Delta }}{4m}\frac{{\tilde{\sigma }}}{\gamma ^2} }e^{2\pi i\frac{1}{{\tilde{\sigma }}}} \int \limits _{\mathbb {R}} e^{-2\pi i m\frac{1}{{\tilde{\sigma }}}x'^2}f_{\gamma ,g,m}(x') \frac{1}{\gamma ^2}\textrm{d}x',\qquad \end{aligned}$$
(5.115)

where

$$\begin{aligned} f_{\gamma ,g,m}(x')= & {} \sum _{\begin{array}{c} p\in {\mathbb {Z}}\\ 2m\gamma p+ g\ne 0 \end{array}} \frac{\gamma ^2}{\left( x'-i \gamma p -i\frac{g}{2m} \right) ^2} \nonumber \\= & {} \left\{ \begin{aligned} \frac{\pi ^2}{\sinh ^2\left( \frac{\pi x'}{\gamma } - \frac{\pi i g}{2m \gamma } \right) }&\;\; \text { if}\;\;\; g \ne 0 \text { mod } 2m\gamma \\ \frac{\pi ^2}{\sinh ^2\left( \frac{\pi x'}{\gamma } \right) } - \frac{\gamma ^2}{x'^2}&\;\;\text { if}\;\;\; g = 0 \text { mod } 2m\gamma \end{aligned}\right. \end{aligned}$$
(5.116)

We now turn our attention to the \({\tilde{\sigma }}\) and \(x'\) integrals

$$\begin{aligned} \int \limits _{{{\tilde{\Gamma }}}} \textrm{d}{\tilde{\sigma }} \;\frac{{{\tilde{\sigma }}^{23/2}}}{\gamma ^{29/2}}\, e^{-2\pi i\frac{{\Delta }}{4m}\frac{{\tilde{\sigma }}}{\gamma ^2} } \int \limits _{\mathbb {R}} e^{2\pi i\frac{1}{{\tilde{\sigma }}}(1- mx'^2)}f_{\gamma ,g,m}(x') \textrm{d}x'. \end{aligned}$$
(5.117)

We perform the change of variables

$$\begin{aligned} w = \frac{i}{{\tilde{\sigma }}} \end{aligned}$$
(5.118)

and obtain (\({{{\tilde{\epsilon }}}} > 0\))

$$\begin{aligned} (-1) \int \limits _{{{{\tilde{\epsilon }}}}-i\infty }^{{{{\tilde{\epsilon }}}}+i \infty } \textrm{d}w \;\frac{{i^{25/2}}}{\gamma ^{29/2}}\frac{1}{w^{27/2}}\, e^{2\pi \frac{{\Delta }}{4m\gamma ^2}\frac{1}{w} } \int \limits _{\mathbb {R}} e^{2\pi (1- mx'^2)w} f_{\gamma ,g,m}(x') \textrm{d}x'.\nonumber \\ \end{aligned}$$
(5.119)

Interchanging the two integrations and performing the integration over w first, we only get a non-vanishing Bessel integral provided that we restrict the range of integration over \(x'\) to \(1- mx'^2 > 0\), that is to

$$\begin{aligned} \int \limits _{\mathbb {R}} \textrm{d}x' \rightarrow \int \limits _{-1/\sqrt{m}}^{1/\sqrt{m}} \textrm{d}x' . \end{aligned}$$
(5.120)

Performing another change of variables,

$$\begin{aligned} t = 2\pi (1-mx'^2) w, \end{aligned}$$
(5.121)

integral (5.119) becomes (\(\epsilon >0\))

$$\begin{aligned}{} & {} (-1) (2\pi )^{25/2} \;\frac{{i^{1/2}}}{\gamma ^{29/2}} \int \limits _{-1/\sqrt{m}}^{1/\sqrt{m}}\textrm{d}x'f_{\gamma ,g,m}(x') \, (1-mx'^2)^{25/2} \nonumber \\{} & {} \quad \qquad \int \limits _{{ \epsilon }-i\infty }^{{\epsilon }+i \infty } \textrm{d} t \frac{1}{t^{27/2}}\, e^{4\pi ^2 \frac{{\Delta }}{4m\gamma ^2}(1-mx'^2) \frac{1}{t} } e^{t},\nonumber \\ \end{aligned}$$
(5.122)

which, using (5.30), equals

$$\begin{aligned}{} & {} (-1)i^{3/2}2\pi \int \limits _{-1/\sqrt{m}}^{1/\sqrt{m}}\textrm{d}x'f_{\gamma ,g,m}(x') (1-mx'^2)^{25/4}\left( \frac{4m}{\Delta } \right) ^{25/4}\nonumber \\{} & {} \;\frac{{1}}{\gamma ^{2}}\, I_{25/2}\left( \frac{2\pi }{\gamma \sqrt{m}} \sqrt{\Delta (1-mx'^2)}\right) .\nonumber \\ \end{aligned}$$
(5.123)

Thus, (5.115) becomes

$$\begin{aligned} \begin{aligned}&(-1)^{\ell } \, i^{1/2} \frac{\textrm{d}(m)}{4 \pi } \, \sum _{\gamma >0}\sum _{j \in {\mathbb {Z}}/2m{\mathbb {Z}}} \sum _{\begin{array}{c} g \in {\mathbb {Z}}/2m\gamma {\mathbb {Z}} \\ g = j \text { mod }2m \end{array}} \\&\quad \frac{ \left[ \textrm{Kl} ( \frac{\Delta }{4m}, -1 - \frac{g^2}{4m};\gamma ,\psi )_{\ell j } + \textrm{Kl} ( \frac{\Delta }{4m}, -1 - \frac{g^2}{4m}; \gamma ,\psi )_{\ell ( - j ) } \right] }{\gamma ^2} \\&\quad \left( \frac{4m}{\Delta } \right) ^{25/4} \, \int \limits _{-1/\sqrt{m}}^{1/\sqrt{m}}\textrm{d}x' f_{\gamma ,g,m}(x') (1-mx'^2)^{25/4} \; I_{25/2}\left( \frac{2\pi }{\gamma \sqrt{m}}\sqrt{\Delta (1-mx'^2)}\right) . \end{aligned}\nonumber \\ \end{aligned}$$
(5.124)

The above expression involves two Kloosterman sums. Using the property \(f_{\gamma , - g,m}(- x') = f_{\gamma ,g,m}(x')\), we can show that both Kloosterman sums give rise to the same contribution, because the sign change of j in the multiplier system can be compensated by a sign change in g and \(x'\). Thus, we arrive at the expression

$$\begin{aligned} \begin{aligned}&(-1)^{\ell } \, i^{1/2} \frac{d(m)}{2 \pi } \, \sum _{\gamma >0}\sum _{j \in {\mathbb {Z}}/2m{\mathbb {Z}}} \sum _{\begin{array}{c} g \in {\mathbb {Z}}/2m\gamma {\mathbb {Z}} \\ g = j \text { mod }2m \end{array}} \frac{ \textrm{Kl} ( \frac{\Delta }{4m}, -1 - \frac{g^2}{4m};\gamma ,\psi )_{\ell j } }{\gamma ^2} \\&\quad \left( \frac{4m}{\Delta } \right) ^{25/4} \, \int \limits _{-1/\sqrt{m}}^{1/\sqrt{m}}\textrm{d}x'f_{\gamma ,g,m}(x') (1-mx'^2)^{25/4} \; I_{25/2}\left( \frac{2\pi }{\gamma \sqrt{m}}\sqrt{\Delta (1-mx'^2)}\right) . \end{aligned}\nonumber \\ \end{aligned}$$
(5.125)

5.7 Complete Result for \(\Delta > 0\)

Combining contributions (5.36), (5.80) and (5.125), and relabelling j by \({{\tilde{\ell }}}\), we obtain the following expression for the degeneracy \(d(m,n,\ell )\) defined in (2.5):

Theorem 5.1

$$\begin{aligned} d(m,n,\ell )= & {} (-1)^{\ell } \, i^{1/2} \, \sum _{\gamma =1}^{+\infty } \sum _{{\tilde{\ell }}\in {\mathbb {Z}}/2m{\mathbb {Z}}}\nonumber \\{} & {} \left( 2\pi \sum _{\begin{array}{c} {\tilde{n}}\ge -1,\nonumber \\ {\tilde{\Delta }}<0 \end{array}} c^F_m({\tilde{n}},{\tilde{\ell }})\frac{\textrm{Kl}(\frac{\Delta }{4m},\frac{{\tilde{\Delta }}}{4m},\gamma ,\psi )_{\ell {\tilde{\ell }}}}{\gamma } \left( \frac{ \vert {\tilde{\Delta }} \vert }{\Delta } \right) ^{23/4} I_{23/2}\left( \frac{\pi }{\gamma m}\sqrt{\Delta \vert {\tilde{\Delta }}\vert } \right) \right. \nonumber \\{} & {} \quad -\delta _{{\tilde{\ell }},0}\sqrt{2m}\, d(m) \frac{\textrm{Kl} ( \frac{\Delta }{4m}, -1;\gamma ,\psi )_{\ell 0}}{\sqrt{\gamma }}\left( \frac{4m}{\Delta } \right) ^6 I_{12}\left( \frac{2\pi }{\gamma }\sqrt{\frac{\Delta }{m}} \right) \nonumber \\{} & {} \quad +\frac{1}{2\pi } d(m) \sum _{\begin{array}{c} g \in {\mathbb {Z}}/2m\gamma {\mathbb {Z}} \\ g = {\tilde{\ell }} \text { mod }2m \end{array}} \frac{\textrm{Kl }( \frac{\Delta }{4m}, -1-\frac{g^2}{4m};\gamma ,\psi )_{\ell {\tilde{\ell }}}}{\gamma ^2} \left( \frac{4m}{\Delta } \right) ^{25/4}\nonumber \\{} & {} \quad \left. \int \limits _{-1/\sqrt{m}}^{1/\sqrt{m}}dx' f_{\gamma ,g,m}(x') (1-mx'^2)^{25/4} I_{25/2}\left( \frac{2\pi }{\gamma \sqrt{m}}\sqrt{\Delta (1-mx'^2)}\right) \right) ,\nonumber \\ \end{aligned}$$
(5.126)

with

$$\begin{aligned} c^F_m({\tilde{n}},{\tilde{\ell }} )= & {} \sum _{\begin{array}{c} a>0, c<0 \\ b \in {\mathbb {Z}}/ a {\mathbb {Z}}, \; a d - b c = 1 \\ 0 \le \frac{b}{a} + \frac{{{\tilde{\ell }}}}{2m}< - \frac{1}{ac } \end{array}} \left( (ad + bc ) {{{\tilde{\ell }}}} + 2 ac {{{\tilde{n}}}} + 2 bd m \right) \nonumber \\{} & {} \quad d( c^2 {{{\tilde{n}}}} + d^2 m + cd {{{\tilde{\ell }}}}) \, d(a^2 {{{\tilde{n}}}} + b^2 m + ab {{{\tilde{\ell }}}}) \nonumber \\ \frac{1}{\eta ^{24}(\tau )}= & {} \sum _{n=-1}^\infty d(n) \, e^{2\pi i \tau n} \; \;,\;\; \nonumber \\ \textrm{Kl}(\frac{\Delta }{4m},\frac{{\tilde{\Delta }}}{4m},\gamma ,\psi )_{\ell {\tilde{\ell }}}= & {} \sum _{\begin{array}{c} 0\le -\delta <\gamma \\ (\delta ,\gamma )=1, \alpha \delta = 1 \text { mod } \gamma \end{array}}e^{2\pi i \left( \frac{\alpha }{\gamma }\frac{{\tilde{\Delta }}}{4m} +\frac{\delta }{\gamma }\frac{\Delta }{4m}\right) } \, {\psi } (\Gamma )_{{\tilde{\ell }}\ell } \nonumber \\ {\psi } (\Gamma )_{{{{\tilde{\ell }}}} \ell }= & {} \frac{1}{\sqrt{2m\gamma i }}\sum _{T\in {\mathbb {Z}}/\gamma {\mathbb {Z}}} e^{2\pi i \left( \frac{\alpha }{\gamma }\frac{({{{\tilde{\ell }}} }-2mT)^2}{4m}-\frac{\ell ({{{\tilde{\ell }}}} -2mT)}{2m\gamma } +\frac{\delta }{\gamma }\frac{\ell ^2}{4m} \right) } \nonumber \\ f_{\gamma ,g,m}(x')= & {} \sum _{\begin{array}{c} p\in {\mathbb {Z}}\\ 2m\gamma p+ g\ne 0 \end{array}} \frac{\gamma ^2}{\left( x'-i \gamma p -i\frac{g}{2m} \right) ^2} \nonumber \\= & {} \left\{ \begin{aligned} \frac{\pi ^2}{\sinh ^2\left( \frac{\pi x'}{\gamma } - \frac{\pi i g}{2m \gamma } \right) }&\;\; \text { if}\;\;\; g \ne 0 \text { mod } 2m\gamma \\ \frac{\pi ^2}{\sinh ^2\left( \frac{\pi x'}{\gamma } \right) } - \frac{\gamma ^2}{x'^2}&\;\;\text { if}\;\;\; g = 0 \text { mod } 2m\gamma \end{aligned}\right. \nonumber \\ \end{aligned}$$
(5.127)

Note that the continued fraction structure is encoded in a subset of \(S_G\), while the Kloosterman sums \(\textrm{Kl}\) and Bessel functions are built up from \(\Gamma _{\infty } \backslash S_{\Gamma }\) and \(S_G\).

Expression (5.126), without the continued fraction structure of \(c^F_m({\tilde{n}},{\tilde{\ell }})\), was first derived in [11] by viewing \(d(m, n, \ell )\) as Fourier coefficients of a mixed Mock Jacobi form \(\psi _m^F\) [13]. The above result is an exact expression for \(d(m,n,\ell )\) which can be viewed as the non-perturbative completion of previous results in [16, 17, 23].

6 The Case \(\Delta = m= \ell = 0\)

Now we consider the case \(m= \ell = 0\), which implies \(\Delta =0\).

We return to (4.16) and set \(m=\ell =0\),

$$\begin{aligned}{} & {} (-1) \sum _{P} {(\gamma \sigma +\delta )^{10}} \,\int \limits _{\Gamma _v} dv \, \sum _{\begin{array}{c} M,N\ge -1\\ L\in {\mathbb {Z}} \end{array}} L \, d(M) \, d(N) \nonumber \\{} & {} \qquad \exp \left( -2\pi i \left[ - {\tilde{n}}\left( \frac{\alpha \sigma +\beta }{\gamma \sigma +\delta }\right) -{\tilde{\ell }} \frac{v}{\gamma \sigma +\delta }+n\sigma \right] \right) , \end{aligned}$$
(6.1)

where the integers \(L, {{{\tilde{\ell }}}}\) and \({{{\tilde{n}}}}\) are given by

$$\begin{aligned} L&= \frac{a}{c}M+\frac{c}{a}N \nonumber \\ {\tilde{\ell }}&= \frac{a}{c}M-\frac{c}{a}N \nonumber \\ {\tilde{n}}&= -\frac{b}{c}M+\frac{d}{a}N . \end{aligned}$$
(6.2)

We apply T-shift transformation (4.25) to b and to d, which leaves \(L, {\tilde{\ell }}\) invariant and changes \({{\tilde{n}}}\) into

$$\begin{aligned} {\tilde{n}} \rightarrow {\tilde{n}}-{\tilde{\ell }}T. \end{aligned}$$
(6.3)

Then, as before, we split the sum over b into a sum over \(b\in {\mathbb {Z}}/a{\mathbb {Z}}\) and a sum over \(T \in {\mathbb {Z}}\).

We pick the following integration contour \(\Gamma _v\). We set \(v_2 = 0\). This choice is motivated by noting that setting \(\ell =0\) in (2.4) one obtains \(v_2 =0\). Then, setting \(v_2 = 0\) in expressions (4.2), we infer that the range of \(v_1\) is restricted to

$$\begin{aligned} - \frac{b}{\gamma a} - \frac{T}{\gamma }< v_1 < - \frac{b}{\gamma a} - \frac{1}{ac\gamma }- \frac{T}{\gamma } = - \frac{b}{\gamma a} + \frac{1}{n_2} - \frac{T}{\gamma }, \end{aligned}$$
(6.4)

where we have made use of the T-shift. Demanding that the range of integration over \(v_1\) is contained in an interval of length 1 constrains T to take values in \(T\in {\mathbb {Z}}/\gamma {\mathbb {Z}}\). Then, (6.1) takes the form

$$\begin{aligned}{} & {} (-1) \sum _{\begin{array}{c} P\\ b\in {\mathbb {Z}}/a{\mathbb {Z}}, \; T \in {\mathbb {Z}}/\gamma {\mathbb {Z}} \end{array}} {(\gamma \sigma +\delta )^{10}} \, \int \limits _{\Gamma _v} \textrm{d}v \, \sum _{\begin{array}{c} M,N\ge -1\\ L\in {\mathbb {Z}} \end{array}} \, L \, d(M) \, d(N) \nonumber \\{} & {} \exp \left( -2\pi i \left[ - {\tilde{n}}\left( \frac{\alpha \sigma +\beta }{\gamma \sigma +\delta }\right) +T{\tilde{\ell }}\left( \frac{\alpha \sigma +\beta }{\gamma \sigma +\delta }\right) -{\tilde{\ell }} \frac{v}{\gamma \sigma +\delta } +n\sigma \right] \right) . \end{aligned}$$
(6.5)

We interchange the integration over \(v_1\) with the summation over MN. The integration over \(v_1\) will produce a different result depending on whether \({{{\tilde{\ell }}}}\) vanishes or not. Therefore, we discuss both cases separately.

6.1 \({\tilde{\ell }} = 0\)

Setting \({{{\tilde{\ell }}}} = 0\) implies

$$\begin{aligned} \frac{a}{c}M = \frac{c}{a}N \;\;,\;\;\; {\tilde{n}} = \frac{N}{a^2}. \end{aligned}$$
(6.6)

The integral over \(v_1\) is trivial and independent of T. The sum over T yields a factor \(\gamma \). Thus, we obtain for (6.5),

$$\begin{aligned} \frac{1}{ac}{} & {} \sum _{\begin{array}{c} P\\ b\in {\mathbb {Z}}/a{\mathbb {Z}} \end{array}} {(\gamma \sigma +\delta )^{10}} \, \sum _{\begin{array}{c} M,N\ge -1\\ L\in {\mathbb {Z}}, \; {{{\tilde{\ell }}}} = 0 \end{array}} \, L \, d(M) \, d(N) \nonumber \\{} & {} \exp \left( -2\pi i \left[ - {\tilde{n}}\left( \frac{\alpha \sigma +\beta }{\gamma \sigma +\delta }\right) +n\sigma \right] \right) . \end{aligned}$$
(6.7)

Using

$$\begin{aligned}{} & {} - {\tilde{n}}\left( \frac{\alpha \sigma +\beta }{\gamma \sigma +\delta }\right) = - {\tilde{n}}\frac{\alpha }{\gamma } + {\tilde{n}}\frac{1}{\gamma (\gamma \sigma +\delta )}, \nonumber \\{} & {} n\sigma = \frac{1}{\gamma ^2}n\gamma (\gamma \sigma +\delta )-n\frac{\delta }{\gamma } \end{aligned}$$
(6.8)

as well as (6.6), we get

$$\begin{aligned} \frac{1}{ac}{} & {} \sum _{\begin{array}{c} P\\ b\in {\mathbb {Z}}/a{\mathbb {Z}} \end{array}} {(\gamma \sigma +\delta )^{10}} \, \sum _{\begin{array}{c} M,N\ge -1\\ L\in {\mathbb {Z}}, \; {{{\tilde{\ell }}}} = 0 \end{array}} \, L \, d(M) \, d(N) \, e^{2\pi i\left( \frac{\alpha }{\gamma }\frac{N}{a^2} +n\frac{\delta }{\gamma }\right) }\nonumber \\{} & {} e^{-2\pi i \left( \frac{N}{a^2}\frac{1}{\gamma (\gamma \sigma +\delta )} +\frac{n}{\gamma ^2}\gamma (\gamma \sigma +\delta ) \right) }. \end{aligned}$$
(6.9)

Next, we integrate over \(\sigma _1\). We proceed as in Sect. 5.2.1, namely, we restrict the sum over \(\delta \) to the range \(0 \le -\delta < \gamma \) and perform the integration over the Ford circle \(\Gamma _{\sigma }\) in (5.23). We interchange the integration over \(\sigma \) with the sum over M and N. The resulting integral is similar to the one in (5.24), but without a branch cut, and will only be non-vanishing provided that \(N <0\), i.e. when \(N=-1\). Inserting \(N=-1\) into the expression for \(L - {{{\tilde{\ell }}}}\) given in (6.2), and recalling that \(\gcd (a, c)=1\), fixes \(a=1\). Then, from (6.6), we infer \(M = -c^2\), which in turn implies \(M=-1\) and \(c=-1\), and hence \(L=2\). Moreover, since \(b\in {\mathbb {Z}}/a{\mathbb {Z}} \) with \(a=1\), this fixes b to a single value. Thus, integrating (6.9) over \(\sigma \), we obtain, using \(d(-1)=1\),

$$\begin{aligned} -2 \sum _{\begin{array}{c} \gamma \ge 1\\ 0 \le \alpha , -\delta < \gamma \\ \alpha \delta = 1 \text { mod } \gamma \end{array}} \int \limits _{\Gamma _{\sigma }} d\sigma \, {(\gamma \sigma +\delta )^{10}} e^{2\pi i\left( -\frac{\alpha }{\gamma } +n\frac{\delta }{\gamma }\right) } e^{-2\pi i \left( -\frac{1}{\gamma (\gamma \sigma +\delta )} +\frac{n}{\gamma ^2}\gamma (\gamma \sigma +\delta ) \right) }.\nonumber \\ \end{aligned}$$
(6.10)

Performing the change of variables

$$\begin{aligned} {\tilde{\sigma }} = \gamma (\gamma \sigma +\delta ), \end{aligned}$$
(6.11)

the Ford circle \(\Gamma _{\sigma }\) becomes the Ford circle \({\tilde{\Gamma }}\) of radius 1/2 and of centre \({\tilde{\sigma }} = i/2\),

$$\begin{aligned} -2\,\sum _{\begin{array}{c} \gamma \ge 1\\ 0 \le \alpha , -\delta < \gamma \\ \alpha \delta = 1 \text { mod } \gamma \end{array}} \int \limits _{{{\tilde{\Gamma }}}} d{\tilde{\sigma }} \, \frac{{\tilde{\sigma }}^{10}}{\gamma ^{12}}\, e^{2\pi i\left( -\frac{\alpha }{\gamma } +n\frac{\delta }{\gamma }\right) } e^{-2\pi i \left( -\frac{1}{{\tilde{\sigma }}} +\frac{n}{\gamma ^2}{\tilde{\sigma }} \right) }. \end{aligned}$$
(6.12)

Performing a further change of variables,

$$\begin{aligned} t = \frac{2 \pi i}{{\tilde{\sigma }}}, \end{aligned}$$
(6.13)

we obtain, with \(\epsilon > 0\),

$$\begin{aligned} \,2\, i^{11} \, (2\pi )^{11} \sum _{\begin{array}{c} \gamma \ge 1\\ 0 \le \alpha , -\delta < \gamma \\ \alpha \delta = 1 \text { mod } \gamma \end{array}} \, \frac{1}{\gamma ^{12}}\, e^{2\pi i\left( -\frac{\alpha }{\gamma } +n\frac{\delta }{\gamma }\right) } \int \limits _{\epsilon -i\infty }^{\epsilon +i \infty } \frac{\textrm{d}t}{t^{12} } \, e^{t +4\pi ^2 \frac{n}{\gamma ^2}\frac{1}{t}}. \end{aligned}$$
(6.14)

Using (5.30) we obtain,

$$\begin{aligned} 4\pi \sum _{\begin{array}{c} \gamma \ge 1\\ 0 \le \alpha , -\delta < \gamma \\ \alpha \delta = 1 \text { mod } \gamma \end{array}}e^{2\pi i\left( -\frac{\alpha }{\gamma } +n\frac{\delta }{\gamma }\right) }\frac{1}{\gamma \,n^{11/2}} I_{11}\left( \frac{4\pi \sqrt{n}}{\gamma } \right) , \end{aligned}$$
(6.15)

which equals

$$\begin{aligned} 4\pi \sum _{\gamma =1}^{\infty } \frac{ \textrm{Kl} (n,-1,\gamma ) }{\gamma } \, \frac{1}{n^{11/2}}\, I_{11}\left( \frac{4\pi \sqrt{n}}{\gamma } \right) \end{aligned}$$
(6.16)

when written in terms of the classical Kloosterman sum

$$\begin{aligned} \textrm{Kl} (n,-1,\gamma ) = \sum _{\begin{array}{c} 0 \le \alpha , -\delta < \gamma \\ \alpha \delta = 1 \text { mod } \gamma \end{array}}e^{2\pi i\left( -\frac{\alpha }{\gamma } +n\frac{\delta }{\gamma }\right) } . \end{aligned}$$
(6.17)

6.2 \({\tilde{\ell }} \ne 0\)

Now we take \({\tilde{\ell }}\ne 0\) in (6.5) and obtain

$$\begin{aligned}{} & {} \frac{(-1)}{2\pi i} \sum _{\begin{array}{c} P\\ b\in {\mathbb {Z}}/a{\mathbb {Z}}, \; T \in {\mathbb {Z}}/\gamma {\mathbb {Z}} \end{array}} {(\gamma \sigma +\delta )^{11}} \, \nonumber \\{} & {} \sum _{M,N\ge -1} \frac{L}{{\tilde{\ell }}} \, d(M) \, d(N) \, \left( e^{-2\pi i \frac{{\tilde{\ell }}}{\gamma \sigma +\delta }\left( \frac{b}{\gamma a}+\frac{1}{ac\gamma }+\frac{T}{\gamma }\right) }- e^{-2\pi i \frac{{\tilde{\ell }}}{\gamma \sigma +\delta }\left( \frac{b}{\gamma a}+\frac{T}{\gamma }\right) } \right) \nonumber \\{} & {} \qquad \qquad \exp \left( -2\pi i \left[ - {\tilde{n}}\left( \frac{\alpha \sigma +\beta }{\gamma \sigma +\delta }\right) +T{\tilde{\ell }}\left( \frac{\alpha \sigma +\beta }{\gamma \sigma +\delta }\right) +n\sigma \right] \right) . \end{aligned}$$
(6.18)

Using

$$\begin{aligned} \frac{\alpha \sigma +\beta }{\gamma \sigma +\delta } = \frac{\alpha }{\gamma }-\frac{1}{\gamma (\gamma \sigma +\delta )} \end{aligned}$$
(6.19)

and the expressions for \({\tilde{n}},{\tilde{\ell }}\) given in (6.2), we get

$$\begin{aligned} \begin{aligned}&\frac{(-1)}{2\pi i} \sum _{\begin{array}{c} P\\ b\in {\mathbb {Z}}/a{\mathbb {Z}}, \; T \in {\mathbb {Z}}/\gamma {\mathbb {Z}} \end{array}} {(\gamma \sigma +\delta )^{11}} \sum _{M,N\ge -1} \frac{L}{{\tilde{\ell }}} \, d(M) \, d(N) \, e^{-2\pi i \left( - {\tilde{n}}\frac{\alpha }{\gamma }+T{\tilde{\ell }}\frac{\alpha }{\gamma } \right) } \\&\left[ e^{-2\pi i\left( n\sigma +\frac{1}{\gamma (\gamma \sigma +\delta )}\left( \frac{1}{c^2}M\right) \right) }- e^{-2\pi i\left( n\sigma +\frac{1}{\gamma (\gamma \sigma +\delta )}\left( \frac{1}{a^2}N\right) \right) } \right] . \end{aligned} \end{aligned}$$
(6.20)

We will integrate over \(\sigma _1\) following the procedure described below (6.9). The integration over the Ford circle \(\Gamma \) will select the values \(M=-1\) and \(N=-1\) in (6.20), respectively. Let us then focus on these terms in (6.20). We first consider the contribution from \(M=-1\). Inserting \(M=-1\) into the expression for L and \({{{\tilde{\ell }}}} \in {\mathbb {Z}}\) given in (6.2), we see immediately that the integrality of these two variables, combined with \(\gcd (a, c)=1\), fixes \(c=-1\). Then, we obtain the contribution

$$\begin{aligned} \frac{(-1)}{2\pi i}{} & {} \sum _{\begin{array}{c} P\\ b\in {\mathbb {Z}}/a{\mathbb {Z}}, \; T \in {\mathbb {Z}}/\gamma {\mathbb {Z}} \end{array}} {(\gamma \sigma +\delta )^{11}} \sum _{\begin{array}{c} N> -1\\ M=-1 \end{array}} \frac{L}{{\tilde{\ell }}} \, d(N) \nonumber \\{} & {} e^{-2\pi i \left( - {\tilde{n}}\frac{\alpha }{\gamma }+T{\tilde{\ell }}\frac{\alpha }{\gamma } \right) } e^{-2\pi i\left( n\sigma -\frac{1}{\gamma (\gamma \sigma +\delta )}\right) }. \end{aligned}$$
(6.21)

Using (6.2) we infer

$$\begin{aligned} {{{\tilde{n}}}} = - b + \frac{(1-b)}{a^2} N = -1 + \frac{(1-b)}{a} \, {{{\tilde{\ell }}}}, \end{aligned}$$
(6.22)

where \(a | 1-b\), since \(a d - b c = a d + b = 1\). We perform the decomposition

$$\begin{aligned} \frac{(1-b)}{a} = A + k \, \gamma , \end{aligned}$$
(6.23)

where \(A \in {\mathbb {Z}}/ \gamma {\mathbb {Z}}\) and \(k \in {\mathbb {Z}}\). Then, the exponent in (6.21) becomes

$$\begin{aligned} e^{- 2 \pi i \frac{\alpha }{\gamma } \left( 1 + \left( - A + T \right) {{{\tilde{\ell }}}} \right) }. \end{aligned}$$
(6.24)

Since both A and T lie in \({\mathbb {Z}}/ \gamma {\mathbb {Z}}\), we can absorb A into T, thereby arriving at

$$\begin{aligned} e^{- 2 \pi i \frac{\alpha }{\gamma } \left( 1 + T {{{\tilde{\ell }}}} \right) } \;\;,\;\;\; T \in {\mathbb {Z}}/ \gamma {\mathbb {Z}}. \end{aligned}$$
(6.25)

Thus, we may replace the exponent in (6.21) with exponent (6.25), which is independent of \({{\tilde{n}}}\). This we use in the cancellation argument that we now present.

Let us consider

$$\begin{aligned} \frac{L}{{\tilde{\ell }}} = \frac{a-\frac{N}{a}}{a+\frac{N}{a}}, \end{aligned}$$
(6.26)

where a|N, since \(L, {{{\tilde{\ell }}}} \in {\mathbb {Z}}\). If \(N>0\), then for each divisor a of N, there will be another divisor \(a' = \frac{N}{a}>0\) which contributes

$$\begin{aligned} \frac{L'}{{\tilde{\ell }}'} = \frac{a'-\frac{N}{a'}}{a'+\frac{N}{a'}} = \frac{\frac{N}{a}-a}{\frac{N}{a}+a} = -\frac{L}{{\tilde{\ell }}}. \end{aligned}$$
(6.27)

Since \({\tilde{\ell }}' = {\tilde{\ell }}\), this contribution will cancel against contribution (6.26) in (6.21). Thus, (6.21) does not receive contributions from \(N >0\).

When \(N=0\), we have \(L/{\tilde{\ell }} = 1\), \({{{\tilde{\ell }}}} = a\), \({{{\tilde{n}}}} = - b\). Now we recall that T-transformation (4.25) can be viewed as either imposing the restriction \(b\in {\mathbb {Z}}/a{\mathbb {Z}}\) or \(d\in {\mathbb {Z}}/(-c{\mathbb {Z}})\). We choose the latter viewpoint, in which case we may set \(d=0\), since \(c=-1\). Then \(a d - bc =1\) implies \(b=1\), and we obtain from (6.21),

$$\begin{aligned}{} & {} \frac{(-1)}{2\pi i} d(0) \sum _{\gamma >0} \; \sum _{\begin{array}{c} 0 \le \alpha , -\delta < \gamma \\ \alpha \delta = 1 \text { mod } \gamma \end{array}}\sum _{T\in {\mathbb {Z}}/\gamma {\mathbb {Z}}} {(\gamma \sigma +\delta )^{11}} \nonumber \\{} & {} \quad \; \, e^{-2\pi i \left( \frac{\alpha }{\gamma }+T a\frac{\alpha }{\gamma } \right) } e^{-2\pi i\left( n\sigma -\frac{1}{\gamma (\gamma \sigma +\delta )}\right) }. \end{aligned}$$
(6.28)

Summing over T restricts a to

$$\begin{aligned} \sum _{T\in {\mathbb {Z}}/\gamma {\mathbb {Z}}}e^{-2\pi i T a\frac{\alpha }{\gamma }} = \left\{ \begin{aligned}&0{} & {} \gamma \not \mid a \\&\gamma{} & {} \gamma \mid a \end{aligned}\right. \end{aligned}$$
(6.29)

Therefore, only when \(a=k \,\gamma \), with \(k \in {\mathbb {N}}\), do we get a contribution to (6.28),

$$\begin{aligned}{} & {} \frac{(-1)}{2\pi i} d(0) \, \sum _{\gamma>0} \sum _{\begin{array}{c} 0 \le \alpha , -\delta < \gamma \\ \alpha \delta = 1 \text { mod } \gamma \end{array}}\sum _{\begin{array}{c} k>0 \end{array}} \gamma \, {(\gamma \sigma +\delta )^{11}} \, e^{-2\pi i \frac{\alpha }{\gamma }}\nonumber \\{} & {} \qquad e^{-2\pi i\left( n\sigma -\frac{1}{\gamma (\gamma \sigma +\delta )}\right) }. \end{aligned}$$
(6.30)

The sum over \(k>0\) is divergent. We regularize this sum by replacing it with

$$\begin{aligned} \zeta (0) = -\frac{1}{2}, \end{aligned}$$
(6.31)

where \(\zeta (s)\) denotes the Riemann zeta function.

Next, performing the \(\sigma \)-integral over the Ford circle \(\Gamma _{\sigma }\) following the procedure described below (6.9), we obtain

$$\begin{aligned}{} & {} -\frac{1}{2}d(0)\frac{1}{2\pi i} \sum _{\gamma >0} \; \sum _{\begin{array}{c} 0 \le \alpha , -\delta < \gamma \\ \alpha \delta = 1 \text { mod } \gamma \end{array}}\nonumber \\{} & {} \quad e^{2\pi i \left( -\frac{\alpha }{\gamma } + n\frac{\delta }{\gamma }\right) } \, \frac{(2\pi )^{12}}{\gamma ^{12}} \int \limits _{\epsilon -i\infty }^{\epsilon +i \infty } \frac{\textrm{d}t}{t^{13} } \, e^{t +4\pi ^2 \frac{n}{\gamma ^2}\frac{1}{t}}, \end{aligned}$$
(6.32)

which, when written in terms of classical Kloosterman sum (6.17) and modified Bessel function (5.30), equals

$$\begin{aligned} -12\sum _{\gamma >0} \textrm{Kl} (n,-1,\gamma )\frac{1}{n^6} I_{12}\left( \frac{4\pi \sqrt{n}}{\gamma } \right) , \end{aligned}$$
(6.33)

where we have used \(d(0) = 24\).

This is the contribution stemming from the \(M=-1, N>-1\) terms. The contribution from the \(M>-1, N=-1\) terms is exactly the same, so that in total we obtain

$$\begin{aligned} -24\sum _{\gamma >0} \textrm{Kl} (n,-1,\gamma )\frac{1}{n^6} I_{12}\left( \frac{4\pi \sqrt{n}}{\gamma } \right) . \end{aligned}$$
(6.34)

6.3 Complete Result for \(\Delta = m = \ell =0\)

Adding up contributions (6.16) and (6.34) from the two sectors \({\tilde{\ell }}=0\) and \({\tilde{\ell }}\ne 0\), we get for the degeneracy d(0, n, 0) of BPS dyons with charge bilinears \((m=0, n, \ell =0)\),

$$\begin{aligned} d(0,n,0)= \sum _{\gamma \ge 1} \textrm{Kl}(n,-1,\gamma )\left( \frac{4\pi }{\gamma \,n^{11/2}} I_{11}\left( \frac{4\pi \sqrt{n}}{\gamma } \right) -\frac{24}{n^6} I_{12}\left( \frac{4\pi \sqrt{n}}{\gamma } \right) \right) .\nonumber \\ \end{aligned}$$
(6.35)

This is in agreement with the expression for the degeneracy of immortal BPS dyons generated by the quasi-modular form [10, 13, 24]

$$\begin{aligned} 2\frac{E_{2}(\sigma )}{\eta ^{24}(\sigma )} = \sum _{n\ge -1} c(n)q^n . \end{aligned}$$
(6.36)

Its Rademacher expansion, which we review in Appendix C, can be obtained by means of the quasi-modular transformation property

$$\begin{aligned} 2\frac{E_{2}(\sigma )}{\eta ^{24}(\sigma )} = (\gamma \sigma +\delta )^{10} \; 2\frac{E_{2}\left( \frac{\alpha \sigma +\beta }{\gamma \sigma +\delta }\right) }{\eta ^{24}\left( \frac{\alpha \sigma +\beta }{\gamma \sigma +\delta }\right) }- \frac{12\gamma }{\pi i }\frac{(\gamma \sigma +\delta )^{11}}{\eta ^{24}\left( \frac{\alpha \sigma +\beta }{\gamma \sigma +\delta }\right) }, \end{aligned}$$
(6.37)

and reads

$$\begin{aligned} c(n) = \sum _{\gamma =1}^{+\infty } \textrm{Kl} (n,-1,\gamma ) \left( \frac{24}{n^6}I_{12}\left( \frac{4\pi \sqrt{n}}{\gamma }\right) -\frac{4\pi }{\gamma \, n^{11/2}}I_{11}\left( \frac{4\pi \sqrt{n}}{\gamma }\right) \right) . \end{aligned}$$
(6.38)

This precisely agrees with (6.35),

$$\begin{aligned} (-1)c(n) = d(0,n,0). \end{aligned}$$
(6.39)

Finally, we note that the extra sign stemming from zeta function regularization (6.31) is crucial for obtaining agreement with the expression of Rademacher expansion (6.38).

7 Conclusions

By using two distinct \(\textrm{SL}(2, {\mathbb {Z}})\) subgroups of \(\textrm{Sp}(2, {\mathbb {Z}})\) we have obtained a Rademacher-type expansion for the exact degeneracies of \(\frac{1}{4}\) BPS states with unit torsion in heterotic string theory compactified on a six torus. This expansion is obtained by summing over the contributions from quadratic poles (3.16) of \(1/\Phi _{10}\). The resulting expansion is given by (5.126) in the case when \(\Delta > 0\), and by (6.35) in the case when \(\Delta = m = \ell =0\). When \(\Delta > 0\), the exact expression for the degeneracies exhibits a fine-grained structure that is tied to the presence of the two sets \(S_G\) and \(S_{\Gamma }\) of \(\textrm{SL}(2, {\mathbb {Z}})\) matrices. Result (5.126) reproduces the expression that was obtained in [11] by a very different approach, namely by the Rademacher expansion of the Fourier coefficients of the mixed Mock Jacobi forms \(\psi _m^F\). The latter were shown in [13] to encode the coefficients \(d(m, n, \ell )\) computed in a region [25] where there are no linear pole contributions when \(n>m\). These coefficients are called immortal degeneracies. The Rademacher expansion in this case involved information about the shadow which repairs the modular behaviour of \(\psi _m^F\). The Mock behaviour manifests itself through the \(I_{12}\) and the \(I_{25/2}\) terms in (5.126), both of which would be absent in the case of a modular form. In our approach, the v-integral yields error functions, each of which can be split into three distinct types of terms, namely a constant, a term involving \(E_{m,\gamma (\gamma \sigma +\delta )}\) and a term involving \(I_{m,\gamma (\gamma \sigma +\delta )}\) (c.f. (4.38) and (4.39)). These, respectively, yield the \(I_{23/2}\) terms, the \(I_{12}\) term and the \(I_{25/2}\) term. Further, the sum over \(S_G\) matrices which have a non-vanishing contribution to the \(I_{25/2}\) term yields an integral of a Jacobi theta function minus a constant term. This, when added to the regularized contribution from the \(E_{m,\gamma (\gamma \sigma +\delta )}\) terms, yields precisely the Eichler integral of the shadow for \(\psi _m^F\). Further, the restriction on the range of \(v_1\), which arises by demanding that the poles lie in the \(\sigma \) upper half plane, coupled with the constraint \(v_2/\sigma _2 = - \ell /2m\), reveals the continued fraction structure underlying the polar coefficients \(c^F_m({\tilde{n}},{\tilde{\ell }})\). This structure is not revealed in the approach of [11].

If microscopic result (5.126) is to be obtained from a suitably defined gravity path integral, such as the quantum entropy function [26], then the latter has to make use of the two \(\textrm{SL}(2, {\mathbb {Z}})\) subsets \(S_G\) and \(S_{\Gamma }\). How these two subsets are built into the quantum entropy function is an interesting research question worth exploring [17]. Earlier work [16, 27] on the quantum entropy function for this heterotic model did not identify the distinct roles played by \(S_G\) and \(S_{\Gamma }\). Moreover, inspection of (5.126) shows that the series associated with the Bessel function \(I_{23/2}\) is organized in powers of \(1/\gamma \), and not in powers of \(1/n_2\) as in the semi-classical asymptotic expansion [16, 23, 28] (we recall that \(n_2 = - a c \gamma \)). The dependence on ac in the argument of \(I_{23/2}\) is encoded in \({\tilde{\Delta }}\) through expression (5.14). The results in this paper constitute the non-perturbative completion of the semi-classical results that exist in the literature. Understanding how the Rademacher expansion can be used to rigorously write down the quantum entropy function for immortal degeneracies associated with single centre \(\frac{1}{4}\) BPS black holes in this heterotic model is a challenging question.