Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Gaussian integral in Mathematica

  1. Jun 23, 2007 #1
    How can I evaluate something like

    [tex]\int^{\infty}_{-\infty} d^3 \mathbf{x} f(\mathbf{x}) e^{t g(\mathbf{x})}[/tex]

    in Mathematica, where x is a vector in 3D?
  2. jcsd
  3. Jun 23, 2007 #2
    When you say:


    It means that you want to integrate over all space, so first you need to pick a set of coordinates (which will probably depend on the coordinates in which you have f(x) and g(x) expressed). If you use Cartesian (the simplest) then

    d^3x = dxdydz

    and now how you have to do a triple integral (one integral for dx where you think of y and z as constants, one for dy where you think of x and z and constants, and similarly for dz). So the Mathematica code would look like:

    Integrate[ Integrate[ Integrate[ f(x,y,z)*Exp[t*g(x)], {x,-Infinity, Infinity}], {y,-Infinity, Infinity}], {z,-Infinity, Infinity}]

    Where you have to supply the forms for f(x,y,z) and g(x,y,z).

    If, on the other hand, you need to do it in spherical or cylindrical coordinates, then you have to add in a few more factors, which I could explain if you need them. Perhaps you already know all the math and just needed the syntax, in which case I apologize for telling you all this that you already knew, but I figured too much would be better than too little :cool:

    Last edited: Jun 23, 2007
  4. Jun 23, 2007 #3
    humm, yeah thanks man. I was hoping there would be a way to do it without expanding x... ah well, cheers mate.
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Have something to add?

Similar Discussions: Gaussian integral in Mathematica