From Jason Turner

[rand.dist.norm]

Diff to HTML by rtfpessoa

Files changed (1) hide show
  1. tmp/tmp1h6ce745/{from.md → to.md} +50 -68
tmp/tmp1h6ce745/{from.md → to.md} RENAMED
@@ -10,11 +10,11 @@ numbers x distributed according to the probability density function $$%
10
  % e^{-(x-\mu)^2 / (2\sigma^2)}
11
  \exp{\left(- \, \frac{(x - \mu)^2}
12
  {2 \sigma^2}
13
  \right)
14
  }
15
- \; \mbox{.}$$ The distribution parameters μ and σ are also known as this
16
  distribution’s *mean* and *standard deviation* .
17
 
18
  ``` cpp
19
  template<class RealType = double>
20
  class normal_distribution {
@@ -22,11 +22,12 @@ template<class RealType = double>
22
  // types
23
  using result_type = RealType;
24
  using param_type = unspecified;
25
 
26
  // constructors and reset functions
27
- explicit normal_distribution(RealType mean = 0.0, RealType stddev = 1.0);
 
28
  explicit normal_distribution(const param_type& parm);
29
  void reset();
30
 
31
  // generating functions
32
  template<class URBG>
@@ -43,17 +44,17 @@ template<class RealType = double>
43
  result_type max() const;
44
  };
45
  ```
46
 
47
  ``` cpp
48
- explicit normal_distribution(RealType mean = 0.0, RealType stddev = 1.0);
49
  ```
50
 
51
- *Requires:* 0 < `stddev`.
52
 
53
- *Effects:* Constructs a `normal_distribution` object; `mean` and
54
- `stddev` correspond to the respective parameters of the distribution.
55
 
56
  ``` cpp
57
  RealType mean() const;
58
  ```
59
 
@@ -69,31 +70,25 @@ constructed.
69
 
70
  ##### Class template `lognormal_distribution` <a id="rand.dist.norm.lognormal">[[rand.dist.norm.lognormal]]</a>
71
 
72
  A `lognormal_distribution` random number distribution produces random
73
  numbers x > 0 distributed according to the probability density function
74
- $$%
75
- p(x\,|\,m,s)
76
- = \frac{1}
77
- {s x \sqrt{2 \pi}}
78
- \cdot
79
- \exp{\left(- \, \frac{(\ln{x} - m)^2}
80
- {2 s^2}
81
- \right)
82
- }
83
- \; \mbox{.}$$
84
 
85
  ``` cpp
86
  template<class RealType = double>
87
  class lognormal_distribution {
88
  public:
89
  // types
90
  using result_type = RealType;
91
  using param_type = unspecified;
92
 
93
  // constructor and reset functions
94
- explicit lognormal_distribution(RealType m = 0.0, RealType s = 1.0);
 
95
  explicit lognormal_distribution(const param_type& parm);
96
  void reset();
97
 
98
  // generating functions
99
  template<class URBG>
@@ -110,17 +105,17 @@ template<class RealType = double>
110
  result_type max() const;
111
  };
112
  ```
113
 
114
  ``` cpp
115
- explicit lognormal_distribution(RealType m = 0.0, RealType s = 1.0);
116
  ```
117
 
118
- *Requires:* 0 < `s`.
119
 
120
- *Effects:* Constructs a `lognormal_distribution` object; `m` and `s`
121
- correspond to the respective parameters of the distribution.
122
 
123
  ``` cpp
124
  RealType m() const;
125
  ```
126
 
@@ -136,26 +131,23 @@ constructed.
136
 
137
  ##### Class template `chi_squared_distribution` <a id="rand.dist.norm.chisq">[[rand.dist.norm.chisq]]</a>
138
 
139
  A `chi_squared_distribution` random number distribution produces random
140
  numbers x > 0 distributed according to the probability density function
141
- $$%
142
- p(x\,|\,n)
143
- = \frac{ x^{(n/2)-1} \cdot e^{-x/2}}
144
- {\Gamma(n/2) \cdot 2^{n/2}}
145
- \; \mbox{.}$$
146
 
147
  ``` cpp
148
  template<class RealType = double>
149
  class chi_squared_distribution {
150
  public:
151
  // types
152
  using result_type = RealType;
153
  using param_type = unspecified;
154
 
155
  // constructor and reset functions
156
- explicit chi_squared_distribution(RealType n = 1);
 
157
  explicit chi_squared_distribution(const param_type& parm);
158
  void reset();
159
 
160
  // generating functions
161
  template<class URBG>
@@ -171,17 +163,16 @@ template<class RealType = double>
171
  result_type max() const;
172
  };
173
  ```
174
 
175
  ``` cpp
176
- explicit chi_squared_distribution(RealType n = 1);
177
  ```
178
 
179
- *Requires:* 0 < `n`.
180
 
