3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Exponential Distribution</title>
5 <link rel="stylesheet" href="../../../../../../../../../doc/src/boostbook.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.76.1">
7 <link rel="home" href="../../../../index.html" title="Math Toolkit">
8 <link rel="up" href="../dists.html" title="Distributions">
9 <link rel="prev" href="chi_squared_dist.html" title="Chi Squared Distribution">
10 <link rel="next" href="extreme_dist.html" title="Extreme Value 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="chi_squared_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="extreme_dist.html"><img src="../../../../../../../../../doc/src/images/next.png" alt="Next"></a>
25 <div class="section math_toolkit_dist_dist_ref_dists_exp_dist">
26 <div class="titlepage"><div><div><h5 class="title">
27 <a name="math_toolkit.dist.dist_ref.dists.exp_dist"></a><a class="link" href="exp_dist.html" title="Exponential Distribution">Exponential
29 </h5></div></div></div>
32 <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">exponential</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></pre>
35 <pre class="programlisting"><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>
36 <span class="keyword">class</span> <a class="link" href="../../../policy.html" title="Policies">Policy</a> <span class="special">=</span> <a class="link" href="../../../policy/pol_ref/pol_ref_ref.html" title="Policy Class Reference">policies::policy<></a> <span class="special">></span>
37 <span class="keyword">class</span> <span class="identifier">exponential_distribution</span><span class="special">;</span>
39 <span class="keyword">typedef</span> <span class="identifier">exponential_distribution</span><span class="special"><></span> <span class="identifier">exponential</span><span class="special">;</span>
41 <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="Policies">Policy</a><span class="special">></span>
42 <span class="keyword">class</span> <span class="identifier">exponential_distribution</span>
43 <span class="special">{</span>
44 <span class="keyword">public</span><span class="special">:</span>
45 <span class="keyword">typedef</span> <span class="identifier">RealType</span> <span class="identifier">value_type</span><span class="special">;</span>
46 <span class="keyword">typedef</span> <span class="identifier">Policy</span> <span class="identifier">policy_type</span><span class="special">;</span>
48 <span class="identifier">exponential_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">lambda</span> <span class="special">=</span> <span class="number">1</span><span class="special">);</span>
50 <span class="identifier">RealType</span> <span class="identifier">lambda</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
51 <span class="special">};</span>
54 The <a href="http://en.wikipedia.org/wiki/Exponential_distribution" target="_top">exponential
55 distribution</a> is a <a href="http://en.wikipedia.org/wiki/Probability_distribution" target="_top">continuous
56 probability distribution</a> with PDF:
59 <span class="inlinemediaobject"><img src="../../../../../equations/exponential_dist_ref1.png"></span>
62 It is often used to model the time between independent events that happen
63 at a constant average rate.
66 The following graph shows how the distribution changes for different
67 values of the rate parameter lambda:
70 <span class="inlinemediaobject"><img src="../../../../../graphs/exponential_pdf.png" align="middle"></span>
73 <a name="math_toolkit.dist.dist_ref.dists.exp_dist.h0"></a>
74 <span><a name="math_toolkit.dist.dist_ref.dists.exp_dist.member_functions"></a></span><a class="link" href="exp_dist.html#math_toolkit.dist.dist_ref.dists.exp_dist.member_functions">Member
77 <pre class="programlisting"><span class="identifier">exponential_distribution</span><span class="special">(</span><span class="identifier">RealType</span> <span class="identifier">lambda</span> <span class="special">=</span> <span class="number">1</span><span class="special">);</span>
80 Constructs an <a href="http://en.wikipedia.org/wiki/Exponential_distribution" target="_top">Exponential
81 distribution</a> with parameter <span class="emphasis"><em>lambda</em></span>. Lambda
82 is defined as the reciprocal of the scale parameter.
85 Requires lambda > 0, otherwise calls <a class="link" href="../../../main_overview/error_handling.html#domain_error">domain_error</a>.
87 <pre class="programlisting"><span class="identifier">RealType</span> <span class="identifier">lambda</span><span class="special">()</span><span class="keyword">const</span><span class="special">;</span>
90 Accessor function returns the lambda parameter of the distribution.
93 <a name="math_toolkit.dist.dist_ref.dists.exp_dist.h1"></a>
94 <span><a name="math_toolkit.dist.dist_ref.dists.exp_dist.non_member_accessors"></a></span><a class="link" href="exp_dist.html#math_toolkit.dist.dist_ref.dists.exp_dist.non_member_accessors">Non-member
98 All the <a class="link" href="../nmp.html" title="Non-Member Properties">usual non-member
99 accessor functions</a> that are generic to all distributions are supported:
100 <a class="link" href="../nmp.html#math.dist.cdf">Cumulative Distribution Function</a>,
101 <a class="link" href="../nmp.html#math.dist.pdf">Probability Density Function</a>, <a class="link" href="../nmp.html#math.dist.quantile">Quantile</a>, <a class="link" href="../nmp.html#math.dist.hazard">Hazard
102 Function</a>, <a class="link" href="../nmp.html#math.dist.chf">Cumulative Hazard Function</a>,
103 <a class="link" href="../nmp.html#math.dist.mean">mean</a>, <a class="link" href="../nmp.html#math.dist.median">median</a>,
104 <a class="link" href="../nmp.html#math.dist.mode">mode</a>, <a class="link" href="../nmp.html#math.dist.variance">variance</a>,
105 <a class="link" href="../nmp.html#math.dist.sd">standard deviation</a>, <a class="link" href="../nmp.html#math.dist.skewness">skewness</a>,
106 <a class="link" href="../nmp.html#math.dist.kurtosis">kurtosis</a>, <a class="link" href="../nmp.html#math.dist.kurtosis_excess">kurtosis_excess</a>,
107 <a class="link" href="../nmp.html#math.dist.range">range</a> and <a class="link" href="../nmp.html#math.dist.support">support</a>.
110 The domain of the random variable is [0, +∞].
113 <a name="math_toolkit.dist.dist_ref.dists.exp_dist.h2"></a>
114 <span><a name="math_toolkit.dist.dist_ref.dists.exp_dist.accuracy"></a></span><a class="link" href="exp_dist.html#math_toolkit.dist.dist_ref.dists.exp_dist.accuracy">Accuracy</a>
117 The exponential distribution is implemented in terms of the standard
118 library functions <code class="computeroutput"><span class="identifier">exp</span></code>,
119 <code class="computeroutput"><span class="identifier">log</span></code>, <code class="computeroutput"><span class="identifier">log1p</span></code>
120 and <code class="computeroutput"><span class="identifier">expm1</span></code> and as such
121 should have very low error rates.
124 <a name="math_toolkit.dist.dist_ref.dists.exp_dist.h3"></a>
125 <span><a name="math_toolkit.dist.dist_ref.dists.exp_dist.implementation"></a></span><a class="link" href="exp_dist.html#math_toolkit.dist.dist_ref.dists.exp_dist.implementation">Implementation</a>
128 In the following table λ is the parameter lambda of the distribution,
129 <span class="emphasis"><em>x</em></span> is the random variate, <span class="emphasis"><em>p</em></span>
130 is the probability and <span class="emphasis"><em>q = 1-p</em></span>.
132 <div class="informaltable"><table class="table">
158 Using the relation: pdf = λ * exp(-λ * x)
170 Using the relation: p = 1 - exp(-x * λ) = -expm1(-x * λ)
182 Using the relation: q = exp(-x * λ)
194 Using the relation: x = -log(1-p) / λ = -log1p(-p) / λ
201 quantile from the complement
206 Using the relation: x = -log(q) / λ
285 <a name="math_toolkit.dist.dist_ref.dists.exp_dist.h4"></a>
286 <span><a name="math_toolkit.dist.dist_ref.dists.exp_dist.references"></a></span><a class="link" href="exp_dist.html#math_toolkit.dist.dist_ref.dists.exp_dist.references">references</a>
288 <div class="itemizedlist"><ul class="itemizedlist" type="disc">
289 <li class="listitem">
290 <a href="http://mathworld.wolfram.com/ExponentialDistribution.html" target="_top">Weisstein,
291 Eric W. "Exponential Distribution." From MathWorld--A Wolfram
294 <li class="listitem">
295 <a href="http://documents.wolfram.com/calccenter/Functions/ListsMatrices/Statistics/ExponentialDistribution.html" target="_top">Wolfram
296 Mathematica calculator</a>
298 <li class="listitem">
299 <a href="http://www.itl.nist.gov/div898/handbook/eda/section3/eda3667.htm" target="_top">NIST
300 Exploratory Data Analysis</a>
302 <li class="listitem">
303 <a href="http://en.wikipedia.org/wiki/Exponential_distribution" target="_top">Wikipedia
304 Exponential distribution</a>
308 (See also the reference documentation for the related <a class="link" href="extreme_dist.html" title="Extreme Value Distribution">Extreme
311 <div class="itemizedlist"><ul class="itemizedlist" type="disc"><li class="listitem">
312 <a href="http://www.worldscibooks.com/mathematics/p191.html" target="_top">Extreme
313 Value Distributions, Theory and Applications Samuel Kotz & Saralees
314 Nadarajah</a> discuss the relationship of the types of extreme
318 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
319 <td align="left"></td>
320 <td align="right"><div class="copyright-footer">Copyright © 2006-2010 John Maddock, Paul A. Bristow, Hubert Holin, Xiaogang Zhang, Bruno
321 Lalande, Johan Råde, Gautam Sewani, Thijs van den Berg and Benjamin Sobotta<p>
322 Distributed under the Boost Software License, Version 1.0. (See accompanying
323 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>)
328 <div class="spirit-nav">
329 <a accesskey="p" href="chi_squared_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="extreme_dist.html"><img src="../../../../../../../../../doc/src/images/next.png" alt="Next"></a>