3 <meta http-equiv=
"Content-Type" content=
"text/html; charset=US-ASCII">
4 <title>Rayleigh Distribution
</title>
5 <link rel=
"stylesheet" href=
"../../../math.css" type=
"text/css">
6 <meta name=
"generator" content=
"DocBook XSL Stylesheets V1.77.1">
7 <link rel=
"home" href=
"../../../index.html" title=
"Math Toolkit 2.5.1">
8 <link rel=
"up" href=
"../dists.html" title=
"Distributions">
9 <link rel=
"prev" href=
"poisson_dist.html" title=
"Poisson Distribution">
10 <link rel=
"next" href=
"skew_normal_dist.html" title=
"Skew Normal Distribution">
12 <body bgcolor=
"white" text=
"black" link=
"#0000FF" vlink=
"#840084" alink=
"#0000FF">
13 <table cellpadding=
"2" width=
"100%"><tr>
14 <td valign=
"top"><img alt=
"Boost C++ Libraries" width=
"277" height=
"86" src=
"../../../../../../../boost.png"></td>
15 <td align=
"center"><a href=
"../../../../../../../index.html">Home
</a></td>
16 <td align=
"center"><a href=
"../../../../../../../libs/libraries.htm">Libraries
</a></td>
17 <td align=
"center"><a href=
"http://www.boost.org/users/people.html">People
</a></td>
18 <td align=
"center"><a href=
"http://www.boost.org/users/faq.html">FAQ
</a></td>
19 <td align=
"center"><a href=
"../../../../../../../more/index.htm">More
</a></td>
22 <div class=
"spirit-nav">
23 <a accesskey=
"p" href=
"poisson_dist.html"><img src=
"../../../../../../../doc/src/images/prev.png" alt=
"Prev"></a><a accesskey=
"u" href=
"../dists.html"><img src=
"../../../../../../../doc/src/images/up.png" alt=
"Up"></a><a accesskey=
"h" href=
"../../../index.html"><img src=
"../../../../../../../doc/src/images/home.png" alt=
"Home"></a><a accesskey=
"n" href=
"skew_normal_dist.html"><img src=
"../../../../../../../doc/src/images/next.png" alt=
"Next"></a>
26 <div class=
"titlepage"><div><div><h4 class=
"title">
27 <a name=
"math_toolkit.dist_ref.dists.rayleigh"></a><a class=
"link" href=
"rayleigh.html" title=
"Rayleigh Distribution">Rayleigh Distribution
</a>
28 </h4></div></div></div>
29 <pre class=
"programlisting"><span class=
"preprocessor">#include
</span> <span class=
"special"><</span><span class=
"identifier">boost
</span><span class=
"special">/
</span><span class=
"identifier">math
</span><span class=
"special">/
</span><span class=
"identifier">distributions
</span><span class=
"special">/
</span><span class=
"identifier">rayleigh
</span><span class=
"special">.
</span><span class=
"identifier">hpp
</span><span class=
"special">></span></pre>
30 <pre class=
"programlisting"><span class=
"keyword">namespace
</span> <span class=
"identifier">boost
</span><span class=
"special">{
</span> <span class=
"keyword">namespace
</span> <span class=
"identifier">math
</span><span class=
"special">{
</span>
32 <span class=
"keyword">template
</span> <span class=
"special"><</span><span class=
"keyword">class
</span> <span class=
"identifier">RealType
</span> <span class=
"special">=
</span> <span class=
"keyword">double
</span><span class=
"special">,
</span>
33 <span class=
"keyword">class
</span> <a class=
"link" href=
"../../../policy.html" title=
"Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy
</a> <span class=
"special">=
</span> <a class=
"link" href=
"../../pol_ref/pol_ref_ref.html" title=
"Policy Class Reference">policies::policy
<></a> <span class=
"special">></span>
34 <span class=
"keyword">class
</span> <span class=
"identifier">rayleigh_distribution
</span><span class=
"special">;
</span>
36 <span class=
"keyword">typedef
</span> <span class=
"identifier">rayleigh_distribution
</span><span class=
"special"><></span> <span class=
"identifier">rayleigh
</span><span class=
"special">;
</span>
38 <span class=
"keyword">template
</span> <span class=
"special"><</span><span class=
"keyword">class
</span> <span class=
"identifier">RealType
</span><span class=
"special">,
</span> <span class=
"keyword">class
</span> <a class=
"link" href=
"../../../policy.html" title=
"Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy
</a><span class=
"special">></span>
39 <span class=
"keyword">class
</span> <span class=
"identifier">rayleigh_distribution
</span>
40 <span class=
"special">{
</span>
41 <span class=
"keyword">public
</span><span class=
"special">:
</span>
42 <span class=
"keyword">typedef
</span> <span class=
"identifier">RealType
</span> <span class=
"identifier">value_type
</span><span class=
"special">;
</span>
43 <span class=
"keyword">typedef
</span> <span class=
"identifier">Policy
</span> <span class=
"identifier">policy_type
</span><span class=
"special">;
</span>
44 <span class=
"comment">// Construct:
</span>
45 <span class=
"identifier">rayleigh_distribution
</span><span class=
"special">(
</span><span class=
"identifier">RealType
</span> <span class=
"identifier">sigma
</span> <span class=
"special">=
</span> <span class=
"number">1</span><span class=
"special">)
</span>
46 <span class=
"comment">// Accessors:
</span>
47 <span class=
"identifier">RealType
</span> <span class=
"identifier">sigma
</span><span class=
"special">()
</span><span class=
"keyword">const
</span><span class=
"special">;
</span>
48 <span class=
"special">};
</span>
50 <span class=
"special">}}
</span> <span class=
"comment">// namespaces
</span>
53 The
<a href=
"http://en.wikipedia.org/wiki/Rayleigh_distribution" target=
"_top">Rayleigh
54 distribution
</a> is a continuous distribution with the
<a href=
"http://en.wikipedia.org/wiki/Probability_density_function" target=
"_top">probability
58 f(x; sigma) = x * exp(-x
<sup>2</sup>/
2 σ<sup>2</sup>) /
σ<sup>2</sup>
61 For sigma parameter
σ   > 0, and x
> 0.
64 The Rayleigh distribution is often used where two orthogonal components
65 have an absolute value, for example, wind velocity and direction may be
66 combined to yield a wind speed, or real and imaginary components may have
67 absolute values that are Rayleigh distributed.
70 The following graph illustrates how the Probability density Function(pdf)
71 varies with the shape parameter
σ:
74 <span class=
"inlinemediaobject"><img src=
"../../../../graphs/rayleigh_pdf.svg" align=
"middle"></span>
77 and the Cumulative Distribution Function (cdf)
80 <span class=
"inlinemediaobject"><img src=
"../../../../graphs/rayleigh_cdf.svg" align=
"middle"></span>
83 <a name=
"math_toolkit.dist_ref.dists.rayleigh.h0"></a>
84 <span class=
"phrase"><a name=
"math_toolkit.dist_ref.dists.rayleigh.related_distributions"></a></span><a class=
"link" href=
"rayleigh.html#math_toolkit.dist_ref.dists.rayleigh.related_distributions">Related
88 The absolute value of two independent normal distributions X and Y,
√ (X
<sup>2</sup> +
89 Y
<sup>2</sup>) is a Rayleigh distribution.
92 The
<a href=
"http://en.wikipedia.org/wiki/Chi_distribution" target=
"_top">Chi
</a>,
93 <a href=
"http://en.wikipedia.org/wiki/Rice_distribution" target=
"_top">Rice
</a>
94 and
<a href=
"http://en.wikipedia.org/wiki/Weibull_distribution" target=
"_top">Weibull
</a>
95 distributions are generalizations of the
<a href=
"http://en.wikipedia.org/wiki/Rayleigh_distribution" target=
"_top">Rayleigh
99 <a name=
"math_toolkit.dist_ref.dists.rayleigh.h1"></a>
100 <span class=
"phrase"><a name=
"math_toolkit.dist_ref.dists.rayleigh.member_functions"></a></span><a class=
"link" href=
"rayleigh.html#math_toolkit.dist_ref.dists.rayleigh.member_functions">Member
103 <pre class=
"programlisting"><span class=
"identifier">rayleigh_distribution
</span><span class=
"special">(
</span><span class=
"identifier">RealType
</span> <span class=
"identifier">sigma
</span> <span class=
"special">=
</span> <span class=
"number">1</span><span class=
"special">);
</span>
106 Constructs a
<a href=
"http://en.wikipedia.org/wiki/Rayleigh_distribution" target=
"_top">Rayleigh
107 distribution
</a> with
σ <span class=
"emphasis"><em>sigma
</em></span>.
110 Requires that the
σ parameter is greater than zero, otherwise calls
<a class=
"link" href=
"../../error_handling.html#math_toolkit.error_handling.domain_error">domain_error
</a>.
112 <pre class=
"programlisting"><span class=
"identifier">RealType
</span> <span class=
"identifier">sigma
</span><span class=
"special">()
</span><span class=
"keyword">const
</span><span class=
"special">;
</span>
115 Returns the
<span class=
"emphasis"><em>sigma
</em></span> parameter of this distribution.
118 <a name=
"math_toolkit.dist_ref.dists.rayleigh.h2"></a>
119 <span class=
"phrase"><a name=
"math_toolkit.dist_ref.dists.rayleigh.non_member_accessors"></a></span><a class=
"link" href=
"rayleigh.html#math_toolkit.dist_ref.dists.rayleigh.non_member_accessors">Non-member
123 All the
<a class=
"link" href=
"../nmp.html" title=
"Non-Member Properties">usual non-member accessor
124 functions
</a> that are generic to all distributions are supported:
125 <a class=
"link" href=
"../nmp.html#math_toolkit.dist_ref.nmp.cdf">Cumulative Distribution Function
</a>,
126 <a class=
"link" href=
"../nmp.html#math_toolkit.dist_ref.nmp.pdf">Probability Density Function
</a>,
127 <a class=
"link" href=
"../nmp.html#math_toolkit.dist_ref.nmp.quantile">Quantile
</a>,
<a class=
"link" href=
"../nmp.html#math_toolkit.dist_ref.nmp.hazard">Hazard Function
</a>,
<a class=
"link" href=
"../nmp.html#math_toolkit.dist_ref.nmp.chf">Cumulative Hazard Function
</a>,
128 <a class=
"link" href=
"../nmp.html#math_toolkit.dist_ref.nmp.mean">mean
</a>,
<a class=
"link" href=
"../nmp.html#math_toolkit.dist_ref.nmp.median">median
</a>,
129 <a class=
"link" href=
"../nmp.html#math_toolkit.dist_ref.nmp.mode">mode
</a>,
<a class=
"link" href=
"../nmp.html#math_toolkit.dist_ref.nmp.variance">variance
</a>,
130 <a class=
"link" href=
"../nmp.html#math_toolkit.dist_ref.nmp.sd">standard deviation
</a>,
131 <a class=
"link" href=
"../nmp.html#math_toolkit.dist_ref.nmp.skewness">skewness
</a>,
<a class=
"link" href=
"../nmp.html#math_toolkit.dist_ref.nmp.kurtosis">kurtosis
</a>,
<a class=
"link" href=
"../nmp.html#math_toolkit.dist_ref.nmp.kurtosis_excess">kurtosis_excess
</a>,
132 <a class=
"link" href=
"../nmp.html#math_toolkit.dist_ref.nmp.range">range
</a> and
<a class=
"link" href=
"../nmp.html#math_toolkit.dist_ref.nmp.support">support
</a>.
135 The domain of the random variable is [
0, max_value].
138 <a name=
"math_toolkit.dist_ref.dists.rayleigh.h3"></a>
139 <span class=
"phrase"><a name=
"math_toolkit.dist_ref.dists.rayleigh.accuracy"></a></span><a class=
"link" href=
"rayleigh.html#math_toolkit.dist_ref.dists.rayleigh.accuracy">Accuracy
</a>
142 The Rayleigh distribution is implemented in terms of the standard library
143 <code class=
"computeroutput"><span class=
"identifier">sqrt
</span></code> and
<code class=
"computeroutput"><span class=
"identifier">exp
</span></code> and as such should have very low
144 error rates. Some constants such as skewness and kurtosis were calculated
145 using NTL RR type with
150-bit accuracy, about
50 decimal digits.
148 <a name=
"math_toolkit.dist_ref.dists.rayleigh.h4"></a>
149 <span class=
"phrase"><a name=
"math_toolkit.dist_ref.dists.rayleigh.implementation"></a></span><a class=
"link" href=
"rayleigh.html#math_toolkit.dist_ref.dists.rayleigh.implementation">Implementation
</a>
152 In the following table
σ   is the sigma parameter of the distribution,
<span class=
"emphasis"><em>x
</em></span>
153 is the random variate,
<span class=
"emphasis"><em>p
</em></span> is the probability and
<span class=
"emphasis"><em>q
156 <div class=
"informaltable"><table class=
"table">
182 Using the relation: pdf = x * exp(-x
<sup>2</sup>)/
2 σ<sup>2</sup>
194 Using the relation: p =
1 - exp(-x
<sup>2</sup>/
2)
σ<sup>2</sup>   = -
<a class=
"link" href=
"../../powers/expm1.html" title=
"expm1">expm1
</a>(-x
<sup>2</sup>/
2)
207 Using the relation: q = exp(-x
<sup>2</sup>/
2) *
σ<sup>2</sup>
219 Using the relation: x = sqrt(-
2 *
σ <sup>2</sup>) * log(
1 - p)) = sqrt(-
2
220 *
σ <sup>2</sup>) *
<a class=
"link" href=
"../../powers/log1p.html" title=
"log1p">log1p
</a>(-p))
227 quantile from the complement
232 Using the relation: x = sqrt(-
2 *
σ <sup>2</sup>) * log(q))
244 σ * sqrt(
π/
2)
256 σ<sup>2</sup> * (
4 -
π/
2)
280 Constant from
<a href=
"http://mathworld.wolfram.com/RayleighDistribution.html" target=
"_top">Weisstein,
281 Eric W.
"Weibull Distribution." From MathWorld--A Wolfram
294 Constant from
<a href=
"http://mathworld.wolfram.com/RayleighDistribution.html" target=
"_top">Weisstein,
295 Eric W.
"Weibull Distribution." From MathWorld--A Wolfram
308 Constant from
<a href=
"http://mathworld.wolfram.com/RayleighDistribution.html" target=
"_top">Weisstein,
309 Eric W.
"Weibull Distribution." From MathWorld--A Wolfram
317 <a name=
"math_toolkit.dist_ref.dists.rayleigh.h5"></a>
318 <span class=
"phrase"><a name=
"math_toolkit.dist_ref.dists.rayleigh.references"></a></span><a class=
"link" href=
"rayleigh.html#math_toolkit.dist_ref.dists.rayleigh.references">References
</a>
320 <div class=
"itemizedlist"><ul class=
"itemizedlist" style=
"list-style-type: disc; ">
321 <li class=
"listitem">
322 <a href=
"http://en.wikipedia.org/wiki/Rayleigh_distribution" target=
"_top">http://en.wikipedia.org/wiki/Rayleigh_distribution
</a>
324 <li class=
"listitem">
325 <a href=
"http://mathworld.wolfram.com/RayleighDistribution.html" target=
"_top">Weisstein,
326 Eric W.
"Rayleigh Distribution." From MathWorld--A Wolfram
331 <table xmlns:
rev=
"http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width=
"100%"><tr>
332 <td align=
"left"></td>
333 <td align=
"right"><div class=
"copyright-footer">Copyright
© 2006-
2010,
2012-
2014 Nikhar Agrawal,
334 Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
335 Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R
åde, Gautam Sewani,
336 Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang
<p>
337 Distributed under the Boost Software License, Version
1.0. (See accompanying
338 file LICENSE_1_0.txt or copy at
<a href=
"http://www.boost.org/LICENSE_1_0.txt" target=
"_top">http://www.boost.org/LICENSE_1_0.txt
</a>)
343 <div class=
"spirit-nav">
344 <a accesskey=
"p" href=
"poisson_dist.html"><img src=
"../../../../../../../doc/src/images/prev.png" alt=
"Prev"></a><a accesskey=
"u" href=
"../dists.html"><img src=
"../../../../../../../doc/src/images/up.png" alt=
"Up"></a><a accesskey=
"h" href=
"../../../index.html"><img src=
"../../../../../../../doc/src/images/home.png" alt=
"Home"></a><a accesskey=
"n" href=
"skew_normal_dist.html"><img src=
"../../../../../../../doc/src/images/next.png" alt=
"Next"></a>