Normal Distributions in Mma 2.1
- To: mathgroup at yoda.physics.unc.edu
- Subject: Normal Distributions in Mma 2.1
- From: mek at guinan.psu.edu (Mark E. Kotanchek)
- Date: Mon, 30 Aug 93 22:08:53 -0400
Hi,
I was making sure some arguments I was about to make were, in fact, valid
involving FFTs of Gaussian signals when I discovered that Mathematica 2.1 on my
NeXTstation isn't quite accurate. Loading in
In[2]:=
Needs["Statistics`ContinuousDistributions`"]
Needs["ftpAlgebra`Declare`"]
{Declare, NewDeclare, NonPositive, RealQ}
and defining the p.d.f of a normal distribution and checking the distribution
and the mean leads to
fx = PDF[NormalDistribution[mu,sigma],x]
Integrate[fx,{x,-Infinity,Infinity}]
Integrate[x fx, {x,-Infinity,Infinity}]
Out[6]=
2 -2
Sqrt[mu ] Sqrt[sigma ] sigma
-----------------------------
mu
Out[7]=
2 -2
Sqrt[mu ] Sqrt[sigma ] sigma
which isn't exactly aesthetic, even if it may be technically correct. However,
if we define x, mu (the mean) and sigma (the standard deviation) to be real and
restrict sigma to be non-negative, we get,
Declare[{x, mu, sigma}, Real]
Declare[sigma,NonNegative]
Integrate[fx,{x,-Infinity,Infinity}]
Integrate[x fx, {x,-Infinity,Infinity}]
Out[10]=
Abs[mu]
------- <----- should be "1"
mu
Out[11]=
Abs[mu] <------ should be "mu"
which is clearly wrong since the integral of the p.d.f. is, by definition,
equal to one and this result would lead to -1 if mu were negative. Similarly,
the mean should be equal to mu.
OK, I thinks, maybe Mma doesn't like the potential for a standard deviation
equal to zero. I refine the definitions and, alas, get the same results....
In[14]:=
Declare[sigma,Positive]
Integrate[fx,{x,-Infinity,Infinity}]
Integrate[x fx, {x,-Infinity,Infinity}]
Out[13]=
Abs[mu]
-------
mu
Out[14]=
Abs[mu]
I assume that this sort of misbehavior has been reported to WRI. The question
is whether it has been fixed in Mma 2.2 which should be wandering my way
eventually?
Mark.
---
Mark Kotanchek
Guidance & Control Dept - 363 ASB
Applied Research Lab/Penn State
P.O. Box 30
State College, PA 16804
e-mail: mek at guinan.psu.edu (NeXTmail)
TEL: (814)863-0682
FAX: (814)863-7843