mirror of
https://github.com/boostorg/math.git
synced 2026-01-19 04:22:09 +00:00
[CI SKIP]Docs rebuilt with Brian Wignall's typos corrected.
This commit is contained in:
@@ -127,7 +127,7 @@ This manual is also available in <a href="http://sourceforge.net/projects/boost/
|
||||
</div>
|
||||
</div>
|
||||
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
|
||||
<td align="left"><p><small>Last revised: November 12, 2019 at 09:19:07 GMT</small></p></td>
|
||||
<td align="left"><p><small>Last revised: December 18, 2019 at 12:08:00 GMT</small></p></td>
|
||||
<td align="right"><div class="copyright-footer"></div></td>
|
||||
</tr></table>
|
||||
<hr>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="id2010205"></a>Function Index</h2></div></div></div>
|
||||
<a name="id1988591"></a>Function Index</h2></div></div></div>
|
||||
<p><a class="link" href="s01.html#idx_id_0">1</a> <a class="link" href="s01.html#idx_id_1">2</a> <a class="link" href="s01.html#idx_id_2">4</a> <a class="link" href="s01.html#idx_id_5">A</a> <a class="link" href="s01.html#idx_id_6">B</a> <a class="link" href="s01.html#idx_id_7">C</a> <a class="link" href="s01.html#idx_id_8">D</a> <a class="link" href="s01.html#idx_id_9">E</a> <a class="link" href="s01.html#idx_id_10">F</a> <a class="link" href="s01.html#idx_id_11">G</a> <a class="link" href="s01.html#idx_id_12">H</a> <a class="link" href="s01.html#idx_id_13">I</a> <a class="link" href="s01.html#idx_id_14">J</a> <a class="link" href="s01.html#idx_id_15">K</a> <a class="link" href="s01.html#idx_id_16">L</a> <a class="link" href="s01.html#idx_id_17">M</a> <a class="link" href="s01.html#idx_id_18">N</a> <a class="link" href="s01.html#idx_id_19">O</a> <a class="link" href="s01.html#idx_id_20">P</a> <a class="link" href="s01.html#idx_id_21">Q</a> <a class="link" href="s01.html#idx_id_22">R</a> <a class="link" href="s01.html#idx_id_23">S</a> <a class="link" href="s01.html#idx_id_24">T</a> <a class="link" href="s01.html#idx_id_25">U</a> <a class="link" href="s01.html#idx_id_26">V</a> <a class="link" href="s01.html#idx_id_27">W</a> <a class="link" href="s01.html#idx_id_28">X</a> <a class="link" href="s01.html#idx_id_29">Y</a> <a class="link" href="s01.html#idx_id_30">Z</a></p>
|
||||
<div class="variablelist"><dl class="variablelist">
|
||||
<dt>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="id2036846"></a>Class Index</h2></div></div></div>
|
||||
<a name="id2016561"></a>Class Index</h2></div></div></div>
|
||||
<p><a class="link" href="s02.html#idx_id_36">A</a> <a class="link" href="s02.html#idx_id_37">B</a> <a class="link" href="s02.html#idx_id_38">C</a> <a class="link" href="s02.html#idx_id_39">D</a> <a class="link" href="s02.html#idx_id_40">E</a> <a class="link" href="s02.html#idx_id_41">F</a> <a class="link" href="s02.html#idx_id_42">G</a> <a class="link" href="s02.html#idx_id_43">H</a> <a class="link" href="s02.html#idx_id_44">I</a> <a class="link" href="s02.html#idx_id_47">L</a> <a class="link" href="s02.html#idx_id_48">M</a> <a class="link" href="s02.html#idx_id_49">N</a> <a class="link" href="s02.html#idx_id_50">O</a> <a class="link" href="s02.html#idx_id_51">P</a> <a class="link" href="s02.html#idx_id_52">Q</a> <a class="link" href="s02.html#idx_id_53">R</a> <a class="link" href="s02.html#idx_id_54">S</a> <a class="link" href="s02.html#idx_id_55">T</a> <a class="link" href="s02.html#idx_id_56">U</a> <a class="link" href="s02.html#idx_id_57">V</a> <a class="link" href="s02.html#idx_id_58">W</a></p>
|
||||
<div class="variablelist"><dl class="variablelist">
|
||||
<dt>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="id2040390"></a>Typedef Index</h2></div></div></div>
|
||||
<a name="id2020528"></a>Typedef Index</h2></div></div></div>
|
||||
<p><a class="link" href="s03.html#idx_id_67">A</a> <a class="link" href="s03.html#idx_id_68">B</a> <a class="link" href="s03.html#idx_id_69">C</a> <a class="link" href="s03.html#idx_id_70">D</a> <a class="link" href="s03.html#idx_id_71">E</a> <a class="link" href="s03.html#idx_id_72">F</a> <a class="link" href="s03.html#idx_id_73">G</a> <a class="link" href="s03.html#idx_id_74">H</a> <a class="link" href="s03.html#idx_id_75">I</a> <a class="link" href="s03.html#idx_id_78">L</a> <a class="link" href="s03.html#idx_id_80">N</a> <a class="link" href="s03.html#idx_id_81">O</a> <a class="link" href="s03.html#idx_id_82">P</a> <a class="link" href="s03.html#idx_id_84">R</a> <a class="link" href="s03.html#idx_id_85">S</a> <a class="link" href="s03.html#idx_id_86">T</a> <a class="link" href="s03.html#idx_id_87">U</a> <a class="link" href="s03.html#idx_id_88">V</a> <a class="link" href="s03.html#idx_id_89">W</a></p>
|
||||
<div class="variablelist"><dl class="variablelist">
|
||||
<dt>
|
||||
|
||||
@@ -24,7 +24,7 @@
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="id2043630"></a>Macro Index</h2></div></div></div>
|
||||
<a name="id2023336"></a>Macro Index</h2></div></div></div>
|
||||
<p><a class="link" href="s04.html#idx_id_99">B</a> <a class="link" href="s04.html#idx_id_103">F</a></p>
|
||||
<div class="variablelist"><dl class="variablelist">
|
||||
<dt>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
</div>
|
||||
<div class="section">
|
||||
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
|
||||
<a name="id2047340"></a>Index</h2></div></div></div>
|
||||
<a name="id2024732"></a>Index</h2></div></div></div>
|
||||
<p><a class="link" href="s05.html#idx_id_124">1</a> <a class="link" href="s05.html#idx_id_125">2</a> <a class="link" href="s05.html#idx_id_126">4</a> <a class="link" href="s05.html#idx_id_127">5</a> <a class="link" href="s05.html#idx_id_128">7</a> <a class="link" href="s05.html#idx_id_129">A</a> <a class="link" href="s05.html#idx_id_130">B</a> <a class="link" href="s05.html#idx_id_131">C</a> <a class="link" href="s05.html#idx_id_132">D</a> <a class="link" href="s05.html#idx_id_133">E</a> <a class="link" href="s05.html#idx_id_134">F</a> <a class="link" href="s05.html#idx_id_135">G</a> <a class="link" href="s05.html#idx_id_136">H</a> <a class="link" href="s05.html#idx_id_137">I</a> <a class="link" href="s05.html#idx_id_138">J</a> <a class="link" href="s05.html#idx_id_139">K</a> <a class="link" href="s05.html#idx_id_140">L</a> <a class="link" href="s05.html#idx_id_141">M</a> <a class="link" href="s05.html#idx_id_142">N</a> <a class="link" href="s05.html#idx_id_143">O</a> <a class="link" href="s05.html#idx_id_144">P</a> <a class="link" href="s05.html#idx_id_145">Q</a> <a class="link" href="s05.html#idx_id_146">R</a> <a class="link" href="s05.html#idx_id_147">S</a> <a class="link" href="s05.html#idx_id_148">T</a> <a class="link" href="s05.html#idx_id_149">U</a> <a class="link" href="s05.html#idx_id_150">V</a> <a class="link" href="s05.html#idx_id_151">W</a> <a class="link" href="s05.html#idx_id_152">X</a> <a class="link" href="s05.html#idx_id_153">Y</a> <a class="link" href="s05.html#idx_id_154">Z</a></p>
|
||||
<div class="variablelist"><dl class="variablelist">
|
||||
<dt>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<a name="math_toolkit.conventions"></a><a class="link" href="conventions.html" title="Document Conventions">Document Conventions</a>
|
||||
</h2></div></div></div>
|
||||
<p>
|
||||
<a class="indexterm" name="id1001945"></a>
|
||||
<a class="indexterm" name="id981703"></a>
|
||||
</p>
|
||||
<p>
|
||||
This documentation aims to use of the following naming and formatting conventions.
|
||||
|
||||
@@ -53,8 +53,8 @@
|
||||
<span class="special">}}</span> <span class="comment">// namespaces</span>
|
||||
</pre>
|
||||
<p>
|
||||
The logistic distribution is a continuous probability distribution. It has
|
||||
two parameters - location and scale. The cumulative distribution function
|
||||
The logistic distribution is a continuous probability distribution. It
|
||||
has two parameters - location and scale. The cumulative distribution function
|
||||
of the logistic distribution appears in logistic regression and feedforward
|
||||
neural networks. Among other applications, United State Chess Federation
|
||||
and FIDE use it to calculate chess ratings.
|
||||
|
||||
@@ -90,7 +90,7 @@
|
||||
there for <code class="computeroutput"><span class="identifier">a</span> <span class="special"><<</span>
|
||||
<span class="number">0</span></code>. On the other hand, the simple expedient
|
||||
of breaking the integral into two domains: (a, 0) and (0, b) and integrating
|
||||
each separately using the tanh-sinh integrator, works just fine.
|
||||
each seperately using the tanh-sinh integrator, works just fine.
|
||||
</p>
|
||||
<p>
|
||||
Finally, some endpoint singularities are too strong to be handled by <code class="computeroutput"><span class="identifier">tanh_sinh</span></code> or equivalent methods, for example
|
||||
@@ -140,7 +140,7 @@
|
||||
There is an alternative, more complex method, which is applicable when we
|
||||
are dealing with expressions which can be simplified by evaluating by logs.
|
||||
Let's suppose that as in this case, all the area under the graph is infinitely
|
||||
close to zero, now imagine that we could expand that region out over a much
|
||||
close to zero, now inagine that we could expand that region out over a much
|
||||
larger range of abscissa values: that's exactly what happens if we perform
|
||||
argument substitution, replacing <code class="computeroutput"><span class="identifier">x</span></code>
|
||||
by <code class="computeroutput"><span class="identifier">exp</span><span class="special">(-</span><span class="identifier">x</span><span class="special">)</span></code> (note
|
||||
|
||||
@@ -100,10 +100,10 @@
|
||||
For example, the <code class="computeroutput"><span class="identifier">sinh_sinh</span></code>
|
||||
quadrature integrates over the entire real line, the <code class="computeroutput"><span class="identifier">tanh_sinh</span></code>
|
||||
over (-1, 1), and the <code class="computeroutput"><span class="identifier">exp_sinh</span></code>
|
||||
over (0, ∞). The latter integrators also have auxiliary ranges which are
|
||||
handled via a change of variables on the function being integrated, so that
|
||||
the <code class="computeroutput"><span class="identifier">tanh_sinh</span></code> can handle
|
||||
integration over <span class="emphasis"><em>(a, b)</em></span>, and <code class="computeroutput"><span class="identifier">exp_sinh</span></code>
|
||||
over (0, ∞). The latter integrators also have auxiliary ranges which are handled
|
||||
via a change of variables on the function being integrated, so that the
|
||||
<code class="computeroutput"><span class="identifier">tanh_sinh</span></code> can handle integration
|
||||
over <span class="emphasis"><em>(a, b)</em></span>, and <code class="computeroutput"><span class="identifier">exp_sinh</span></code>
|
||||
over /(a, ∞) and(-∞, b)/.
|
||||
</p>
|
||||
<p>
|
||||
|
||||
@@ -67,7 +67,7 @@
|
||||
argument first to <code class="computeroutput"><span class="keyword">long</span> <span class="keyword">double</span></code>,
|
||||
then to <code class="computeroutput"><span class="keyword">double</span></code>, then to <code class="computeroutput"><span class="keyword">float</span></code>; the compilation fails because the result
|
||||
is ambiguous. However the compiler error message will appear cruelly inscrutable,
|
||||
at an apparently irelevant line number and making no mention of <code class="computeroutput"><span class="identifier">float128</span></code>: the word <span class="emphasis"><em>ambiguous</em></span>
|
||||
at an apparently irrelevant line number and making no mention of <code class="computeroutput"><span class="identifier">float128</span></code>: the word <span class="emphasis"><em>ambiguous</em></span>
|
||||
is the clue to what is wrong.
|
||||
</p>
|
||||
<p>
|
||||
|
||||
@@ -32,83 +32,6 @@
|
||||
</p>
|
||||
<h6>
|
||||
<a name="math_toolkit.high_precision.use_multiprecision.h0"></a>
|
||||
<span class="phrase"><a name="math_toolkit.high_precision.use_multiprecision.using_boost_multiprecision_cpp_f"></a></span><a class="link" href="use_multiprecision.html#math_toolkit.high_precision.use_multiprecision.using_boost_multiprecision_cpp_f">Using
|
||||
Boost.Multiprecision <code class="computeroutput"><span class="identifier">cpp_float</span></code>
|
||||
types for numerical calculations with higher precision than built-in <code class="computeroutput"><span class="keyword">long</span> <span class="keyword">double</span></code>.</a>
|
||||
</h6>
|
||||
<p>
|
||||
The Boost.Multiprecision library can be used for computations requiring precision
|
||||
exceeding that of standard built-in types such as <code class="computeroutput"><span class="keyword">float</span></code>,
|
||||
<code class="computeroutput"><span class="keyword">double</span></code> and <code class="computeroutput"><span class="keyword">long</span>
|
||||
<span class="keyword">double</span></code>. For extended-precision calculations,
|
||||
Boost.Multiprecision supplies several template data types called <code class="computeroutput"><span class="identifier">cpp_bin_float_</span></code>.
|
||||
</p>
|
||||
<p>
|
||||
The number of decimal digits of precision is fixed at compile-time via template
|
||||
parameter.
|
||||
</p>
|
||||
<p>
|
||||
To use these floating-point types and <a href="https://www.boost.org/doc/libs/release/libs/math/doc/html/constants.html" target="_top">Boost.Math
|
||||
collection of high-precision constants</a>, we need some includes:
|
||||
</p>
|
||||
<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">constants</span><span class="special">/</span><span class="identifier">constants</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
||||
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">multiprecision</span><span class="special">/</span><span class="identifier">cpp_bin_float</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
|
||||
<span class="comment">// that includes some predefined typedefs that can be used thus:</span>
|
||||
<span class="comment">// using boost::multiprecision::cpp_bin_float_quad;</span>
|
||||
<span class="comment">// using boost::multiprecision::cpp_bin_float_50;</span>
|
||||
<span class="comment">// using boost::multiprecision::cpp_bin_float_100;</span>
|
||||
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">iostream</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">limits</span><span class="special">></span>
|
||||
<span class="preprocessor">#include</span> <span class="special"><</span><span class="identifier">type_traits</span><span class="special">></span>
|
||||
</pre>
|
||||
<p>
|
||||
So now we can demonstrate with some trivial calculations:
|
||||
</p>
|
||||
<p>
|
||||
Using <code class="computeroutput"><span class="keyword">typedef</span> <span class="identifier">cpp_bin_float_50</span></code>
|
||||
hides the complexity of multiprecision, allows us to define variables with
|
||||
50 decimal digit precision just like built-in <code class="computeroutput"><span class="keyword">double</span></code>.
|
||||
</p>
|
||||
<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">cpp_bin_float_50</span><span class="special">;</span>
|
||||
|
||||
<span class="identifier">cpp_bin_float_50</span> <span class="identifier">seventh</span> <span class="special">=</span> <span class="identifier">cpp_bin_float_50</span><span class="special">(</span><span class="number">1</span><span class="special">)</span> <span class="special">/</span> <span class="number">7</span><span class="special">;</span> <span class="comment">// 1 / 7</span>
|
||||
</pre>
|
||||
<p>
|
||||
By default, output would only show the standard 6 decimal digits, so set
|
||||
precision to show all 50 significant digits, including any trailing zeros.
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span><span class="special">.</span><span class="identifier">precision</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special"><</span><span class="identifier">cpp_bin_float_50</span><span class="special">>::</span><span class="identifier">digits10</span><span class="special">);</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">showpoint</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span> <span class="comment">// Append any trailing zeros.</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">seventh</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
which outputs:
|
||||
</p>
|
||||
<pre class="programlisting"><span class="number">0.14285714285714285714285714285714285714285714285714</span>
|
||||
</pre>
|
||||
<p>
|
||||
We can also use __math_constants like π, guaranteed to be initialized with
|
||||
the very last bit of precision (<a href="https://en.wikipedia.org/wiki/Unit_in_the_last_place" target="_top">Unit
|
||||
in the Last Place</a>) for the floating-point type.
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"pi = "</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">constants</span><span class="special">::</span><span class="identifier">pi</span><span class="special"><</span><span class="identifier">cpp_bin_float_50</span><span class="special">>()</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="identifier">cpp_bin_float_50</span> <span class="identifier">circumference</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">constants</span><span class="special">::</span><span class="identifier">pi</span><span class="special"><</span><span class="identifier">cpp_bin_float_50</span><span class="special">>()</span> <span class="special">*</span> <span class="number">2</span> <span class="special">*</span> <span class="identifier">seventh</span><span class="special">;</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"c = "</span> <span class="special"><<</span> <span class="identifier">circumference</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
</pre>
|
||||
<p>
|
||||
which outputs
|
||||
</p>
|
||||
<pre class="programlisting"><span class="identifier">pi</span> <span class="special">=</span> <span class="number">3.1415926535897932384626433832795028841971693993751</span>
|
||||
|
||||
<span class="identifier">c</span> <span class="special">=</span> <span class="number">0.89759790102565521098932668093700082405633411410717</span>
|
||||
</pre>
|
||||
<p>
|
||||
The full source of this example is at <a href="../../../../example/big_seventh.cpp" target="_top">big_seventh.cpp</a>
|
||||
</p>
|
||||
<h6>
|
||||
<a name="math_toolkit.high_precision.use_multiprecision.h1"></a>
|
||||
<span class="phrase"><a name="math_toolkit.high_precision.use_multiprecision.using_boost_multiprecision_to_ge"></a></span><a class="link" href="use_multiprecision.html#math_toolkit.high_precision.use_multiprecision.using_boost_multiprecision_to_ge">Using
|
||||
Boost.Multiprecision to generate a high-precision array of sine coefficents
|
||||
for use with FFT.</a>
|
||||
|
||||
@@ -28,7 +28,7 @@
|
||||
</h2></div></div></div>
|
||||
<p>
|
||||
This section contains internal utilities used by the library's implementation
|
||||
along with tools used in development and testing. These tools have limited
|
||||
along with tools used in development and testing. These tools have limitied
|
||||
documentation, but now have quite stable interfaces and may also be useful
|
||||
outside Boost.Math.
|
||||
</p>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<a name="math_toolkit.navigation"></a><a class="link" href="navigation.html" title="Navigation">Navigation</a>
|
||||
</h2></div></div></div>
|
||||
<p>
|
||||
<a class="indexterm" name="id1001836"></a>
|
||||
<a class="indexterm" name="id981565"></a>
|
||||
</p>
|
||||
<p>
|
||||
Boost.Math documentation is provided in both HTML and PDF formats.
|
||||
|
||||
@@ -91,7 +91,7 @@
|
||||
</p>
|
||||
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; ">
|
||||
<li class="listitem">
|
||||
The function is asymmetrical, which is to say, given <code class="computeroutput"><span class="identifier">u</span>
|
||||
The function is asymetrical, which is to say, given <code class="computeroutput"><span class="identifier">u</span>
|
||||
<span class="special">=</span> <span class="identifier">ulp</span><span class="special">(</span><span class="identifier">x</span><span class="special">)</span></code> if <code class="computeroutput"><span class="identifier">x</span>
|
||||
<span class="special">></span> <span class="number">0</span></code>
|
||||
then <code class="computeroutput"><span class="identifier">x</span> <span class="special">+</span>
|
||||
|
||||
@@ -39,7 +39,7 @@
|
||||
</p>
|
||||
<pre class="programlisting">4xE(sqrt(1 - 28<sup>2</sup> / x<sup>2</sup>)) - 300 = 0</pre>
|
||||
<p>
|
||||
In each case the target accuracy was set using our "recommended"
|
||||
In each case the target accuracy was set using our "recomended"
|
||||
accuracy limits (or at least limits that make a good starting point - which
|
||||
is likely to give close to full accuracy without resorting to unnecessary
|
||||
iterations).
|
||||
|
||||
@@ -33,7 +33,7 @@
|
||||
types, <code class="computeroutput"><span class="keyword">float</span></code>, <code class="computeroutput"><span class="keyword">double</span></code>, <code class="computeroutput"><span class="keyword">long</span>
|
||||
<span class="keyword">double</span></code> and a <a href="../../../../../../libs/multiprecision/doc/html/index.html" target="_top">Boost.Multiprecision</a>
|
||||
type <code class="computeroutput"><span class="identifier">cpp_bin_float_50</span></code>. In
|
||||
each case the target accuracy was set using our "recommended" accuracy
|
||||
each case the target accuracy was set using our "recomended" accuracy
|
||||
limits (or at least limits that make a good starting point - which is likely
|
||||
to give close to full accuracy without resorting to unnecessary iterations).
|
||||
</p>
|
||||
|
||||
@@ -104,10 +104,10 @@
|
||||
</pre>
|
||||
<p>
|
||||
This function generally finds the root within 8-10 iterations, so given that
|
||||
the runtime is completely dominated by the cost of calling the elliptic
|
||||
integral it would be nice to reduce that count somewhat. We'll try to do
|
||||
that by using a derivative-based method; the derivatives of this function
|
||||
are rather hard to work out by hand, but fortunately <a href="http://www.wolframalpha.com/input/?i=d%2Fda+%5b4+*+a+*+EllipticE%281+-+b%5e2%2Fa%5e2%29%5d" target="_top">Wolfram
|
||||
the runtime is completely dominated by the cost of calling the elliptic integral
|
||||
it would be nice to reduce that count somewhat. We'll try to do that by using
|
||||
a derivative-based method; the derivatives of this function are rather hard
|
||||
to work out by hand, but fortunately <a href="http://www.wolframalpha.com/input/?i=d%2Fda+%5b4+*+a+*+EllipticE%281+-+b%5e2%2Fa%5e2%29%5d" target="_top">Wolfram
|
||||
Alpha</a> can do the grunt work for us to give:
|
||||
</p>
|
||||
<pre class="programlisting">d/da L(a, b) = 4(a<sup>2</sup>E(k) - b<sup>2</sup>K(k)) / (a<sup>2</sup> - b<sup>2</sup>)</pre>
|
||||
|
||||
@@ -194,7 +194,7 @@
|
||||
<span class="identifier">r</span> <span class="special">=</span> <span class="identifier">cbrt_2deriv</span><span class="special">(</span><span class="keyword">static_cast</span><span class="special"><</span><span class="identifier">cpp_dec_float_50</span><span class="special">>(</span><span class="number">2.</span><span class="special">));</span> <span class="comment">// Passing a cpp_dec_float_50, </span>
|
||||
<span class="comment">// so will compute a cpp_dec_float_50 precision result.</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"cbrt("</span> <span class="special"><<</span> <span class="identifier">two</span> <span class="special"><<</span> <span class="string">") = "</span> <span class="special"><<</span> <span class="identifier">r</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="identifier">r</span> <span class="special">=</span> <span class="identifier">cbrt_2deriv</span><span class="special"><</span><span class="identifier">cpp_dec_float_50</span><span class="special">>(</span><span class="number">2.</span><span class="special">);</span> <span class="comment">// Explictly a cpp_dec_float_50, so will compute a cpp_dec_float_50 precision result.</span>
|
||||
<span class="identifier">r</span> <span class="special">=</span> <span class="identifier">cbrt_2deriv</span><span class="special"><</span><span class="identifier">cpp_dec_float_50</span><span class="special">>(</span><span class="number">2.</span><span class="special">);</span> <span class="comment">// Explicitly a cpp_dec_float_50, so will compute a cpp_dec_float_50 precision result.</span>
|
||||
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"cbrt("</span> <span class="special"><<</span> <span class="identifier">two</span> <span class="special"><<</span> <span class="string">") = "</span> <span class="special"><<</span> <span class="identifier">r</span> <span class="special"><<</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">endl</span><span class="special">;</span>
|
||||
<span class="comment">// cpp_dec_float_50 1.2599210498948731647672106072782283505702514647015</span>
|
||||
</pre>
|
||||
|
||||
@@ -107,9 +107,9 @@
|
||||
</p>
|
||||
<p>
|
||||
The Legendre-Stieltjes polynomials do not satisfy three-term recurrence relations
|
||||
or have a particularly simple representation. Hence the constructor call determines
|
||||
what, in fact, the polynomial is. Once the constructor comes back, the polynomial
|
||||
can be evaluated via the Legendre series.
|
||||
or have a particularly simple representation. Hence the constructor call
|
||||
determines what, in fact, the polynomial is. Once the constructor comes back,
|
||||
the polynomial can be evaluated via the Legendre series.
|
||||
</p>
|
||||
<p>
|
||||
Example usage:
|
||||
|
||||
Reference in New Issue
Block a user