File: exponential.qbk

package info (click to toggle)
boost1.35 1.35.0-5
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 203,856 kB
  • ctags: 337,867
  • sloc: cpp: 938,683; xml: 56,847; ansic: 41,589; python: 18,999; sh: 11,566; makefile: 664; perl: 494; yacc: 456; asm: 353; csh: 6
file content (101 lines) | stat: -rw-r--r-- 3,336 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
[section:exp_dist Exponential Distribution]

``#include <boost/math/distributions/exponential.hpp>``

   template <class RealType = double, 
             class ``__Policy``   = ``__policy_class`` >
   class exponential_distribution;

   typedef exponential_distribution<> exponential;

   template <class RealType, class ``__Policy``>
   class exponential_distribution
   {
   public:
      typedef RealType value_type;
      typedef Policy   policy_type;

      exponential_distribution(RealType lambda = 1);

      RealType lambda()const;
   };


The [@http://en.wikipedia.org/wiki/Exponential_distribution exponential distribution]
is a [@http://en.wikipedia.org/wiki/Probability_distribution continuous probability distribution]
with PDF:

[equation exponential_dist_ref1]

It is often used to model the time between independent 
events that happen at a constant average rate.

The following graph shows how the distribution changes for different
values of the rate parameter lambda:

[$../graphs/exponential_dist.png]

[h4 Member Functions]

   exponential_distribution(RealType lambda = 1);
   
Constructs an
[@http://en.wikipedia.org/wiki/Exponential_distribution Exponential distribution]
with parameter /lambda/.
Lambda is defined as the reciprocal of the scale parameter.

Requires lambda > 0, otherwise calls __domain_error.

   RealType lambda()const;
   
Accessor function returns the lambda parameter of the distribution.
   
[h4 Non-member Accessors]

All the [link math_toolkit.dist.dist_ref.nmp usual non-member accessor functions]
that are generic to all distributions are supported: __usual_accessors.

The domain of the random variable is \[0, +[infin]\].

[h4 Accuracy]

The exponential distribution is implemented in terms of the 
standard library functions `exp`, `log`, `log1p` and `expm1`
and as such should have very low error rates.

[h4 Implementation]

In the following table [lambda] is the parameter lambda of the distribution, 
/x/ is the random variate, /p/ is the probability and /q = 1-p/.

[table
[[Function][Implementation Notes]]
[[pdf][Using the relation: pdf = [lambda] * exp(-[lambda] * x) ]]
[[cdf][Using the relation: p = 1 - exp(-x * [lambda]) = -expm1(-x * [lambda]) ]]
[[cdf complement][Using the relation: q = exp(-x * [lambda]) ]]
[[quantile][Using the relation: x = -log(1-p) / [lambda] = -log1p(-p) / [lambda]]]
[[quantile from the complement][Using the relation: x = -log(q) / [lambda]]]
[[mean][1/[lambda]]]
[[standard deviation][1/[lambda]]]
[[mode][0]]
[[skewness][2]]
[[kurtosis][9]]
[[kurtosis excess][6]]
]

[h4 references]

* [@http://mathworld.wolfram.com/ExponentialDistribution.html Weisstein, Eric W. "Exponential Distribution." From MathWorld--A Wolfram Web Resource]
* [@http://documents.wolfram.com/calccenter/Functions/ListsMatrices/Statistics/ExponentialDistribution.html Wolfram Mathematica calculator]
* [@http://www.itl.nist.gov/div898/handbook/eda/section3/eda3667.htm NIST Exploratory Data Analysis]
* [@http://en.wikipedia.org/wiki/Exponential_distribution Wikipedia Exponential distribution]

[endsect][/section:exp_dist Exponential]

[/ exponential.qbk
  Copyright 2006 John Maddock and Paul A. Bristow.
  Distributed under the Boost Software License, Version 1.0.
  (See accompanying file LICENSE_1_0.txt or copy at
  http://www.boost.org/LICENSE_1_0.txt).
]