# [Numpy-tickets] [NumPy] #923: numpy.random.logseries - incorrect convergence for k=1, k=2

NumPy numpy-tickets@scipy....
Thu Oct 2 22:19:49 CDT 2008

```#923: numpy.random.logseries - incorrect convergence for k=1, k=2
--------------------------+-------------------------------------------------
Reporter:  josefpktd     |        Owner:  somebody
Type:  defect        |       Status:  new
Priority:  normal        |    Milestone:
Component:  numpy.random  |      Version:  none
Severity:  normal        |   Resolution:
Keywords:                |
--------------------------+-------------------------------------------------
Comment (by josefpktd):

When comparing the c implementation in
http://scipy.org/scipy/numpy/browser/trunk/numpy/random/mtrand/distributions.c
with the python implementation from
http://pal.ece.iisc.ernet.in/~dhani/frohne/rv.py

it looks like that the numpy implementation only considers the algorithm
for the case  # p is >= 0.95, however not the algorithm for  p < 0.95.

However, running the above frequency test script, I get the opposite
result, good approximation for very low p, while with high p, the
convergence is pretty bad, so maybe the cases are reversed, but this is
just guessing based on my sampling script.

with prob p=0.02, I get

{{{
check frequency of k=1 and k=2 at N =  1000000
0.989877 0.009962
pmf at k = 1 and k=2 with formula
[ 0.99    0.0099]
}}}

with prob p=0.95, I get

{{{
check frequency of k=1 and k=2 at N =  1000000
0.200349 0.267545
pmf at k = 1 and k=2 with formula
[ 0.3171  0.1506]
}}}

Josef

--
Ticket URL: <http://scipy.org/scipy/numpy/ticket/923#comment:1>
NumPy <http://projects.scipy.org/scipy/numpy>
The fundamental package needed for scientific computing with Python.
```