]> git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/math/doc/distributions/uniform.qbk
bump version to 12.2.2-pve1
[ceph.git] / ceph / src / boost / libs / math / doc / distributions / uniform.qbk
1 [section:uniform_dist Uniform Distribution]
2
3
4 ``#include <boost/math/distributions/uniform.hpp>``
5
6 namespace boost{ namespace math{
7 template <class RealType = double,
8 class ``__Policy`` = ``__policy_class`` >
9 class uniform_distribution;
10
11 typedef uniform_distribution<> uniform;
12
13 template <class RealType, class ``__Policy``>
14 class uniform_distribution
15 {
16 public:
17 typedef RealType value_type;
18
19 uniform_distribution(RealType lower = 0, RealType upper = 1); // Constructor.
20 : m_lower(lower), m_upper(upper) // Default is standard uniform distribution.
21 // Accessor functions.
22 RealType lower()const;
23 RealType upper()const;
24 }; // class uniform_distribution
25
26 }} // namespaces
27
28 The uniform distribution, also known as a rectangular distribution,
29 is a probability distribution that has constant probability.
30
31 The [@http://en.wikipedia.org/wiki/Uniform_distribution_%28continuous%29 continuous uniform distribution]
32 is a distribution with the
33 [@http://en.wikipedia.org/wiki/Probability_density_function probability density function]:
34
35 f(x) =
36
37 * 1 / (upper - lower) for lower < x < upper
38
39 * zero for x < lower or x > upper
40
41 and in this implementation:
42
43 * 1 / (upper - lower) for x = lower or x = upper
44
45 The choice of x = lower or x = upper is made because statistical use of this distribution judged is most likely:
46 the method of maximum likelihood uses this definition.
47
48 There is also a [@http://en.wikipedia.org/wiki/Discrete_uniform_distribution *discrete* uniform distribution].
49
50 Parameters lower and upper can be any finite value.
51
52 The [@http://en.wikipedia.org/wiki/Random_variate random variate]
53 x must also be finite, and is supported lower <= x <= upper.
54
55 The lower parameter is also called the
56 [@http://www.itl.nist.gov/div898/handbook/eda/section3/eda364.htm location parameter],
57 [@http://en.wikipedia.org/wiki/Location_parameter that is where the origin of a plot will lie],
58 and (upper - lower) is also called the [@http://en.wikipedia.org/wiki/Scale_parameter scale parameter].
59
60 The following graph illustrates how the
61 [@http://en.wikipedia.org/wiki/Probability_density_function probability density function PDF]
62 varies with the shape parameter:
63
64 [graph uniform_pdf]
65
66 Likewise for the CDF:
67
68 [graph uniform_cdf]
69
70 [h4 Member Functions]
71
72 uniform_distribution(RealType lower = 0, RealType upper = 1);
73
74 Constructs a [@http://en.wikipedia.org/wiki/uniform_distribution
75 uniform distribution] with lower /lower/ (a) and upper /upper/ (b).
76
77 Requires that the /lower/ and /upper/ parameters are both finite;
78 otherwise if infinity or NaN then calls __domain_error.
79
80 RealType lower()const;
81
82 Returns the /lower/ parameter of this distribution.
83
84 RealType upper()const;
85
86 Returns the /upper/ parameter of this distribution.
87
88 [h4 Non-member Accessors]
89
90 All the [link math_toolkit.dist_ref.nmp usual non-member accessor functions]
91 that are generic to all distributions are supported: __usual_accessors.
92
93 The domain of the random variable is any finite value,
94 but the supported range is only /lower/ <= x <= /upper/.
95
96 [h4 Accuracy]
97
98 The uniform distribution is implemented with simple arithmetic operators and so should have errors within an epsilon or two.
99
100 [h4 Implementation]
101
102 In the following table a is the /lower/ parameter of the distribution,
103 b is the /upper/ parameter,
104 /x/ is the random variate, /p/ is the probability and /q = 1-p/.
105
106 [table
107 [[Function][Implementation Notes]]
108 [[pdf][Using the relation: pdf = 0 for x < a, 1 / (b - a) for a <= x <= b, 0 for x > b ]]
109 [[cdf][Using the relation: cdf = 0 for x < a, (x - a) / (b - a) for a <= x <= b, 1 for x > b]]
110 [[cdf complement][Using the relation: q = 1 - p, (b - x) / (b - a) ]]
111 [[quantile][Using the relation: x = p * (b - a) + a; ]]
112 [[quantile from the complement][x = -q * (b - a) + b ]]
113 [[mean][(a + b) / 2 ]]
114 [[variance][(b - a) [super 2] / 12 ]]
115 [[mode][any value in \[a, b\] but a is chosen. (Would NaN be better?) ]]
116 [[skewness][0]]
117 [[kurtosis excess][-6/5 = -1.2 exactly. (kurtosis - 3)]]
118 [[kurtosis][9/5]]
119 ]
120
121 [h4 References]
122 * [@http://en.wikipedia.org/wiki/Uniform_distribution_%28continuous%29 Wikpedia continuous uniform distribution]
123 * [@http://mathworld.wolfram.com/UniformDistribution.html Weisstein, Weisstein, Eric W. "Uniform Distribution." From MathWorld--A Wolfram Web Resource.]
124 * [@http://www.itl.nist.gov/div898/handbook/eda/section3/eda3662.htm]
125
126 [endsect][/section:uniform_dist Uniform]
127
128 [/
129 Copyright 2006 John Maddock and Paul A. Bristow.
130 Distributed under the Boost Software License, Version 1.0.
131 (See accompanying file LICENSE_1_0.txt or copy at
132 http://www.boost.org/LICENSE_1_0.txt).
133 ]
134