title: How calculate a double integral accurately using python
body: <p>I'm trying to calculate a double integral given by :</p>
  <pre><code>import scipy.special as sc
  from numpy.lib.scimath import sqrt as csqrt
  from scipy.integrate import dblquad
  
  
  def g_re(alpha, beta, k, m):
      psi = csqrt(alpha ** 2 + beta ** 2 - k ** 2)
      return np.real(
          sc.jv(m, alpha)
          * sc.jv(m, beta)
          * sc.jv(m, alpha)
          * np.sin(beta)
          * sc.jv(m, -1j * psi)
          * np.exp(-psi)
          / (alpha ** 2 * psi)
      )
  
  
  def g_im(alpha, beta, k, m):
      psi = csqrt(alpha ** 2 + beta ** 2 - k ** 2)
      return np.imag(
          sc.jv(m, alpha)
          * sc.jv(m, beta)
          * sc.jv(m, alpha)
          * np.sin(beta)
          * sc.jv(m, -1j * psi)
          * np.exp(-psi)
          / (alpha ** 2 * psi)
      )
  
  
  k = 5
  m = 0
  
  tuple_args = (k, m)
  ans = dblquad(g_re, 0.0, np.inf, 0, np.inf, args=tuple_args)[0]
  ans += 1j * dblquad(g_im, 0.0, np.inf, 0, np.inf, args=tuple_args)[0]
  </code></pre>
  <p>The integration intervals are along the positive real axes ([0, np.inf[). When calculating I got the following warning :</p>
  <pre><code>/tmp/a.py:10: RuntimeWarning: invalid value encountered in multiply
    sc.jv(m, alpha)
  g/home/nschloe/.local/lib/python3.9/site-packages/scipy/integrate/quadpack.py:879: IntegrationWarning: The maximum number of subdivisions (50) has been achieved.
    If increasing the limit yields no improvement it is advised to analyze
    the integrand in order to determine the difficulties.  If the position of a
    local difficulty can be determined (singularity, discontinuity) one will
    probably gain from splitting up the interval and calling the integrator
    on the subranges.  Perhaps a special-purpose integrator should be used.
    quad_r = quad(f, low, high, args=args, full_output=self.full_output,
  </code></pre>
  <p>I subdivided the domain of integration but I still got the same warning. Could you help me please.</p>