[Python-checkins] cpython (3.1): Issue 10787: Document the probability density function for random.gammavariate.

raymond.hettinger python-checkins at python.org
Tue Mar 22 23:57:23 CET 2011


http://hg.python.org/cpython/rev/e880020e7e6a
changeset:   68846:e880020e7e6a
branch:      3.1
parent:      68842:3e3c46a3dce8
user:        Raymond Hettinger <python at rcn.com>
date:        Tue Mar 22 15:55:51 2011 -0700
summary:
  Issue 10787: Document the probability density function for random.gammavariate.

files:
  Lib/random.py

diff --git a/Lib/random.py b/Lib/random.py
--- a/Lib/random.py
+++ b/Lib/random.py
@@ -470,6 +470,12 @@
 
         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

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list