[SciPy-dev] bug in scipy.stats.norm.cdf ?
John Hunter
jdh2358 at gmail.com
Sun Mar 4 17:27:47 EST 2007
On 3/4/07, John Hunter <jdh2358 at gmail.com> wrote:
> I was surprised by the nans in the cdf output below; ditto for the
> survival function which is probably using the same code (svn scipy
> compiled for OS X panther python2.3)
In case this helps one of the scipy gurus -- I've narrowed the bug to
scipy.special_cephes.erf but haven't been able to narrow it further.
I wonder if this is related to a platform specific nan test.... Do
others see this?
In [20]: import scipy.special._cephes as c
In [21]: x = scipy.arange(-3, -2, 0.1)
In [22]: x
Out[22]: array([-3. , -2.9, -2.8, -2.7, -2.6, -2.5, -2.4, -2.3, -2.2, -2.1])
In [23]: c.erf(x)
Out[23]:
array([-0.99997791, -0.9999589 , -0.99992499, -0.99986567, -0.99976397,
nan, -0.99931149, -0.99885682, -0.99813715, -0.99702053])
In [24]: x[5]
Out[24]: -2.5
In [25]: c.erf(x[5])
Out[25]: nan
In [26]: c.erf(float(x[5]))
Out[26]: nan
In [27]: c.erf(-2.5)
Out[27]: -0.999593047983
More information about the SciPy-Dev
mailing list