<br><br><div><span class="gmail_quote">2005/7/13, David M. Cooke <<a href="mailto:cookedm@physics.mcmaster.ca">cookedm@physics.mcmaster.ca</a>>:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
On Tue, Jul 12, 2005 at 05:32:25PM -0300, Flavio Coelho wrote:<br>> Hi,<br>><br>> I am having problems with the poisson random number generators of both<br>> Numarray and Numeric.<br>> I can't replicate it when calling the function from the python cosonle, but
<br>> it has consistently malfunctioned when used within one of my scripts.<br>><br>> What happens is that it frequently return a value greater than zero when<br>> called with zero mean: poisson(0.0)<br>><br>
> Unfortunately My program is too big to send attached but I have confirmed<br>> the malfunction by printing both the mean and the result whenever it spits<br>> out a wrong result.<br>><br>> This is very weird indeed, I have run poisson millions of times by itsel on
<br>> the python console, without any problems...<br>><br>> I hope it is some stupid mistake, but when I replace the poisson function<br>> call within my program by the R equivalent command (rpois) via the rpy
<br>> wrapper, everything works just fine...<br>><br>> any Ideas?<br><br>This looks like bug #1123145 in Numeric:<br><br><a href="http://sourceforge.net/tracker/index.php?func=detail&aid=1123145&group_id=1369&atid=101369">
http://sourceforge.net/tracker/index.php?func=detail&aid=1123145&group_id=1369&atid=101369</a><br><br>which was fixed a few months ago. numarray, I believe, originally took<br>ranlib.c from Numeric, so it doesn't have this bug fix. Try replacing
<br>numarray's ranlib.c with the version from Numeric 24.0b2 (or CVS).</blockquote><div><br>
<br>
I  have  both numeric 23.7 and numarray 1.3.1 installed 
and on neither of them I could reproduce the bug when I called them
directly from the python interpreter. However they fail on mean 0.0
every time when called within my code. So it appears to me that the Bug
you mentioned is not what is causing my problem. It seems to stem from
interaction with the way its being called, maybe some carryover from
previous calls...<br>
this is the test I ran on the interpreter:<br>
[(poisson(i),i) for i in uniform(-20,20,1000) if i<=0] <br>
<br>
I also ran:<br>
<br>
 sum(poisson(0,100000))<br>
<br>
they both worked flawlessly. In the first test I wanted to see if there
was some carry over from previous runs when called with various means
(which is closer to the way it is used within my code), but it returned
zero every time. (I don't use negative means in my code, but I wanted
to try it here just in case)<br>
</div><br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">--<br>|>|\/|<<br>/--------------------------------------------------------------------------\
<br>|David
M.
Cooke                      <a href="http://arbutus.physics.mcmaster.ca/dmc/">http://arbutus.physics.mcmaster.ca/dmc/</a><br>|cookedm@<a href="http://physics.mcmaster.ca">physics.mcmaster.ca</a><br></blockquote></div><br>
<br><br>-- <br>Flávio Codeço Coelho<br>registered Linux user # 386432<br>---------------------------<br>Great spirits have always found violent opposition from mediocrities. The<br>latter cannot understand it when a man does not thoughtlessly submit to
<br>hereditary prejudices but honestly and courageously uses his intelligence.<br>        Albert Einstein <br>