181
- *Effects:* Constructs a `chi_squared_distribution` object; `n`
182
- corresponds to the parameter of the distribution.
183
 
184
  ``` cpp
185
  RealType n() const;
186
  ```
187
 
@@ -189,25 +180,24 @@ RealType n() const;
189
  constructed.
190
 
191
  ##### Class template `cauchy_distribution` <a id="rand.dist.norm.cauchy">[[rand.dist.norm.cauchy]]</a>
192
 
193
  A `cauchy_distribution` random number distribution produces random
194
- numbers x distributed according to the probability density function $$%
195
- p(x\,|\,a,b)
196
- = \left( \pi b \left( 1 + \left( \frac{x-a}{b} \right)^2 \;\right)\right)^{-1}
197
- \; \mbox{.}$$
198
 
199
  ``` cpp
200
  template<class RealType = double>
201
  class cauchy_distribution {
202
  public:
203
  // types
204
  using result_type = RealType;
205
  using param_type = unspecified;
206
 
207
  // constructor and reset functions
208
- explicit cauchy_distribution(RealType a = 0.0, RealType b = 1.0);
 
209
  explicit cauchy_distribution(const param_type& parm);
210
  void reset();
211
 
212
  // generating functions
213
  template<class URBG>
@@ -224,17 +214,17 @@ template<class RealType = double>
224
  result_type max() const;
225
  };
226
  ```
227
 
228
  ``` cpp
229
- explicit cauchy_distribution(RealType a = 0.0, RealType b = 1.0);
230
  ```
231
 
232
- *Requires:* 0 < `b`.
233
 
234
- *Effects:* Constructs a `cauchy_distribution` object; `a` and `b`
235
- correspond to the respective parameters of the distribution.
236
 
237
  ``` cpp
238
  RealType a() const;
239
  ```
240
 
@@ -250,32 +240,27 @@ constructed.
250
 
251
  ##### Class template `fisher_f_distribution` <a id="rand.dist.norm.f">[[rand.dist.norm.f]]</a>
252
 
253
  A `fisher_f_distribution` random number distribution produces random
254
  numbers x ≥ 0 distributed according to the probability density function
255
- $$%
256
- p(x\,|\,m,n)
257
- = \frac{\Gamma\big((m+n)/2\big)}
258
- {\Gamma(m/2) \; \Gamma(n/2)}
259
- \cdot
260
- \left(\frac{m}{n}\right)^{m/2}
261
- \cdot
262
- x^{(m/2)-1}
263
- \cdot
264
- {\left( 1 + \frac{m x}{n} \right)}^{-(m+n)/2}
265
- \; \mbox{.}$$
266
 
267
  ``` cpp
268
  template<class RealType = double>
269
  class fisher_f_distribution {
270
  public:
271
  // types
272
  using result_type = RealType;
273
  using param_type = unspecified;
274
 
275
  // constructor and reset functions
276
- explicit fisher_f_distribution(RealType m = 1, RealType n = 1);
 
277
  explicit fisher_f_distribution(const param_type& parm);
278
  void reset();
279
 
280
  // generating functions
281
  template<class URBG>
@@ -292,17 +277,17 @@ template<class RealType = double>
292
  result_type max() const;
293
  };
294
  ```
295
 
296
  ``` cpp
297
- explicit fisher_f_distribution(RealType m = 1, RealType n = 1);
298
  ```
299
 
300
- *Requires:* 0 < `m` and 0 < `n`.
301
 
302
- *Effects:* Constructs a `fisher_f_distribution` object; `m` and `n`
303
- correspond to the respective parameters of the distribution.
304
 
305
  ``` cpp
306
  RealType m() const;
307
  ```
308
 
@@ -317,29 +302,27 @@ RealType n() const;
317
  constructed.
318
 
319
  ##### Class template `student_t_distribution` <a id="rand.dist.norm.t">[[rand.dist.norm.t]]</a>
320
 
321
  A `student_t_distribution` random number distribution produces random
322
- numbers x distributed according to the probability density function $$%
323
- p(x\,|\,n)
324
- = \frac{1}
325
- {\sqrt{n \pi}}
326
- \cdot \frac{\Gamma\big((n+1)/2\big)}
327
- {\Gamma(n/2)}
328
  \cdot \left(1 + \frac{x^2}{n} \right)^{-(n+1)/2}
329
- \; \mbox{.}$$
330
 
331
  ``` cpp
332
  template<class RealType = double>
333
  class student_t_distribution {
334
  public:
335
  // types
336
  using result_type = RealType;
337
  using param_type = unspecified;
338
 
339
  // constructor and reset functions
340
- explicit student_t_distribution(RealType n = 1);
 
341
  explicit student_t_distribution(const param_type& parm);
342
  void reset();
343
 
344
  // generating functions
345
  template<class URBG>
@@ -355,17 +338,16 @@ template<class RealType = double>
355
  result_type max() const;
356
  };
357
  ```
