Repository: scipy/scipy

Issue:
MAINT: There is no unittest and documentation of Improper integral in multiple integrals.
I appreciate Scipy's excellent code. I would like to make a suggestion to make it even better.

From the tutorial (https://docs.scipy.org/doc/scipy/tutorial/integrate.html), it appears that scipy's integrate.dblquad supports Improper integral. On the other hand, there is no mention of it in the unittest (https://github.com/scipy/scipy/blob/main/scipy/integrate/tests/test_quadpack.py) and documentation (https://docs.scipy.org/doc/scipy/reference/generated/scipy.integrate.dblquad.html). I think it would be better if we did a unittest on Improper integral for multiple integrals in scipy and clarify the scope of support in the documentation.

I would like to work on this issue, any opinions? 


Discussion:
@derbuihan thanks for your patience. I do think `dblquad` can handle infinite limits of integration. (I'm not sure about other improper integrals... it doesn't accept `points` like `quad` does.) Are you still interested in writing unit tests and examples? I would review it.
I can confirm that `dblquad` (and `tplquad`) support both.
@derbuihan are you still free to work on this issue? Otherwise, @jdilanzo I think this would be a good issue for you to get started with.
Thanks @Kai-Striega, if there's no word from @derbuihan by the time the weekend rolls around I will take a look at this! 

Resolving patch:
diff --git a/scipy/integrate/_quadpack_py.py b/scipy/integrate/_quadpack_py.py
--- a/scipy/integrate/_quadpack_py.py
+++ b/scipy/integrate/_quadpack_py.py
@@ -679,6 +679,7 @@ def dblquad(func, a, b, gfun, hfun, args=(), epsabs=1.49e-8, epsrel=1.49e-8):
     ``x`` ranging from 0 to 2 and ``y`` ranging from 0 to 1.
     That is, :math:`\\int^{x=2}_{x=0} \\int^{y=1}_{y=0} x y^2 \\,dy \\,dx`.
 
+    >>> import numpy as np
     >>> from scipy import integrate
     >>> f = lambda y, x: x*y**2
     >>> integrate.dblquad(f, 0, 2, 0, 1)
@@ -700,6 +701,15 @@ def dblquad(func, a, b, gfun, hfun, args=(), epsabs=1.49e-8, epsrel=1.49e-8):
     >>> integrate.dblquad(f, 0, 1, lambda x: x, lambda x: 2-x, args=(3,))
         (0.9999999999999999, 1.6653345369377348e-14)
 
+    Compute the two-dimensional Gaussian Integral, which is the integral of the
+    Gaussian function :math:`f(x,y) = e^{-(x^{2} + y^{2})}`, over
+    :math:`(-\\infty,+\\infty)`. That is, compute the integral
+    :math:`\\iint^{+\\infty}_{-\\infty} e^{-(x^{2} + y^{2})} \\,dy\\,dx`.
+
+    >>> f = lambda x, y: np.exp(-(x ** 2 + y ** 2))
+    >>> integrate.dblquad(f, -np.inf, np.inf, -np.inf, np.inf)
+        (3.141592653589777, 2.5173086737433208e-08)
+
     """
 
     def temp_ranges(*args):
@@ -803,6 +813,7 @@ def tplquad(func, a, b, gfun, hfun, qfun, rfun, args=(), epsabs=1.49e-8,
     That is, :math:`\\int^{x=2}_{x=1} \\int^{y=3}_{y=2} \\int^{z=1}_{z=0} x y z
     \\,dz \\,dy \\,dx`.
 
+    >>> import numpy as np
     >>> from scipy import integrate
     >>> f = lambda z, y, x: x*y*z
     >>> integrate.tplquad(f, 1, 2, 2, 3, 0, 1)
@@ -826,6 +837,16 @@ def tplquad(func, a, b, gfun, hfun, qfun, rfun, args=(), epsabs=1.49e-8,
     >>> integrate.tplquad(f, 0, 1, 0, 1, 0, 1, args=(3,))
         (0.375, 1.6581101126856635e-14)
 
+    Compute the three-dimensional Gaussian Integral, which is the integral of
+    the Gaussian function :math:`f(x,y,z) = e^{-(x^{2} + y^{2} + z^{2})}`, over
+    :math:`(-\\infty,+\\infty)`. That is, compute the integral
+    :math:`\\iiint^{+\\infty}_{-\\infty} e^{-(x^{2} + y^{2} + z^{2})} \\,dz
+    \\,dy\\,dx`.
+
+    >>> f = lambda x, y, z: np.exp(-(x ** 2 + y ** 2 + z ** 2))
+    >>> integrate.tplquad(f, -np.inf, np.inf, -np.inf, np.inf, -np.inf, np.inf)
+        (5.568327996830833, 4.4619078828029765e-08)
+
     """
     # f(z, y, x)
     # qfun/rfun(x, y)


Test patch: