• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1[section:rayleigh Rayleigh Distribution]
2
3
4``#include <boost/math/distributions/rayleigh.hpp>``
5
6   namespace boost{ namespace math{
7
8   template <class RealType = double,
9             class ``__Policy``   = ``__policy_class`` >
10   class rayleigh_distribution;
11
12   typedef rayleigh_distribution<> rayleigh;
13
14   template <class RealType, class ``__Policy``>
15   class rayleigh_distribution
16   {
17   public:
18      typedef RealType value_type;
19      typedef Policy   policy_type;
20      // Construct:
21      rayleigh_distribution(RealType sigma = 1)
22      // Accessors:
23      RealType sigma()const;
24   };
25
26   }} // namespaces
27
28The [@http://en.wikipedia.org/wiki/Rayleigh_distribution Rayleigh distribution]
29is a continuous distribution with the
30[@http://en.wikipedia.org/wiki/Probability_density_function probability density function]:
31
32[expression f(x; sigma) = x * exp(-x[super 2]/2 [sigma][super 2]) / [sigma][super 2]]
33
34For sigma parameter ['[sigma]] > 0, and /x/ > 0.
35
36The Rayleigh distribution is often used where two orthogonal components
37have an absolute value,
38for example, wind velocity and direction may be combined to yield a wind speed,
39or real and imaginary components may have absolute values that are Rayleigh distributed.
40
41The following graph illustrates how the Probability density Function(pdf) varies with the shape parameter [sigma]:
42
43[graph rayleigh_pdf]
44
45and the Cumulative Distribution Function (cdf)
46
47[graph rayleigh_cdf]
48
49[h4 Related distributions]
50
51The absolute value of two independent normal distributions X and Y, [radic] (X[super 2] + Y[super 2])
52is a Rayleigh distribution.
53
54The [@http://en.wikipedia.org/wiki/Chi_distribution Chi],
55[@http://en.wikipedia.org/wiki/Rice_distribution Rice]
56and [@http://en.wikipedia.org/wiki/Weibull_distribution Weibull] distributions are generalizations of the
57[@http://en.wikipedia.org/wiki/Rayleigh_distribution Rayleigh distribution].
58
59[h4 Member Functions]
60
61   rayleigh_distribution(RealType sigma = 1);
62
63Constructs a [@http://en.wikipedia.org/wiki/Rayleigh_distribution
64Rayleigh distribution] with [sigma] /sigma/.
65
66Requires that the [sigma] parameter is greater than zero,
67otherwise calls __domain_error.
68
69   RealType sigma()const;
70
71Returns the /sigma/ parameter of this distribution.
72
73[h4 Non-member Accessors]
74
75All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions] that are generic to all
76distributions are supported: __usual_accessors.
77
78The domain of the random variable is \[0, max_value\].
79
80[h4 Accuracy]
81
82The Rayleigh distribution is implemented in terms of the
83standard library `sqrt` and `exp` and as such should have very low error rates.
84Some constants such as skewness and kurtosis were calculated using
85NTL RR type with 150-bit accuracy, about 50 decimal digits.
86
87[h4 Implementation]
88
89In the following table [sigma] is the sigma parameter of the distribution,
90/x/ is the random variate, /p/ is the probability and /q = 1-p/.
91
92[table
93[[Function][Implementation Notes]]
94[[pdf][Using the relation: pdf = x * exp(-x[super 2])/2 [sigma][super 2] ]]
95[[cdf][Using the relation: p = 1 - exp(-x[super 2]/2) [sigma][super 2]= -__expm1(-x[super 2]/2) [sigma][super 2]]]
96[[cdf complement][Using the relation: q =  exp(-x[super 2]/ 2) * [sigma][super 2] ]]
97[[quantile][Using the relation: x = sqrt(-2 * [sigma] [super 2]) * log(1 - p)) = sqrt(-2 * [sigma] [super 2]) * __log1p(-p))]]
98[[quantile from the complement][Using the relation: x = sqrt(-2 * [sigma] [super 2]) * log(q)) ]]
99[[mean][[sigma] * sqrt([pi]/2) ]]
100[[variance][[sigma][super 2] * (4 - [pi]/2) ]]
101[[mode][[sigma] ]]
102[[skewness][Constant from [@http://mathworld.wolfram.com/RayleighDistribution.html Weisstein, Eric W. "Weibull Distribution." From MathWorld--A Wolfram Web Resource.] ]]
103[[kurtosis][Constant from [@http://mathworld.wolfram.com/RayleighDistribution.html Weisstein, Eric W. "Weibull Distribution." From MathWorld--A Wolfram Web Resource.] ]]
104[[kurtosis excess][Constant from [@http://mathworld.wolfram.com/RayleighDistribution.html Weisstein, Eric W. "Weibull Distribution." From MathWorld--A Wolfram Web Resource.] ]]
105]
106
107[h4 References]
108* [@http://en.wikipedia.org/wiki/Rayleigh_distribution ]
109* [@http://mathworld.wolfram.com/RayleighDistribution.html Weisstein, Eric W. "Rayleigh Distribution." From MathWorld--A Wolfram Web Resource.]
110
111[endsect] [/section:Rayleigh Rayleigh]
112
113[/
114  Copyright 2006 John Maddock and Paul A. Bristow.
115  Distributed under the Boost Software License, Version 1.0.
116  (See accompanying file LICENSE_1_0.txt or copy at
117  http://www.boost.org/LICENSE_1_0.txt).
118]
119
120