358
 
359
  ``` cpp
360
- explicit student_t_distribution(RealType n = 1);
361
  ```
362
 
363
- *Requires:* 0 < `n`.
364
 
365
- *Effects:* Constructs a `student_t_distribution` object; `n` corresponds
366
- to the parameter of the distribution.
367
 
368
  ``` cpp
369
  RealType n() const;
370
  ```
371
 
 
10
  % e^{-(x-\mu)^2 / (2\sigma^2)}
11
  \exp{\left(- \, \frac{(x - \mu)^2}
12
  {2 \sigma^2}
13
  \right)
14
  }
15
+ \text{ .}$$ The distribution parameters μ and σ are also known as this
16
  distribution’s *mean* and *standard deviation* .
17
 
18
  ``` cpp
19
  template<class RealType = double>
20
  class normal_distribution {
 
22
  // types
23
  using result_type = RealType;
24
  using param_type = unspecified;
25
 
26
  // constructors and reset functions
27
+ normal_distribution() : normal_distribution(0.0) {}
28
+ explicit normal_distribution(RealType mean, RealType stddev = 1.0);
29
  explicit normal_distribution(const param_type& parm);
30
  void reset();
31
 
32
  // generating functions
33
  template<class URBG>
 
44
  result_type max() const;
45
  };
46
  ```
47
 
48
  ``` cpp
49
+ explicit normal_distribution(RealType mean, RealType stddev = 1.0);
50
  ```
51
 
52
+ *Preconditions:* 0 < `stddev`.
53
 
54
+ *Remarks:* `mean` and `stddev` correspond to the respective parameters
55
+ of the distribution.
56
 
57
  ``` cpp
58
  RealType mean() const;
59
  ```
60
 
 
70
 
71
  ##### Class template `lognormal_distribution` <a id="rand.dist.norm.lognormal">[[rand.dist.norm.lognormal]]</a>
72
 
73
  A `lognormal_distribution` random number distribution produces random
74
  numbers x > 0 distributed according to the probability density function
75
+ $$p(x\,|\,m,s) = \frac{1}{s x \sqrt{2 \pi}}
76
+ \cdot \exp{\left(-\frac{(\ln{x} - m)^2}{2 s^2}\right)}
77
+ \text{ .}$$
 
 
 
 
 
 
 
78
 
79
  ``` cpp
80
  template<class RealType = double>
81
  class lognormal_distribution {
82
  public:
83
  // types
84
  using result_type = RealType;
85
  using param_type = unspecified;
86
 
87
  // constructor and reset functions
88
+ lognormal_distribution() : lognormal_distribution(0.0) {}
89
+ explicit lognormal_distribution(RealType m, RealType s = 1.0);
90
  explicit lognormal_distribution(const param_type& parm);
91
  void reset();
92
 
93
  // generating functions
94
  template<class URBG>
 
105
  result_type max() const;
106
  };
107
  ```
108
 
109
  ``` cpp
110
+ explicit lognormal_distribution(RealType m, RealType s = 1.0);
111
  ```
112
 
113
+ *Preconditions:* 0 < `s`.
114
 
115
+ *Remarks:* `m` and `s` correspond to the respective parameters of the
116
+ distribution.
117
 
118
  ``` cpp
119
  RealType m() const;
120
  ```
121
 
 
131
 
132
  ##### Class template `chi_squared_distribution` <a id="rand.dist.norm.chisq">[[rand.dist.norm.chisq]]</a>
133
 
134
  A `chi_squared_distribution` random number distribution produces random
135
  numbers x > 0 distributed according to the probability density function
136
+ $$p(x\,|\,n) = \frac{x^{(n/2)-1} \cdot e^{-x/2}}{\Gamma(n/2) \cdot 2^{n/2}} \text{ .}$$
 
 
 
 
137
 
138
  ``` cpp
139
  template<class RealType = double>
140
  class chi_squared_distribution {
141
  public:
142
  // types
143
  using result_type = RealType;
144
  using param_type = unspecified;
145
 
146
  // constructor and reset functions
147
+ chi_squared_distribution() : chi_squared_distribution(1.0) {}
148
+ explicit chi_squared_distribution(RealType n);
149
  explicit chi_squared_distribution(const param_type& parm);
150
  void reset();
151
 
152
  // generating functions
153
  template<class URBG>
 
163
  result_type max() const;
164
  };
165
  ```
166
 
167
  ``` cpp
168
+ explicit chi_squared_distribution(RealType n);
169
  ```
170
 
171
+ *Preconditions:* 0 < `n`.
172
 
173
+ *Remarks:* `n` corresponds to the parameter of the distribution.
 
174
 
175
  ``` cpp
176
  RealType n() const;
177
  ```
