I'm reading a book on Nucleosynthesis. It has this formula for the number density of a species:$$n_i=g_i\space e^{\mu_i/T}\int\frac{d^3p}{(2\pi)^3}e^{-E_1/T}$$I don't recognize this notation. How do you implement $\int{d^3p}$ in Mathematica?

  • 2
    $\begingroup$ This, regrettably, has nothing to do with Mathematica though. Once you figure out what the formula means (which we cannot do considering that you do not provide a link to the source), then you could ask for help implementing it. $\endgroup$
    – MarcoB
    Mar 17, 2021 at 22:31
  • $\begingroup$ @MarcoB - Thanks for the suggestion. I've tried to make it more focused for Mathematica users. $\endgroup$
    – Quark Soup
    Mar 17, 2021 at 22:36

1 Answer 1


$d^3p$ is the volume element of momentum space, I think. So, $p$ is a point in 3 dimensional space; therefore an infinitesimal volume element in this space will be sort of...thrice $d$'d, one time for each axis. In other words, $d^3p = dp_1\ dp_2\ dp_3$, where $p=(p_1, p_2, p_3)$.

Note that $\int d^3p$ is notationally equivalent to $\iiint dp_1\ dp_2\ dp_3$, and unless you're in a weird analysis setting, you can perform each separate integration in whatever order you choose, e.g. $\int dp_2 \left(\int dp_1 \left(\int dp_3 f(p_1,p_2,p_3)\right)\right)$. Luckily, Mathematica doesn't require you to explicitly nest integrals like this; you can account for all of the integrated-over variables in a single Integrate.

So, you could implement the integral part of that formula as something like

Integrate[Exp[-Ei[{p1, p2, p3}] / T] / (2 Pi)^3,
          {p1, -Infinity, Infinity},
          {p2, -Infinity, Infinity},
          {p3, -Infinity, Infinity}]

which will integrate over the full extent of all variables (newlines not important, just for layout here).

  • $\begingroup$ Comments are not for extended discussion; this conversation has been moved to chat. $\endgroup$
    – Kuba
    Mar 20, 2021 at 5:44
  • $\begingroup$ @Kuba We specifically stayed in comments because there is no latex support in chat—I tried to move it to chat at one point, but given the latex-heavy nature of this particular discussion, reading it was just impractical. Would it be possible to move it back? (Though, it might be over now anyway, so the point might be moot.) $\endgroup$
    – thorimur
    Mar 20, 2021 at 6:14
  • $\begingroup$ I understand but that still does not make comments a place for discussions :) It is over anyway. :) $\endgroup$
    – Kuba
    Mar 20, 2021 at 7:18
  • $\begingroup$ @Kuba - You are not cleaning up the board, you are destroying useful information. We were not talking about the weather, we were working out a practical solution to the question with the only language available to do this: MathJax. Until you support MathJax in chat, you're doing more harm than good. $\endgroup$
    – Quark Soup
    Mar 20, 2021 at 14:38
  • $\begingroup$ @Quarkly I have nothing to do with MathJax in chat, moderators are part of the community, not the SE team. I did not say it was about the weather or spam. I said that comments are not for discussion and then you say they are because of MJ... The truth is that SE model does not fit all needs. They have rules we try to obey, those comments were even automatically flagged to us. I have nothing against a comment or two with useful or not information. But 20+ of them is only confusing. It also seems the thread was over yet no one cleaned it up. I have no remorse. $\endgroup$
    – Kuba
    Mar 21, 2021 at 4:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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