<title>Cauchy-Lorentz Distribution</title>
<link rel="stylesheet" href="../../../math.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
-<link rel="home" href="../../../index.html" title="Math Toolkit 2.10.0">
+<link rel="home" href="../../../index.html" title="Math Toolkit 2.11.0">
<link rel="up" href="../dists.html" title="Distributions">
<link rel="prev" href="binomial_dist.html" title="Binomial Distribution">
<link rel="next" href="chi_squared_dist.html" title="Chi Squared Distribution">
</h4></div></div></div>
<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">cauchy</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span></pre>
<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>
- <span class="keyword">class</span> <a class="link" href="../../../policy.html" title="Chapter 19. 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>
+ <span class="keyword">class</span> <a class="link" href="../../../policy.html" title="Chapter 20. 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>
<span class="keyword">class</span> <span class="identifier">cauchy_distribution</span><span class="special">;</span>
<span class="keyword">typedef</span> <span class="identifier">cauchy_distribution</span><span class="special"><></span> <span class="identifier">cauchy</span><span class="special">;</span>
-<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 19. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
+<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 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
<span class="keyword">class</span> <span class="identifier">cauchy_distribution</span>
<span class="special">{</span>
<span class="keyword">public</span><span class="special">:</span>
probability distribution</a> with <a href="http://en.wikipedia.org/wiki/Probability_distribution" target="_top">probability
distribution function PDF</a> given by:
</p>
+<div class="blockquote"><blockquote class="blockquote"><p>
+ <span class="inlinemediaobject"><img src="../../../../equations/cauchy_ref1.svg"></span>
+
+ </p></blockquote></div>
<p>
- <span class="inlinemediaobject"><img src="../../../../equations/cauchy_ref1.svg"></span>
- </p>
-<p>
- The location parameter x<sub>0</sub>   is the location of the peak of the distribution
- (the mode of the distribution), while the scale parameter γ   specifies half
- the width of the PDF at half the maximum height. If the location is zero,
- and the scale 1, then the result is a standard Cauchy distribution.
+ The location parameter <span class="emphasis"><em>x<sub>0</sub></em></span> is the location of the peak
+ of the distribution (the mode of the distribution), while the scale parameter
+ γ specifies half the width of the PDF at half the maximum height. If the
+ location is zero, and the scale 1, then the result is a standard Cauchy
+ distribution.
</p>
<p>
The distribution is important in physics as it is the solution to the differential
The following graph shows how the distributions moves as the location parameter
changes:
</p>
-<p>
- <span class="inlinemediaobject"><img src="../../../../graphs/cauchy_pdf1.svg" align="middle"></span>
- </p>
+<div class="blockquote"><blockquote class="blockquote"><p>
+ <span class="inlinemediaobject"><img src="../../../../graphs/cauchy_pdf1.svg" align="middle"></span>
+
+ </p></blockquote></div>
<p>
While the following graph shows how the shape (scale) parameter alters
the distribution:
</p>
-<p>
- <span class="inlinemediaobject"><img src="../../../../graphs/cauchy_pdf2.svg" align="middle"></span>
- </p>
+<div class="blockquote"><blockquote class="blockquote"><p>
+ <span class="inlinemediaobject"><img src="../../../../graphs/cauchy_pdf2.svg" align="middle"></span>
+
+ </p></blockquote></div>
<h5>
<a name="math_toolkit.dist_ref.dists.cauchy_dist.h0"></a>
<span class="phrase"><a name="math_toolkit.dist_ref.dists.cauchy_dist.member_functions"></a></span><a class="link" href="cauchy_dist.html#math_toolkit.dist_ref.dists.cauchy_dist.member_functions">Member
</h5>
<p>
In the following table x<sub>0 </sub> is the location parameter of the distribution,
- γ   is its scale parameter, <span class="emphasis"><em>x</em></span> is the random variate,
+ γ is its scale parameter, <span class="emphasis"><em>x</em></span> is the random variate,
<span class="emphasis"><em>p</em></span> is the probability and <span class="emphasis"><em>q = 1-p</em></span>.
</p>
<div class="informaltable"><table class="table">
</td>
<td>
<p>
- Using the relation: pdf = 1 / (π * γ * (1 + ((x - x<sub>0 </sub>) / γ)<sup>2</sup>)
+ Using the relation: <span class="emphasis"><em>pdf = 1 / (π * γ * (1 + ((x - x<sub>0 </sub>)
+ / γ)<sup>2</sup>) </em></span>
</p>
</td>
</tr>
<p>
The cdf is normally given by:
</p>
- <p>
- p = 0.5 + atan(x)/π
- </p>
+ <div class="blockquote"><blockquote class="blockquote"><p>
+ <span class="serif_italic">p = 0.5 + atan(x)/π</span>
+ </p></blockquote></div>
<p>
But that suffers from cancellation error as x -> -∞. So recall
that for <code class="computeroutput"><span class="identifier">x</span> <span class="special"><</span>
<span class="number">0</span></code>:
</p>
- <p>
- atan(x) = -π/2 - atan(1/x)
- </p>
+ <div class="blockquote"><blockquote class="blockquote"><p>
+ <span class="serif_italic">atan(x) = -π/2 - atan(1/x)</span>
+ </p></blockquote></div>
<p>
Substituting into the above we get:
</p>
- <p>
- p = -atan(1/x) ; x < 0
- </p>
+ <div class="blockquote"><blockquote class="blockquote"><p>
+ <span class="serif_italic">p = -atan(1/x) ; x < 0</span>
+ </p></blockquote></div>
<p>
So the procedure is to calculate the cdf for -fabs(x) using the
above formula. Note that to factor in the location and scale
- parameters you must substitute (x - x<sub>0 </sub>) / γ   for x in the above.
+ parameters you must substitute (x - x<sub>0 </sub>) / γ for x in the above.
</p>
<p>
This procedure yields the smaller of <span class="emphasis"><em>p</em></span> and
from the probability or its complement. First the argument <span class="emphasis"><em>p</em></span>
is reduced to the range [-0.5, 0.5], then the relation
</p>
- <p>
- x = x<sub>0 </sub> ± γ   / tan(π * p)
- </p>
+ <div class="blockquote"><blockquote class="blockquote"><p>
+ <span class="serif_italic">x = x<sub>0 </sub> ± γ / tan(π * p)</span>
+ </p></blockquote></div>
<p>
is used to obtain the result. Whether we're adding or subtracting
from x<sub>0 </sub> is determined by whether we're starting from the complement