dask 2021.10.0

NotesParametersReturns
rayleigh(self, scale=1.0, size=None, chunks='auto', **kwargs)

This docstring was copied from numpy.random.mtrand.RandomState.rayleigh.

Some inconsistencies with the Dask version may exist.

The $\chi$ and Weibull distributions are generalizations of the Rayleigh.

note

New code should use the rayleigh method of a default_rng() instance instead; please see the :None:ref:`random-quick-start`.

Notes

The probability density function for the Rayleigh distribution is

$$P(x;scale) = \frac{x}{scale^2}e^{\frac{-x^2}{2 \cdotp scale^2}}$$

The Rayleigh distribution would arise, for example, if the East and North components of the wind velocity had identical zero-mean Gaussian distributions. Then the wind speed would have a Rayleigh distribution.

Parameters

scale : float or array_like of floats, optional

Scale, also equals the mode. Must be non-negative. Default is 1.

size : int or tuple of ints, optional

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 scale is a scalar. Otherwise, np.array(scale).size samples are drawn.

Returns

out : ndarray or scalar

Drawn samples from the parameterized Rayleigh distribution.

Draw samples from a Rayleigh distribution.

See Also

Generator.rayleigh

which should be used for new code.

Examples

Draw values from the distribution and plot the histogram

This example is valid syntax, but we were not able to check execution
>>> from matplotlib.pyplot import hist  # doctest: +SKIP
... values = hist(np.random.rayleigh(3, 100000), bins=200, density=True) # doctest: +SKIP

Wave heights tend to follow a Rayleigh distribution. If the mean wave height is 1 meter, what fraction of waves are likely to be larger than 3 meters?

This example is valid syntax, but we were not able to check execution
>>> meanvalue = 1  # doctest: +SKIP
... modevalue = np.sqrt(2 / np.pi) * meanvalue # doctest: +SKIP
... s = np.random.rayleigh(modevalue, 1000000) # doctest: +SKIP

The percentage of waves larger than 3 meters is:

This example is valid syntax, but we were not able to check execution
>>> 100.*sum(s>3)/1000000.  # doctest: +SKIP
0.087300000000000003 # random
See :

Local connectivity graph

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


File: /dask/array/random.py#395
type: <class 'function'>
Commit: