Imported Upstream version 1.51.0
[platform/upstream/boost.git] / libs / math / doc / sf_and_dist / distributions / rayleigh.qbk
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    
28 The [@http://en.wikipedia.org/wiki/Rayleigh_distribution Rayleigh distribution]
29 is a continuous distribution with the 
30 [@http://en.wikipedia.org/wiki/Probability_density_function probability density function]:
31
32 f(x; sigma) = x * exp(-x[super 2]/2 [sigma][super 2]) / [sigma][super 2]
33
34 For sigma parameter [sigma][space] > 0, and x > 0.
35
36 The Rayleigh distribution is often used where two orthogonal components
37 have an absolute value,
38 for example, wind velocity and direction may be combined to yield a wind speed,
39 or real and imaginary components may have absolute values that are Rayleigh distributed.
40
41 The following graph illustrates how the Probability density Function(pdf) varies with the shape parameter [sigma]:
42
43 [graph rayleigh_pdf]
44
45 and the Cumulative Distribution Function (cdf)
46
47 [graph rayleigh_cdf]
48
49 [h4 Related distributions]
50
51 The absolute value of two independent normal distributions X and Y, [radic] (X[super 2] + Y[super 2])
52 is a Rayleigh distribution.
53
54 The [@http://en.wikipedia.org/wiki/Chi_distribution Chi],
55 [@http://en.wikipedia.org/wiki/Rice_distribution Rice]
56 and [@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    
63 Constructs a [@http://en.wikipedia.org/wiki/Rayleigh_distribution 
64 Rayleigh distribution] with [sigma] /sigma/.
65
66 Requires that the [sigma] parameter is greater than zero, 
67 otherwise calls __domain_error.
68
69    RealType sigma()const;
70    
71 Returns the /sigma/ parameter of this distribution.
72    
73 [h4 Non-member Accessors]
74
75 All the [link math_toolkit.dist.dist_ref.nmp usual non-member accessor functions] that are generic to all
76 distributions are supported: __usual_accessors.
77
78 The domain of the random variable is \[0, max_value\].
79
80 [h4 Accuracy]
81
82 The Rayleigh distribution is implemented in terms of the 
83 standard library `sqrt` and `exp` and as such should have very low error rates.
84 Some constants such as skewness and kurtosis were calculated using
85 NTL RR type with 150-bit accuracy, about 50 decimal digits.
86
87 [h4 Implementation]
88
89 In the following table [sigma][space] 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][space] = -__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