# numpy.random.vonmises¶

numpy.random.vonmises(mu=0.0, kappa=1.0, size=None)

Draw samples from a von Mises distribution.

Samples are drawn from a von Mises distribution with specified mode (mu) and dispersion (kappa), on the interval [-pi, pi].

The von Mises distribution (also known as the circular normal distribution) is a continuous probability distribution on the circle. It may be thought of as the circular analogue of the normal distribution.

Parameters : mu : float Mode (“center”) of the distribution. kappa : float, >= 0. Dispersion of the distribution. size : {tuple, int} Output shape. If the given shape is, e.g., (m, n, k), then m * n * k samples are drawn. samples : {ndarray, scalar} The returned samples live on the unit circle [-pi, pi].

See also

scipy.stats.distributions.vonmises
probability density function, distribution or cumulative density function, etc.

Notes

The probability density for the von Mises distribution is where is the mode and the dispersion, and is the modified Bessel function of order 0.

The von Mises, named for Richard Edler von Mises, 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.

References

 [R246] Abramowitz, M. and Stegun, I. A. (ed.), Handbook of Mathematical Functions, National Bureau of Standards, 1964; reprinted Dover Publications, 1965.
 [R247] von Mises, Richard, 1964, Mathematical Theory of Probability and Statistics (New York: Academic Press).
 [R248] Wikipedia, “Von Mises distribution”, http://en.wikipedia.org/wiki/Von_Mises_distribution

Examples

Draw samples from the distribution:

>>> mu, kappa = 0.0, 4.0 # mean and dispersion
>>> s = np.random.vonmises(mu, kappa, 1000)


Display the histogram of the samples, along with the probability density function:

>>> import matplotlib.pyplot as plt
>>> import scipy.special as sps
>>> count, bins, ignored = plt.hist(s, 50, normed=True)
>>> x = np.arange(-np.pi, np.pi, 2*np.pi/50.)
>>> y = -np.exp(kappa*np.cos(x-mu))/(2*np.pi*sps.jn(0,kappa))
>>> plt.plot(x, y/max(y), linewidth=2, color='r')
>>> plt.show() #### Previous topic

numpy.random.uniform

#### Next topic

numpy.random.wald