classification
Title: [random.gammavariate] Add the expression of the distribution in a comprehensive form for random.gammavariate
Type: Stage:
Components: Documentation Versions: Python 3.1, Python 3.2, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: rhettinger Nosy List: David.Kremer, docs@python, mark.dickinson, python-dev, rhettinger, terry.reedy
Priority: normal Keywords: patch

Created on 2010-12-28 16:48 by David.Kremer, last changed 2011-03-22 23:09 by rhettinger. This issue is now closed.

Files
File name Uploaded Description Edit
patch_documentation_random.py.diff David.Kremer, 2010-12-28 16:48 patch random.py in the version 2.7 to update the doc string for random.gammavariate method
Messages (5)
msg124803 - (view) Author: David Kremer (David.Kremer) Date: 2010-12-28 16:48
Could you please add the exact form of the distribution, because it's rather confusing in the current form.

In this url, the role of k and theta is precised with a formula :
[http://tinyurl.com/24jxfrk]*

It seems that in 
[http://docs.python.org/library/random.html#random.gammavariate] , alpha is playing the role of k and beta is playing the role of theta.

But it's still not clear, because one can confuse beta with 1/beta and vice et versa, like there is two usual representation for the gamma distribution [http://en.wikipedia.org/wiki/Gamma_distribution]

[http://docs.scipy.org/doc/numpy-1.5.x/reference/generated/numpy.random.gamma.html#numpy.random.gamma]*

Please update the documentation to avoid this ambiguity.

I provide an indicative patch which is updating the doc string in random.py
msg124982 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2010-12-31 23:34
From reading the Wikipedia article, I might conclude that beta = 1/theta, but from reading random.py, beta=theta. I think this much should be clarified, but without giving the formula in a hard to read text form. Perhaps the random doc should give reference to the much more complete numpy.random (and Wikipedia and/or Mathworld) entries rather than merely 'any statistics text' (many of which will not describe all).
msg125002 - (view) Author: David Kremer (David.Kremer) Date: 2011-01-01 17:07
Yes I agree. Actually the parameters in the python code alpha, beta are corresponding respectively to k, theta in the first equation of [http://en.wikipedia.org/wiki/Gamma_distribution].
msg131802 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-03-22 22:52
New changeset 42816be02b9b by Raymond Hettinger in branch '2.7':
Issue 10787: Document the probability density function for random.gammavariate.
http://hg.python.org/cpython/rev/42816be02b9b
msg131803 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2011-03-22 22:57
New changeset e880020e7e6a by Raymond Hettinger in branch '3.1':
Issue 10787: Document the probability density function for random.gammavariate.
http://hg.python.org/cpython/rev/e880020e7e6a

New changeset f882b284d260 by Raymond Hettinger in branch '3.2':
Issue 10787: Document the probability density function for random.gammavariate.
http://hg.python.org/cpython/rev/f882b284d260

New changeset a892a0dd8190 by Raymond Hettinger in branch 'default':
Issue 10787: Document the probability density function for random.gammavariate.
http://hg.python.org/cpython/rev/a892a0dd8190
History
Date User Action Args
2011-03-22 23:09:28rhettingersetstatus: open -> closed
nosy: rhettinger, terry.reedy, mark.dickinson, docs@python, David.Kremer, python-dev
resolution: fixed
2011-03-22 22:57:24python-devsetnosy: rhettinger, terry.reedy, mark.dickinson, docs@python, David.Kremer, python-dev
messages: + msg131803
2011-03-22 22:52:57python-devsetnosy: + python-dev
messages: + msg131802
2011-01-01 17:07:33David.Kremersetnosy: rhettinger, terry.reedy, mark.dickinson, docs@python, David.Kremer
messages: + msg125002
2010-12-31 23:34:39terry.reedysetnosy: + terry.reedy

messages: + msg124982
versions: + Python 3.1, Python 3.2
2010-12-30 19:55:31rhettingersetassignee: docs@python -> rhettinger
nosy: rhettinger, mark.dickinson, docs@python, David.Kremer
2010-12-29 09:15:44mark.dickinsonsetnosy: + mark.dickinson
2010-12-28 17:52:27eric.araujosetnosy: + rhettinger
2010-12-28 16:48:34David.Kremercreate