This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Title: gammavariate has a wrong comment
Type: Stage: resolved
Components: Versions:
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: mark.dickinson Nosy List: SilentGhost, leodema, mark.dickinson, rhettinger
Priority: normal Keywords:

Created on 2017-05-24 21:47 by leodema, last changed 2022-04-11 14:58 by admin. This issue is now closed.

File name Uploaded Description Edit
unnamed.png leodema, 2017-05-24 21:47 Graph of expovariate(1) and gammavariate(alpha=1, beta=beta)
Pull Requests
URL Status Linked Edit
PR 1798 merged leodema, 2017-05-25 08:29
PR 1934 leodema, 2017-06-03 20:46
Messages (5)
msg294403 - (view) Author: Leonardo De Marchi (leodema) * Date: 2017-05-24 21:47
The gammavariate function in has a wrong comment.

It says that when alpha is one it's equivalent to call expovariate(1).

We can see that is not true (see graphs) and it should be expovariate(1/beta). It's not a big deal but it can cause confusion.
msg294438 - (view) Author: Raymond Hettinger (rhettinger) * (Python committer) Date: 2017-05-25 06:24
I agree that the comment should be changed. While we at it, perhaps sync-up with expovariate() code and eliminate the ``u <= 1e-7`` test:

Instead of:

        elif alpha == 1.0:
            # expovariate(1)
            u = random()
            while u <= 1e-7:
                u = random()
            return -_log(u) * beta

Use this instead:

        elif alpha == 1.0:
            # expovariate(1.0 / beta)
            return -_log(1.0 - random()) * beta
msg342247 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2019-05-12 09:10
This was fixed in PRs GH-1798 and GH-1934. Closing.
msg342249 - (view) Author: SilentGhost (SilentGhost) * (Python triager) Date: 2019-05-12 09:14
Does "a difference stream" in PR 1934 (news entry):

> It does however produce a difference stream of random variables than it used to.

make some sense? Sentence doesn't seem grammatical.
msg342251 - (view) Author: Mark Dickinson (mark.dickinson) * (Python committer) Date: 2019-05-12 10:22
That should clearly have been "different stream" rather than "difference stream".
Date User Action Args
2022-04-11 14:58:46adminsetgithub: 74649
2019-05-12 10:22:36mark.dickinsonsetmessages: + msg342251
2019-05-12 09:14:59SilentGhostsetresolution: fixed

messages: + msg342249
nosy: + SilentGhost
2019-05-12 09:10:06mark.dickinsonsetstatus: open -> closed

messages: + msg342247
stage: resolved
2017-06-03 20:46:44leodemasetpull_requests: + pull_request2012
2017-05-25 08:29:29leodemasetpull_requests: + pull_request1896
2017-05-25 06:24:44rhettingersetassignee: mark.dickinson
messages: + msg294438
2017-05-25 00:36:10rhettingersetnosy: + rhettinger, mark.dickinson
2017-05-24 21:47:13leodemacreate