# What is the best numerical method for a six dimensional spherical integral?

I am trying to do integrals of the type $$\int d^3\vec{p} \int d^3\vec{p}' e^{-p^2} e^{-{p'}^2}f(\vec{p}, \vec{p}')$$ where $\vec{p}$ and $\vec{p}'$ are three dimensional vectors represented using spherical coordinates, $\vec{p} = \{p,\theta,\phi\}$, and $f$ is a non-trivial, potentially complex, function. The integrals over $\phi$ and $\phi'$ can be done analytically even though the answers are rather complicated. However that is not true for the other integrals.

So I was wondering what would be the best method to approach this problem or if there are any packages (preferably for python) that do this kind of integrals. I plan to try SciPy's nquad but I hear that it is not suggested for integrals weighted by $e^{-p^2}$.

• How cheap (relatively) is the evaluation of $f$? – Anton Menshov Aug 14 '18 at 18:54
• Not quite sure, but $f$ is a product of rational functions of the $p$'s, Laguerre polynomials involving $p$'s and trig functions involving the angles. So I would think that evaluation is not too costly. However the function is quite oscillatory. – e-eight Aug 14 '18 at 19:03
• I assume that your integral extend to infinity, am I right? – nicoguaro Aug 14 '18 at 19:48
• Like I said the integrals over $\phi$ and $\phi'$ can be done analytically but the integrals over $\theta$ and $\theta'$ cannot be. The function is such that the variables cannot be seperated, for example $f$ can be $F(p,p')/(p^2 + p'^2 + 2pp'\cos\theta\cos\theta' + 2pp'\sin\theta\sin\theta'\cos(\phi-\phi') + a^2)$. – e-eight Aug 14 '18 at 23:10
• You might find the answers to this question useful too. – Daniel Shapero Aug 15 '18 at 1:22

• @Zythos In most cases of interest you can convert the integrals to hypercubes by a change of variables. For example in the integral that I posted here, using the transformations $p = q/(1-q)$, $\theta = \pi t$, $\phi = 2\pi u$, and likewise for their primed counterparts will convert the integration region to a hypercube. Does not mean that the Genz-Malik will always work (as I am finding out), but it can still be applied. – e-eight Aug 20 '18 at 16:16