4
$\begingroup$

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}$.

$\endgroup$
  • 1
    $\begingroup$ How cheap (relatively) is the evaluation of $f$? $\endgroup$ – Anton Menshov Aug 14 '18 at 18:54
  • $\begingroup$ 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. $\endgroup$ – monstergroup42 Aug 14 '18 at 19:03
  • $\begingroup$ I assume that your integral extend to infinity, am I right? $\endgroup$ – nicoguaro Aug 14 '18 at 19:48
  • 1
    $\begingroup$ 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)$. $\endgroup$ – monstergroup42 Aug 14 '18 at 23:10
  • 1
    $\begingroup$ You might find the answers to this question useful too. $\endgroup$ – Daniel Shapero Aug 15 '18 at 1:22
4
$\begingroup$

The Genz-Malik algorithm [1], as implemented in the cubature library, works well for computing 6-dimensional integrals.

[1] A. C. Genz and A. A. Malik, “Remarks on algorithm 006: An adaptive algorithm for numerical integration over an N-dimensional rectangular region,” Journal of Computational and Applied Mathematics, vol. 6, no. 4, pp. 295–302, Dec. 1980.

$\endgroup$
  • $\begingroup$ Looks interesting. I will try it and see if it works. $\endgroup$ – monstergroup42 Aug 15 '18 at 1:49
  • $\begingroup$ But, how could be used to integrate complicated boundaries? Is it possible? $\endgroup$ – Zythos Aug 18 '18 at 18:38
  • 1
    $\begingroup$ My understanding is that it can only work on hypercubes or regions that can be transformed into such. $\endgroup$ – Juan M. Bello-Rivas Aug 18 '18 at 19:01
  • 1
    $\begingroup$ @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. $\endgroup$ – monstergroup42 Aug 20 '18 at 16:16
  • 1
    $\begingroup$ @Zythos If you have a mesh defining the surface, you can use a surface parametrization method (see doc.cgal.org/latest/Surface_mesh_parameterization/… ) to turn the mesh into a more manageable domain (like a circle that can, in turn, be transformed into a rectangle via polar coordinates). $\endgroup$ – Juan M. Bello-Rivas Aug 21 '18 at 1:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.