vonmises(self, mu, kappa, size=None, chunks='auto', **kwargs)
This docstring was copied from numpy.random.mtrand.RandomState.vonmises.
Some inconsistencies with the Dask version may exist.
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 unit circle. It may be thought of as the circular analogue of the normal distribution.
New code should use the vonmises
method of a default_rng()
instance instead; please see the :None:ref:`random-quick-start`
.
The probability density for the von Mises distribution is
$$p(x) = \frac{e^{\kappa cos(x-\mu)}}{2\pi I_0(\kappa)},$$where $\mu$ is the mode and $\kappa$ the dispersion, and $I_0(\kappa)$ 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.
Mode ("center") of the distribution.
Dispersion of the distribution, has to be >=0.
Output shape. If the given shape is, e.g., (m, n, k)
, then m * n * k
samples are drawn. If size is None
(default), a single value is returned if mu
and kappa
are both scalars. Otherwise, np.broadcast(mu, kappa).size
samples are drawn.
Drawn samples from the parameterized von Mises distribution.
Draw samples from a von Mises distribution.
Generator.vonmises
which should be used for new code.
scipy.stats.vonmises
probability density function, distribution, or cumulative density function, etc.
Draw samples from the distribution:
This example is valid syntax, but we were not able to check execution>>> mu, kappa = 0.0, 4.0 # mean and dispersion # doctest: +SKIP
... s = np.random.vonmises(mu, kappa, 1000) # doctest: +SKIP
Display the histogram of the samples, along with the probability density function:
This example is valid syntax, but we were not able to check execution>>> import matplotlib.pyplot as plt # doctest: +SKIPSee :
... from scipy.special import i0 # doctest: +SKIP
... plt.hist(s, 50, density=True) # doctest: +SKIP
... x = np.linspace(-np.pi, np.pi, num=51) # doctest: +SKIP
... y = np.exp(kappa*np.cos(x-mu))/(2*np.pi*i0(kappa)) # doctest: +SKIP
... plt.plot(x, y, linewidth=2, color='r') # doctest: +SKIP
... plt.show() # doctest: +SKIP
Hover to see nodes names; edges to Self not shown, Caped at 50 nodes.
Using a canvas is more power efficient and can get hundred of nodes ; but does not allow hyperlinks; , arrows or text (beyond on hover)
SVG is more flexible but power hungry; and does not scale well to 50 + nodes.
All aboves nodes referred to, (or are referred from) current nodes; Edges from Self to other have been omitted (or all nodes would be connected to the central node "self" which is not useful). Nodes are colored by the library they belong to, and scaled with the number of references pointing them