Skip to content

Commit

Permalink
Add kernel invcdf for the parabolic kernel
Browse files Browse the repository at this point in the history
  • Loading branch information
rhettinger committed Apr 15, 2024
1 parent 04b4f25 commit 3fe2c65
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion Doc/library/statistics.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1163,7 +1163,7 @@ accurately approximated inverse cumulative distribution function.
.. testcode::

from random import choice, random, seed
from math import sqrt, log, pi, tan, asin
from math import sqrt, log, pi, tan, asin, cos, acos
from statistics import NormalDist

kernel_invcdfs = {
Expand All @@ -1172,6 +1172,7 @@ accurately approximated inverse cumulative distribution function.
'sigmoid': lambda p: log(tan(p * pi/2)),
'rectangular': lambda p: 2*p - 1,
'triangular': lambda p: sqrt(2*p) - 1 if p < 0.5 else 1 - sqrt(2 - 2*p),
'parabolic': lambda p: 2 * cos((acos(2*p-1) + pi) / 3),
'cosine': lambda p: 2*asin(2*p - 1)/pi,
}

Expand Down

0 comments on commit 3fe2c65

Please sign in to comment.