[SciPy-dev] bug in scipy.stats.norm.cdf ?

eric jones eric@enthought....
Sun Mar 4 16:39:00 CST 2007


It looks like it works with latest install of Python -- Enthought 
Edition on WinXP.  This is python 2.4.3.

In [81]: from scipy.special import _cephes as c

In [83]: a
Out[83]: array([-3. , -2.9, -2.8, -2.7, -2.6, -2.5, -2.4, -2.3, -2.2, -2.1])

In [85]: c.erf(a)
Out[85]:
array([-0.99997791, -0.9999589 , -0.99992499, -0.99986567, -0.99976397,
       -0.99959305, -0.99931149, -0.99885682, -0.99813715, -0.99702053])

In [86]: import scipy
In [87]: scipy.__version__
Out[87]: '0.5.3.dev2749'

In [88]: import numpy
In [89]: numpy.__version__
Out[89]: '1.0.2.dev3552'

John Hunter wrote:
> On 3/4/07, John Hunter <jdh2358@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
> _______________________________________________
> Scipy-dev mailing list
> Scipy-dev@scipy.org
> http://projects.scipy.org/mailman/listinfo/scipy-dev
>
>   



More information about the Scipy-dev mailing list