MathGroup Archive 1992

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Integrating Normal Distributions gives the wrong answer

  • To: mathgroup at
  • Subject: Re: Integrating Normal Distributions gives the wrong answer
  • Date: 17 Sep 1992 01:14:23 -0700 (MST)

Mark Kotanchek (mek at writes: 
>  In any case, if I execute
>     mu=0;
>     Integrate[PDF[NormalDistribution[mu,sigma],x],{x,-Infinity,Infinity}]
>  I get an answer of
>       sigma
>     ----------
>     Abs[sigma]
>  rather than the expected "1". Following the discussion of "Adding a
>  conditional def to Sqrt", I implemented
>     Unprotect[Sqrt];
>     Sqrt[x_^y_] := x^(y/2)/;EvenQ[y];
>     Protect[Sqrt];
>     Unprotect[Power];
>     Power[x_^y_,z_] := x^(y/2) /; EvenQ[y] && z==1/2;
>     Protect[Power];
>  after which I got the desired result of "1". I don't know WHY this
>  worked and was wondering if y'all could explain it and whether v2.1
>  has such a "fix" implented or whether I need to remember to execute
>  this sequence every time I wanted to do symbolic computations....
As the person who suggested the rule for Power in the thread on "Adding a
conditional def for Sqrt", I should point out that several people alerted me
that there is a better solution: the built-in function PowerExpand, which
performs simplifications on expressions involving powers. This method is better
in most cases because it allows you to control the application of the
simplification rules (which of course are not valid for negative quantities),
rather than having them lurking in the background.
However, I suspected that there would be some examples where Mma would be
generating Power expressions internally during the course of evaluations, and
thus you would not be able to benefit from any simplifications induced by
PowerExpand. The example here seems to be such a case, although defining a rule
for Power would be overkill if just this one integration were needed. You could
just as easily write
         {x,-Infinity,Infinity}] /. Abs[sigma] -> sigma
Todd Gayley
Department of Ecology and Evolutionary Biology
University of Arizona
tgayley at       -or-        tgayley at

  • Prev by Date: More Graphics
  • Next by Date: Re: acting on a matrix
  • Previous by thread: Re: Integrating Normal Distributions gives the wrong answer
  • Next by thread: FindRoot