178
 
 
180
  constructed.
181
 
182
  ##### Class template `cauchy_distribution` <a id="rand.dist.norm.cauchy">[[rand.dist.norm.cauchy]]</a>
183
 
184
  A `cauchy_distribution` random number distribution produces random
185
+ numbers x distributed according to the probability density function
186
+ $$p(x\,|\,a,b) = \left(\pi b \left(1 + \left(\frac{x-a}{b} \right)^2 \, \right)\right)^{-1} \text{ .}$$
 
 
187
 
188
  ``` cpp
189
  template<class RealType = double>
190
  class cauchy_distribution {
191
  public:
192
  // types
193
  using result_type = RealType;
194
  using param_type = unspecified;
195
 
196
  // constructor and reset functions
197
+ cauchy_distribution() : cauchy_distribution(0.0) {}
198
+ explicit cauchy_distribution(RealType a, RealType b = 1.0);
199
  explicit cauchy_distribution(const param_type& parm);
200
  void reset();
201
 
202
  // generating functions
203
  template<class URBG>
 
214
  result_type max() const;
215
  };
216
  ```
217
 
218
  ``` cpp
219
+ explicit cauchy_distribution(RealType a, RealType b = 1.0);
220
  ```
221
 
222
+ *Preconditions:* 0 < `b`.
223
 
224
+ *Remarks:* `a` and `b` correspond to the respective parameters of the
225
+ distribution.
226
 
227
  ``` cpp
228
  RealType a() const;
229
  ```
230
 
 
240
 
241
  ##### Class template `fisher_f_distribution` <a id="rand.dist.norm.f">[[rand.dist.norm.f]]</a>
242
 
243
  A `fisher_f_distribution` random number distribution produces random
244
  numbers x ≥ 0 distributed according to the probability density function
245
+ $$p(x\,|\,m,n) = \frac{\Gamma\big((m+n)/2\big)}{\Gamma(m/2) \; \Gamma(n/2)}
246
+ \cdot \left(\frac{m}{n}\right)^{m/2}
247
+ \cdot x^{(m/2)-1}
248
+ \cdot \left(1 + \frac{m x}{n}\right)^{-(m + n)/2}
249
+ \text{ .}$$
 
 
 
 
 
 
250
 
251
  ``` cpp
252
  template<class RealType = double>
253
  class fisher_f_distribution {
254
  public:
255
  // types
256
  using result_type = RealType;
257
  using param_type = unspecified;
258
 
259
  // constructor and reset functions
260
+ fisher_f_distribution() : fisher_f_distribution(1.0) {}
261
+ explicit fisher_f_distribution(RealType m, RealType n = 1.0);
262
  explicit fisher_f_distribution(const param_type& parm);
263
  void reset();
264
 
265
  // generating functions
266
  template<class URBG>
 
277
  result_type max() const;
278
  };
279
  ```
280
 
281
  ``` cpp
282
+ explicit fisher_f_distribution(RealType m, RealType n = 1);
283
  ```
284
 
285
+ *Preconditions:* 0 < `m` and 0 < `n`.
286
 
287
+ *Remarks:* `m` and `n` correspond to the respective parameters of the
288
+ distribution.
289
 
290
  ``` cpp
291
  RealType m() const;
292
  ```
293
 
 
302
  constructed.
303
 
304
  ##### Class template `student_t_distribution` <a id="rand.dist.norm.t">[[rand.dist.norm.t]]</a>
305
 
306
  A `student_t_distribution` random number distribution produces random
307
+ numbers x distributed according to the probability density function
308
+ $$p(x\,|\,n) = \frac{1}{\sqrt{n \pi}}
309
+ \cdot \frac{\Gamma\big((n+1)/2\big)}{\Gamma(n/2)}
 
 
 
310
  \cdot \left(1 + \frac{x^2}{n} \right)^{-(n+1)/2}
311
+ \text{ .}$$
312
 
313
  ``` cpp
314
  template<class RealType = double>
315
  class student_t_distribution {
316
  public:
317
  // types
318
  using result_type = RealType;
319
  using param_type = unspecified;
320
 
321
  // constructor and reset functions
322
+ student_t_distribution() : student_t_distribution(1.0) {}
323
+ explicit student_t_distribution(RealType n);
324
  explicit student_t_distribution(const param_type& parm);
325
  void reset();
326
 
327
  // generating functions
328
  template<class URBG>
 
338
  result_type max() const;
339
  };
340
  ```
341
 
342
  ``` cpp
343
+ explicit student_t_distribution(RealType n);
344
  ```
345
 
346
+ *Preconditions:* 0 < `n`.
347
 
348
+ *Remarks:* `n` corresponds to the parameter of the distribution.
 
349
 
350
  ``` cpp
351
  RealType n() const;
352
  ```
353