Bug in the standard module random ?

John Machin sjmachin at lexicon.net
Thu Mar 7 20:41:54 EST 2002


Weet Vanniks <No at Spam.Please> wrote in message news:<3C8791B1.6BBC1981 at Spam.Please>...
> Hi,
> 
> The  gammavariate function of the standard module is documented as
> taking two parameters, the first one alpha is required to be > -1 and
> the second beta is required to be >0.
> However, examining the implementation, it seems that the requirement for
> alpha is to be >0.
> 

Yes, this is a doc problem. Some definitions of the gamma distribution
define it (a) such that alpha > -1 and has the exponential
distribution as a special case when alpha == 0; others take the tack
(b) that the lower bound is zero and the exponential distribution is
when alpha == 1.

Example of (b):
http://www.nag.com/numeric/cl/manual/pdf/G05/g05ffc_cl05.pdf

Here we have the doc taking option (a) and the implementation taking
option (b).

So you probably want to call it with alpha set to 1.2, not 0.2, and
then it won't blow up.

However the implementation is still stuffed, as my earlier posting
said.

N.B. the following is VERY relevant:
http://mail.python.org/pipermail/python-dev/2001-January/012181.html



More information about the Python-list mailing list