Skip to content

Commit 472c9de

Browse files
DOC: fix name of shape parameter kappa of von Mises distribution (numpy#27721)
* Fix name of shape parameter kappa of von Mises distribution The parameter kappa in the equation of the von Mises distribution is not the dispersion but its reciprocal. This is typically referred to as the concentration (see for example https://docs.scipy.org/doc/scipy/reference/generated/scipy.stats.vonmises.html). Change the docstring of the `vonmises` method in `_generator.pyx` and `mtrand.pyx` accordingly.
1 parent 62c7ee8 commit 472c9de

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

numpy/random/_generator.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1977,7 +1977,7 @@ cdef class Generator:
19771977
Draw samples from a von Mises distribution.
19781978
19791979
Samples are drawn from a von Mises distribution with specified mode
1980-
(mu) and dispersion (kappa), on the interval [-pi, pi].
1980+
(mu) and concentration (kappa), on the interval [-pi, pi].
19811981
19821982
The von Mises distribution (also known as the circular normal
19831983
distribution) is a continuous probability distribution on the unit
@@ -1989,7 +1989,7 @@ cdef class Generator:
19891989
mu : float or array_like of floats
19901990
Mode ("center") of the distribution.
19911991
kappa : float or array_like of floats
1992-
Dispersion of the distribution, has to be >=0.
1992+
Concentration of the distribution, has to be >=0.
19931993
size : int or tuple of ints, optional
19941994
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
19951995
``m * n * k`` samples are drawn. If size is ``None`` (default),
@@ -2012,7 +2012,7 @@ cdef class Generator:
20122012
20132013
.. math:: p(x) = \\frac{e^{\\kappa cos(x-\\mu)}}{2\\pi I_0(\\kappa)},
20142014
2015-
where :math:`\\mu` is the mode and :math:`\\kappa` the dispersion,
2015+
where :math:`\\mu` is the mode and :math:`\\kappa` the concentration,
20162016
and :math:`I_0(\\kappa)` is the modified Bessel function of order 0.
20172017
20182018
The von Mises is named for Richard Edler von Mises, who was born in
@@ -2033,7 +2033,7 @@ cdef class Generator:
20332033
--------
20342034
Draw samples from the distribution:
20352035
2036-
>>> mu, kappa = 0.0, 4.0 # mean and dispersion
2036+
>>> mu, kappa = 0.0, 4.0 # mean and concentration
20372037
>>> rng = np.random.default_rng()
20382038
>>> s = rng.vonmises(mu, kappa, 1000)
20392039

numpy/random/mtrand.pyx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2282,7 +2282,7 @@ cdef class RandomState:
22822282
Draw samples from a von Mises distribution.
22832283
22842284
Samples are drawn from a von Mises distribution with specified mode
2285-
(mu) and dispersion (kappa), on the interval [-pi, pi].
2285+
(mu) and concentration (kappa), on the interval [-pi, pi].
22862286
22872287
The von Mises distribution (also known as the circular normal
22882288
distribution) is a continuous probability distribution on the unit
@@ -2299,7 +2299,7 @@ cdef class RandomState:
22992299
mu : float or array_like of floats
23002300
Mode ("center") of the distribution.
23012301
kappa : float or array_like of floats
2302-
Dispersion of the distribution, has to be >=0.
2302+
Concentration of the distribution, has to be >=0.
23032303
size : int or tuple of ints, optional
23042304
Output shape. If the given shape is, e.g., ``(m, n, k)``, then
23052305
``m * n * k`` samples are drawn. If size is ``None`` (default),
@@ -2323,7 +2323,7 @@ cdef class RandomState:
23232323
23242324
.. math:: p(x) = \\frac{e^{\\kappa cos(x-\\mu)}}{2\\pi I_0(\\kappa)},
23252325
2326-
where :math:`\\mu` is the mode and :math:`\\kappa` the dispersion,
2326+
where :math:`\\mu` is the mode and :math:`\\kappa` the concentration,
23272327
and :math:`I_0(\\kappa)` is the modified Bessel function of order 0.
23282328
23292329
The von Mises is named for Richard Edler von Mises, who was born in
@@ -2344,7 +2344,7 @@ cdef class RandomState:
23442344
--------
23452345
Draw samples from the distribution:
23462346
2347-
>>> mu, kappa = 0.0, 4.0 # mean and dispersion
2347+
>>> mu, kappa = 0.0, 4.0 # mean and concentration
23482348
>>> s = np.random.vonmises(mu, kappa, 1000)
23492349
23502350
Display the histogram of the samples, along with

0 commit comments

Comments
 (0)