Re: Integrating Gaussians

*To*: mathgroup at yoda.ncsa.uiuc.edu*Subject*: Re: Integrating Gaussians*From*: uunet!wri!keiper*Date*: Mon, 4 Jun 90 14:23:53 CDT

One way to trick Mathematica into evaluating Erf[] at infinities when the sign of the argument is unknown is to do the following: In[1]:= Unprotect[Erf] Out[1]= {Erf} In[2]:= Erf[DirectedInfinity[1] * ___] = 1 Out[2]= 1 In[3]:= Erf[DirectedInfinity[-1] * ___] = -1 Out[3]= -1 In[4]:= Integrate[Exp[-x^2/(2 sigma^2)],{x,-Infinity,Infinity}] Out[4]= Sqrt[2] Sqrt[Pi] sigma It will still be smart enough to figure out what to do with signed numbers: In[5]:= Erf[DirectedInfinity[1] * (-2)] Out[5]= -1 but if you have in mind a negative value for sigma it will give the wrong answer.