Re: Incorrect integral in Mathematica
- To: mathgroup at smc.vnet.net
- Subject: [mg91386] Re: Incorrect integral in Mathematica
- From: Jean-Marc Gulliet <jeanmarc.gulliet at gmail.com>
- Date: Tue, 19 Aug 2008 07:16:08 -0400 (EDT)
- Organization: The Open University, Milton Keynes, UK
- References: <g8b8t8$8pq$1@smc.vnet.net>
Eran Mukamel wrote:
> I'm getting a nonsensical answer of 0 for the following integral in Mathematica 5.0 (Mac OSX):
>
> Integrate[Exp[-x^2/(2w^2)]Exp[-(y - y0)^2/(2z^2)],
> {x, -Infinity, Infinity}, {y, -Infinity, Infinity}]
>
> The result should be (2 Pi w z). Any ideas why this fails?
Seems to be a bug. Note that the result you expect is valid only for
both w and z real and of same sign, so you may want to add some
assumptions (either with Assuming[] or the option Assumptions -> ...)
Mathematica 6.0.3 gives a complete and correct solution.
In[1]:= Integrate[
Exp[-x^2/(2 w^2)] Exp[-(y - y0)^2/(2 z^2)], {x, -Infinity,
Infinity}, {y, -Infinity, Infinity}]
Out[1]= (1/Sqrt[(1/(z^2))])Sqrt[2 \[Pi]]
If[Re[w^2] > 0, Sqrt[2 \[Pi]]/Sqrt[1/w^2],
Integrate[E^(-(x^2/(2 w^2))), {x, -\[Infinity], \[Infinity]},
Assumptions -> Re[w^2] <= 0]]
In[2]:= Assuming[Element[w | z, Reals],
Integrate[
Exp[-x^2/(2 w^2)] Exp[-(y - y0)^2/(2 z^2)], {x, -Infinity,
Infinity}, {y, -Infinity, Infinity}]]
Out[2]= 2 \[Pi] Abs[w] Abs[z]
In[3]:= $Version
Out[3]= "6.0 for Mac OS X x86 (64-bit) (May 21, 2008)"
Regards,
-- Jean-Marc