be aware!
- To: mathgroup at smc.vnet.net
- Subject: [mg14140] be aware!
- From: Zvi Wiener <mswiener at mscc.huji.ac.il>
- Date: Mon, 28 Sep 1998 03:51:52 -0400
- Sender: owner-wri-mathgroup at wolfram.com
Dear Steve:
Below is my message to the Mathematica newsgroup.
************************************************************* When
calculating the standard normal distribution I have discovered some
very strange behavior of Mathematica 3.0.1 on PC. Note that the 3 ways
below must be equivalent:
subst={mu->0.2,sg->1.2};
Integrate[Exp[-((z-mu)/sg)^2/2],{z,-Infinity,-0.1}]/Sqrt[2Pi]/sg/.subst
Integrate[Exp[-((z-mu)/sg)^2/2],{z,-Infinity, 0}]/Sqrt[2Pi]/sg/.subst
Integrate[Exp[-((z-mu)/sg)^2/2],{z,-Infinity, 0.1}]/Sqrt[2Pi]/sg/.subst
Out[]=0.401294
Out[]=0.433816
Out[]=0.400839 <----------- note this number!
m=0.2;
s=1.2;
Integrate[Exp[-((z-m)/s)^2/2],{z,-Infinity,-0.1}]/Sqrt[2Pi]/s
Integrate[Exp[-((z-m)/s)^2/2],{z,-Infinity, 0}]/Sqrt[2Pi]/s
Integrate[Exp[-((z-m)/s)^2/2],{z,-Infinity, 0.1}]/Sqrt[2Pi]/s
Out[]=0.401294
Out[]=0.433816
Out[]=0.466793
Needs["Statistics`ContinuousDistributions`"];
CDF[NormalDistribution[mu,sg]/.subst,-0.1]
CDF[NormalDistribution[mu,sg]/.subst, 0]
CDF[NormalDistribution[mu,sg]/.subst, 0.1]
Out[]=0.401294
Out[]=0.433816
Out[]=0.466793
Note that the third number (0.317757) is wrong! It is smaller that the
previous two, although it is an integral of a positive function over a
strictly bigger interval.
I understand that it is very difficult to integrate a function over an
infinite interval, but I am amazed that there was no warning. I
suggest somebody at Wolfram to fix it.
Zvi Wiener.
****************************************************************** Zvi
Wiener Business School
e-mail: mswiener at mscc.huji.ac.il Hebrew University tel:
972-2-588-3049 Mount Scopus
fax: 972-2-588-1341 Jerusalem 91905
http://pluto.huji.ac.il/~mswiener/zvi.html ISRAEL
******************************************************************