Issue 10787: Document the probability density function for random.gammavariate.

This commit is contained in:
Raymond Hettinger 2011-03-22 15:52:46 -07:00
parent b76f6200d2
commit 405a4717e1
2 changed files with 10 additions and 4 deletions

View File

@ -1540,10 +1540,10 @@ Implementing Descriptors
The following methods only apply when an instance of the class containing the The following methods only apply when an instance of the class containing the
method (a so-called *descriptor* class) appears in the class dictionary of method (a so-called *descriptor* class) appears in the class dictionary of
another new-style class, known as the *owner* class. In the examples below, "the another new-style class (known as the *owner* class) or one of its
attribute" refers to the attribute whose name is the key of the property in the descendants. In the examples below, "the attribute" refers to the attribute
owner class' ``__dict__``. Descriptors can only be implemented as new-style whose name is the key of the property in the owner class' ``__dict__``.
classes themselves. Descriptors can only be implemented as new-style classes themselves.
.. method:: object.__get__(self, instance, owner) .. method:: object.__get__(self, instance, owner)

View File

@ -490,6 +490,12 @@ class Random(_random.Random):
Conditions on the parameters are alpha > 0 and beta > 0. Conditions on the parameters are alpha > 0 and beta > 0.
The probability distribution function is:
x ** (alpha - 1) * math.exp(-x / beta)
pdf(x) = --------------------------------------
math.gamma(alpha) * beta ** alpha
""" """
# alpha > 0, beta > 0, mean is alpha*beta, variance is alpha*beta**2 # alpha > 0, beta > 0, mean is alpha*beta, variance is alpha*beta**2