bundles / numpy 2.5.0.dev0+git20251130.2de293a / numpy / random / _generator / Generator / vonmises
cython_function_or_method
numpy.random._generator:Generator.vonmises
Signature
def vonmises ( mu , kappa , size = None ) Summary
Draw samples from a von Mises distribution.
Extended Summary
Samples are drawn from a von Mises distribution with specified mode (mu) and concentration (kappa), on the interval [-pi, pi].
The von Mises distribution (also known as the circular normal distribution) is a continuous probability distribution on the unit circle. It may be thought of as the circular analogue of the normal distribution.
Parameters
mu: float or array_like of floatsMode ("center") of the distribution.
kappa: float or array_like of floatsConcentration of the distribution, has to be >=0.
size: int or tuple of ints, optionalOutput shape. If the given shape is, e.g.,
(m, n, k), thenm * n * ksamples are drawn. If size isNone(default), a single value is returned ifmuandkappaare both scalars. Otherwise,np.broadcast(mu, kappa).sizesamples are drawn.
Returns
out: ndarray or scalarDrawn samples from the parameterized von Mises distribution.
Notes
The probability density for the von Mises distribution is
where is the mode and the concentration, and is the modified Bessel function of order 0.
The von Mises is named for Richard Edler von Mises, who was born in Austria-Hungary, in what is now the Ukraine. He fled to the United States in 1939 and became a professor at Harvard. He worked in probability theory, aerodynamics, fluid mechanics, and philosophy of science.
Examples
Draw samples from the distribution:mu, kappa = 0.0, 4.0 # mean and concentration rng = np.random.default_rng() s = rng.vonmises(mu, kappa, 1000)✓
import matplotlib.pyplot as plt
✓plt.hist(s, 50, density=True)
✗x = np.linspace(-np.pi, np.pi, num=51) plt.show()✓

See also
- scipy.stats.vonmises
probability density function, distribution, or cumulative density function, etc.
Aliases
-
numpy.random.Generator.vonmises