[Scipy-tickets] [SciPy] #769: scipy.stats.distributions.genextreme.pdf return nan for x=1 and c=1, which is wrong.

SciPy scipy-tickets@scipy....
Sun Nov 16 23:55:35 CST 2008


#769: scipy.stats.distributions.genextreme.pdf return nan for x=1 and c=1, which
is wrong.
-------------------------+--------------------------------------------------
 Reporter:  pbrod        |        Owner:  somebody
     Type:  defect       |       Status:  new     
 Priority:  normal       |    Milestone:  0.7.0   
Component:  scipy.stats  |      Version:  devel   
 Severity:  normal       |   Resolution:          
 Keywords:               |  
-------------------------+--------------------------------------------------
Comment (by josefpktd):

 fix that has correct limiting behavior, committed in changeset:5140,
 please review
 Josef

 {{{
     def _pdf(self, x, c):
         ex2 = 1-c*x
         pex2 = pow(ex2,1.0/c)
         p2 = exp(-pex2)*pex2/ex2
 -        return p2
 +        limit = where(c == 1.0, 1.0, 0.0)
 +        return where(c*x == 1.0, limit, p2)
 }}}

 looks like correct limiting behavior:
 {{{
 python25 -c "from scipy import stats; print
 stats.genextreme.pdf([1-1e-6,1],1)"
 [ 0.999999  1.      ]

 python25 -c "from scipy import stats; print
 stats.genextreme.pdf([2-1e-6,2],0.5)"
 [  5.00000000e-07   0.00000000e+00]
 }}}

-- 
Ticket URL: <http://scipy.org/scipy/scipy/ticket/769#comment:2>
SciPy <http://www.scipy.org/>
SciPy is open-source software for mathematics, science, and engineering.


More information about the Scipy-tickets mailing list