Re: Re: More Integrate woes
- To: mathgroup at smc.vnet.net
- Subject: [mg9706] Re: [mg9650] Re: More Integrate woes
- From: David Withoff <withoff>
- Date: Fri, 21 Nov 1997 01:31:54 -0500
- Sender: owner-wri-mathgroup at wolfram.com
> > In any statistical setting, calculation of the Gaussian distribution > > function is extremely important. Under Mathematica v3, this is > > something of a disaster. > > > > > > To summarise the problem: > > > > Under v3: > > ________ > > > > Expressions such as: > > > > aa = Integrate[Exp[-x^2],{x,-Infinity,y}, > > GenerateConditions->False] > > > > return output *of form*: > > > > 1 - Erf[Sqrt[y^2]] > > > > Our user now seeks numerical output. S/he enters: > > > > (aa /. y -> 3) == (aa/. y -> -3) > > True > > > > This is clearly FALSE. > > > Very strange!, > if you omit the "GenerateConditions->False" from the command, the output > from Mathematica 3 reads: > > If[y < 0, -(1/2)*Sqrt[Pi]*(Erf[Sqrt[y^2]] - 1), > Integrate[Exp[-x^2], x, -Infinity, y]] > > which implies that the Erf solution is only valid for negative y, and > now > > (aa /. y -> 3) == (aa/. y -> -3) > > returns False. > > However, for positive y Mathematica 3 does not seem to be able to > perform the integration! > > This may well be classified as a bug in this version of Mathematica. > > Cheers, > > Bill Bertram > ANSTO If you tell Mathematica that y is positive, then the integral works fine: In[5]:= Integrate[Exp[-x^2],{x,-Infinity,y}, Assumptions -> {y > 0}] Sqrt[Pi] (1 + Erf[y]) Out[5]= --------------------- 2 If you don't tell Mathematica that y is positive, then, as your examples show, Integrate returns the result in a form which is only valid when y is negative, so the condition y < 0 is necessary. The results are all mathematically correct, but since it is possible to return a simple result which is valid for all y, it would obviously be desirable to do so. This will probably change for some future version of Integrate. Results with unnecessary conditions arise in a fairly understandable way. If you do a calculation by hand, for example, and make an assumption about a parameter, it sometimes turns out that the opposite assumption would have led to an equivalent result, but the only way to find that out is to do the calculation a second time, or to do the calculation in a different way. The Integrate function only does the calculation once. It doesn't go back and do the calculation a second time to see if the assumptions that it made are necessary. Dave Withoff Wolfram Research