2
0
mirror of https://github.com/boostorg/math.git synced 2026-01-24 18:12:09 +00:00

Merge pull request #154 from boostorg/complex_tanh_sinh

Modify tanh_sinh to work with complex integrals.
This commit is contained in:
jzmaddock
2018-10-11 19:11:43 +01:00
committed by GitHub
23 changed files with 463 additions and 44 deletions

View File

@@ -0,0 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [<!ENTITY mathml 'http://www.w3.org/1998/Math/MathML'>]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>complex_bessel_k_integral</title>
<!-- MathML created with MathCast Equation Editor version 0.92 -->
</head>
<body>
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<msub>
<mi>K</mi>
<mi>&#x3b1;</mi>
</msub>
<mfenced>
<mrow>
<mi>x</mi>
</mrow>
</mfenced>
<mo>=</mo>
<msubsup>
<mo>&#x222b;</mo>
<mrow>
<mi>o</mi>
</mrow>
<mi>&#x221e;</mi>
</msubsup>
<msup>
<mi>e</mi>
<mrow>
<mo>&#x2212;</mo>
<mi>x</mi>
<mtext>cosh</mtext>
<mfenced>
<mrow>
<mi>t</mi>
</mrow>
</mfenced>
</mrow>
</msup>
<mtext>cosh</mtext>
<mfenced>
<mrow>
<mi>&#x3b1;</mi>
<mi>t</mi>
</mrow>
</mfenced>
<mi>d</mi>
<mi>t</mi>
</mrow>
</math></body>
</html>

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 5.1 KiB

View File

@@ -0,0 +1,70 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [<!ENTITY mathml 'http://www.w3.org/1998/Math/MathML'>]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>complex_eta_integral</title>
<!-- MathML created with MathCast Equation Editor version 0.92 -->
</head>
<body>
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>&#x3b7;</mi>
<mfenced>
<mrow>
<mi>s</mi>
</mrow>
</mfenced>
<mo>=</mo>
<munderover>
<mo>&#x222b;</mo>
<mrow>
<mo>&#x2212;</mo>
<mi>&#x221e;</mi>
</mrow>
<mi>&#x221e;</mi>
</munderover>
<mfrac>
<mrow>
<mrow>
<msup>
<mfenced>
<mrow>
<mfrac>
<mn>1</mn>
<mn>2</mn>
</mfrac>
<mo>+</mo>
<mi>i</mi>
<mi>t</mi>
</mrow>
</mfenced>
<mrow>
<mo>&#x2212;</mo>
<mi>s</mi>
</mrow>
</msup>
</mrow>
</mrow>
<mrow>
<msup>
<mi>e</mi>
<mrow>
<mi>&#x3c0;</mi>
<mi>t</mi>
</mrow>
</msup>
<mo>+</mo>
<msup>
<mi>e</mi>
<mrow>
<mo>&#x2212;</mo>
<mi>&#x3c0;</mi>
<mi>t</mi>
</mrow>
</msup>
</mrow>
</mfrac>
<mi>d</mi>
<mi>t</mi>
</mrow>
</math></body>
</html>

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 6.8 KiB

View File

@@ -7,7 +7,7 @@
#
# Paths to tools come first, change these to match your system:
#
math2svg='m:\download\open\SVGMath-0.3.1\math2svg.py'
math2svg='d:\download\open\SVGMath-0.3.3\math2svg.py'
python='/cygdrive/c/Python27/python.exe'
inkscape='/cygdrive/c/Program Files/Inkscape/inkscape.exe'
# Image DPI:

View File

@@ -0,0 +1,64 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1 plus MathML 2.0//EN" "http://www.w3.org/TR/MathML2/dtd/xhtml-math11-f.dtd" [<!ENTITY mathml 'http://www.w3.org/1998/Math/MathML'>]>
<html xmlns="http://www.w3.org/1999/xhtml">
<head><title>sine_integral</title>
<!-- MathML created with MathCast Equation Editor version 0.92 -->
</head>
<body>
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block">
<mrow>
<mi>S</mi>
<mi>i</mi>
<mfenced>
<mrow>
<mi>z</mi>
</mrow>
</mfenced>
<mo>=</mo>
<mfrac>
<mi>&#x3c0;</mi>
<mn>2</mn>
</mfrac>
<mo>&#x2212;</mo>
<msubsup>
<mo>&#x222b;</mo>
<mrow>
<mn>0</mn>
</mrow>
<mrow>
<mfrac>
<mi>&#x3c0;</mi>
<mn>2</mn>
</mfrac>
</mrow>
</msubsup>
<msup>
<mi>e</mi>
<mrow>
<mo>&#x2212;</mo>
<mi>z</mi>
<mi>cos</mi>
<mfenced>
<mrow>
<mi>t</mi>
</mrow>
</mfenced>
</mrow>
</msup>
<mi>cos</mi>
<mfenced>
<mrow>
<mi>z</mi>
<mi>sin</mi>
<mfenced>
<mrow>
<mi>t</mi>
</mrow>
</mfenced>
</mrow>
</mfenced>
<mi>d</mi>
<mi>t</mi>
</mrow>
</math></body>
</html>

File diff suppressed because one or more lines are too long

After

Width:  |  Height:  |  Size: 7.0 KiB

View File

@@ -122,7 +122,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: October 07, 2018 at 08:31:28 GMT</small></p></td>
<td align="left"><p><small>Last revised: October 10, 2018 at 19:16:15 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>

View File

@@ -24,7 +24,7 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="id1781172"></a>Function Index</h2></div></div></div>
<a name="id1788544"></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_3">A</a> <a class="link" href="s01.html#idx_id_4">B</a> <a class="link" href="s01.html#idx_id_5">C</a> <a class="link" href="s01.html#idx_id_6">D</a> <a class="link" href="s01.html#idx_id_7">E</a> <a class="link" href="s01.html#idx_id_8">F</a> <a class="link" href="s01.html#idx_id_9">G</a> <a class="link" href="s01.html#idx_id_10">H</a> <a class="link" href="s01.html#idx_id_11">I</a> <a class="link" href="s01.html#idx_id_12">J</a> <a class="link" href="s01.html#idx_id_13">K</a> <a class="link" href="s01.html#idx_id_14">L</a> <a class="link" href="s01.html#idx_id_15">M</a> <a class="link" href="s01.html#idx_id_16">N</a> <a class="link" href="s01.html#idx_id_17">O</a> <a class="link" href="s01.html#idx_id_18">P</a> <a class="link" href="s01.html#idx_id_19">Q</a> <a class="link" href="s01.html#idx_id_20">R</a> <a class="link" href="s01.html#idx_id_21">S</a> <a class="link" href="s01.html#idx_id_22">T</a> <a class="link" href="s01.html#idx_id_23">U</a> <a class="link" href="s01.html#idx_id_24">V</a> <a class="link" href="s01.html#idx_id_25">W</a> <a class="link" href="s01.html#idx_id_26">X</a> <a class="link" href="s01.html#idx_id_27">Y</a> <a class="link" href="s01.html#idx_id_28">Z</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
@@ -1026,6 +1026,10 @@
</ul></div>
</li>
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">eta</span></p>
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_sinh_sinh.html" title="sinh_sinh"><span class="index-entry-level-1">sinh_sinh</span></a></p></li></ul></div>
</li>
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">evaluate_even_polynomial</span></p>
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/rational.html" title="Polynomial and Rational Function Evaluation"><span class="index-entry-level-1">Polynomial and Rational Function Evaluation</span></a></p></li></ul></div>
</li>
@@ -1508,6 +1512,7 @@
<div class="index"><ul class="index" style="list-style-type: none; ">
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/lambert_w.html" title="Lambert W function"><span class="index-entry-level-1">Lambert W function</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/oct_overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_sinh_sinh.html" title="sinh_sinh"><span class="index-entry-level-1">sinh_sinh</span></a></p></li>
</ul></div>
</li>
<li class="listitem" style="list-style-type: none">

View File

@@ -24,7 +24,7 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="id1805596"></a>Class Index</h2></div></div></div>
<a name="id1812129"></a>Class Index</h2></div></div></div>
<p><a class="link" href="s02.html#idx_id_32">A</a> <a class="link" href="s02.html#idx_id_33">B</a> <a class="link" href="s02.html#idx_id_34">C</a> <a class="link" href="s02.html#idx_id_35">D</a> <a class="link" href="s02.html#idx_id_36">E</a> <a class="link" href="s02.html#idx_id_37">F</a> <a class="link" href="s02.html#idx_id_38">G</a> <a class="link" href="s02.html#idx_id_39">H</a> <a class="link" href="s02.html#idx_id_40">I</a> <a class="link" href="s02.html#idx_id_43">L</a> <a class="link" href="s02.html#idx_id_44">M</a> <a class="link" href="s02.html#idx_id_45">N</a> <a class="link" href="s02.html#idx_id_46">O</a> <a class="link" href="s02.html#idx_id_47">P</a> <a class="link" href="s02.html#idx_id_48">Q</a> <a class="link" href="s02.html#idx_id_49">R</a> <a class="link" href="s02.html#idx_id_50">S</a> <a class="link" href="s02.html#idx_id_51">T</a> <a class="link" href="s02.html#idx_id_52">U</a> <a class="link" href="s02.html#idx_id_54">W</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>

View File

@@ -24,7 +24,7 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="id1808307"></a>Typedef Index</h2></div></div></div>
<a name="id1817610"></a>Typedef Index</h2></div></div></div>
<p><a class="link" href="s03.html#idx_id_61">A</a> <a class="link" href="s03.html#idx_id_62">B</a> <a class="link" href="s03.html#idx_id_63">C</a> <a class="link" href="s03.html#idx_id_64">D</a> <a class="link" href="s03.html#idx_id_65">E</a> <a class="link" href="s03.html#idx_id_66">F</a> <a class="link" href="s03.html#idx_id_67">G</a> <a class="link" href="s03.html#idx_id_68">H</a> <a class="link" href="s03.html#idx_id_69">I</a> <a class="link" href="s03.html#idx_id_72">L</a> <a class="link" href="s03.html#idx_id_74">N</a> <a class="link" href="s03.html#idx_id_75">O</a> <a class="link" href="s03.html#idx_id_76">P</a> <a class="link" href="s03.html#idx_id_78">R</a> <a class="link" href="s03.html#idx_id_79">S</a> <a class="link" href="s03.html#idx_id_80">T</a> <a class="link" href="s03.html#idx_id_81">U</a> <a class="link" href="s03.html#idx_id_82">V</a> <a class="link" href="s03.html#idx_id_83">W</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
@@ -386,6 +386,7 @@
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/dist_ref/dists/cauchy_dist.html" title="Cauchy-Lorentz Distribution"><span class="index-entry-level-1">Cauchy-Lorentz Distribution</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/dist_ref/dists/chi_squared_dist.html" title="Chi Squared Distribution"><span class="index-entry-level-1">Chi Squared Distribution</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/dist_ref/dists/exp_dist.html" title="Exponential Distribution"><span class="index-entry-level-1">Exponential Distribution</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_exp_sinh.html" title="exp_sinh"><span class="index-entry-level-1">exp_sinh</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/dist_ref/dists/extreme_dist.html" title="Extreme Value Distribution"><span class="index-entry-level-1">Extreme Value Distribution</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/dist_ref/dists/f_dist.html" title="F Distribution"><span class="index-entry-level-1">F Distribution</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/dist_ref/dists/gamma_dist.html" title="Gamma (and Erlang) Distribution"><span class="index-entry-level-1">Gamma (and Erlang) Distribution</span></a></p></li>
@@ -414,8 +415,10 @@
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/mem_typedef.html" title="Quaternion Member Typedefs"><span class="index-entry-level-1">Quaternion Member Typedefs</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/spec.html" title="Quaternion Specializations"><span class="index-entry-level-1">Quaternion Specializations</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/dist_ref/dists/rayleigh.html" title="Rayleigh Distribution"><span class="index-entry-level-1">Rayleigh Distribution</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_sinh_sinh.html" title="sinh_sinh"><span class="index-entry-level-1">sinh_sinh</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/dist_ref/dists/skew_normal_dist.html" title="Skew Normal Distribution"><span class="index-entry-level-1">Skew Normal Distribution</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/dist_ref/dists/students_t_dist.html" title="Students t Distribution"><span class="index-entry-level-1">Students t Distribution</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_tanh_sinh.html" title="tanh_sinh"><span class="index-entry-level-1">tanh_sinh</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/octonion.html" title="Template Class octonion"><span class="index-entry-level-1">Template Class octonion</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/quat.html" title="Template Class quaternion"><span class="index-entry-level-1">Template Class quaternion</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/special_tut/special_tut_test.html" title="Testing"><span class="index-entry-level-1">Testing</span></a></p></li>

View File

@@ -24,7 +24,7 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="id1810805"></a>Macro Index</h2></div></div></div>
<a name="id1821976"></a>Macro Index</h2></div></div></div>
<p><a class="link" href="s04.html#idx_id_91">B</a> <a class="link" href="s04.html#idx_id_95">F</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>

View File

@@ -23,7 +23,7 @@
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="id1815875"></a>Index</h2></div></div></div>
<a name="id1821169"></a>Index</h2></div></div></div>
<p><a class="link" href="s05.html#idx_id_116">1</a> <a class="link" href="s05.html#idx_id_117">2</a> <a class="link" href="s05.html#idx_id_118">4</a> <a class="link" href="s05.html#idx_id_119">A</a> <a class="link" href="s05.html#idx_id_120">B</a> <a class="link" href="s05.html#idx_id_121">C</a> <a class="link" href="s05.html#idx_id_122">D</a> <a class="link" href="s05.html#idx_id_123">E</a> <a class="link" href="s05.html#idx_id_124">F</a> <a class="link" href="s05.html#idx_id_125">G</a> <a class="link" href="s05.html#idx_id_126">H</a> <a class="link" href="s05.html#idx_id_127">I</a> <a class="link" href="s05.html#idx_id_128">J</a> <a class="link" href="s05.html#idx_id_129">K</a> <a class="link" href="s05.html#idx_id_130">L</a> <a class="link" href="s05.html#idx_id_131">M</a> <a class="link" href="s05.html#idx_id_132">N</a> <a class="link" href="s05.html#idx_id_133">O</a> <a class="link" href="s05.html#idx_id_134">P</a> <a class="link" href="s05.html#idx_id_135">Q</a> <a class="link" href="s05.html#idx_id_136">R</a> <a class="link" href="s05.html#idx_id_137">S</a> <a class="link" href="s05.html#idx_id_138">T</a> <a class="link" href="s05.html#idx_id_139">U</a> <a class="link" href="s05.html#idx_id_140">V</a> <a class="link" href="s05.html#idx_id_141">W</a> <a class="link" href="s05.html#idx_id_142">X</a> <a class="link" href="s05.html#idx_id_143">Y</a> <a class="link" href="s05.html#idx_id_144">Z</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
@@ -1944,6 +1944,8 @@
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/number_series/primes.html" title="Prime Numbers"><span class="index-entry-level-1">Prime Numbers</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/dist_ref/dists/rayleigh.html" title="Rayleigh Distribution"><span class="index-entry-level-1">Rayleigh Distribution</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/zetas/zeta.html" title="Riemann Zeta Function"><span class="index-entry-level-1">Riemann Zeta Function</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_sinh_sinh.html" title="sinh_sinh"><span class="index-entry-level-1">sinh_sinh</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_tanh_sinh.html" title="tanh_sinh"><span class="index-entry-level-1">tanh_sinh</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/special_tut/special_tut_test.html" title="Testing"><span class="index-entry-level-1">Testing</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/lanczos.html" title="The Lanczos Approximation"><span class="index-entry-level-1">The Lanczos Approximation</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/constants.html" title="The Mathematical Constants"><span class="index-entry-level-1">The Mathematical Constants</span></a></p></li>
@@ -3127,6 +3129,10 @@
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/stat_tut/weg/cs_eg/chi_sq_size.html" title="Estimating the Required Sample Sizes for a Chi-Square Test for the Standard Deviation"><span class="index-entry-level-1">variance</span></a></p></li></ul></div>
</li>
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">eta</span></p>
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_sinh_sinh.html" title="sinh_sinh"><span class="index-entry-level-1">sinh_sinh</span></a></p></li></ul></div>
</li>
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">evaluate_even_polynomial</span></p>
<div class="index"><ul class="index" style="list-style-type: none; "><li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/rational.html" title="Polynomial and Rational Function Evaluation"><span class="index-entry-level-1">Polynomial and Rational Function Evaluation</span></a></p></li></ul></div>
</li>
@@ -3356,6 +3362,7 @@
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_exp_sinh.html" title="exp_sinh"><span class="index-entry-level-1">integrate</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_exp_sinh.html" title="exp_sinh"><span class="index-entry-level-1">support</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_exp_sinh.html" title="exp_sinh"><span class="index-entry-level-1">value_type</span></a></p></li>
</ul></div>
</li>
<li class="listitem" style="list-style-type: none">
@@ -4284,6 +4291,7 @@
<div class="index"><ul class="index" style="list-style-type: none; ">
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/lambert_w.html" title="Lambert W function"><span class="index-entry-level-1">Lambert W function</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/oct_overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_sinh_sinh.html" title="sinh_sinh"><span class="index-entry-level-1">sinh_sinh</span></a></p></li>
</ul></div>
</li>
<li class="listitem" style="list-style-type: none">
@@ -6769,9 +6777,13 @@
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">sinh_sinh</span></p>
<div class="index"><ul class="index" style="list-style-type: none; ">
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_sinh_sinh.html" title="sinh_sinh"><span class="index-entry-level-1">constants</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_sinh_sinh.html" title="sinh_sinh"><span class="index-entry-level-1">eta</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_sinh_sinh.html" title="sinh_sinh"><span class="index-entry-level-1">i</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_sinh_sinh.html" title="sinh_sinh"><span class="index-entry-level-1">integrate</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><span class="bold"><strong><a class="link" href="../math_toolkit/double_exponential/de_sinh_sinh.html" title="sinh_sinh"><span class="index-entry-level-1">sinh_sinh</span></a></strong></span></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_sinh_sinh.html" title="sinh_sinh"><span class="index-entry-level-1">value_type</span></a></p></li>
</ul></div>
</li>
<li class="listitem" style="list-style-type: none">
@@ -7085,11 +7097,13 @@
<p><span class="index-entry-level-0">tanh_sinh</span></p>
<div class="index"><ul class="index" style="list-style-type: none; ">
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_tanh_sinh.html" title="tanh_sinh"><span class="index-entry-level-1">accuracy</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_tanh_sinh.html" title="tanh_sinh"><span class="index-entry-level-1">constants</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_tanh_sinh.html" title="tanh_sinh"><span class="index-entry-level-1">integrate</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_tanh_sinh.html" title="tanh_sinh"><span class="index-entry-level-1">O</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_overview.html" title="Overview"><span class="index-entry-level-1">Overview</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_tanh_sinh.html" title="tanh_sinh"><span class="index-entry-level-1">performance</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><span class="bold"><strong><a class="link" href="../math_toolkit/double_exponential/de_tanh_sinh.html" title="tanh_sinh"><span class="index-entry-level-1">tanh_sinh</span></a></strong></span></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_tanh_sinh.html" title="tanh_sinh"><span class="index-entry-level-1">value_type</span></a></p></li>
</ul></div>
</li>
<li class="listitem" style="list-style-type: none">
@@ -7645,6 +7659,7 @@
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/dist_ref/dists/cauchy_dist.html" title="Cauchy-Lorentz Distribution"><span class="index-entry-level-1">Cauchy-Lorentz Distribution</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/dist_ref/dists/chi_squared_dist.html" title="Chi Squared Distribution"><span class="index-entry-level-1">Chi Squared Distribution</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/dist_ref/dists/exp_dist.html" title="Exponential Distribution"><span class="index-entry-level-1">Exponential Distribution</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_exp_sinh.html" title="exp_sinh"><span class="index-entry-level-1">exp_sinh</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/dist_ref/dists/extreme_dist.html" title="Extreme Value Distribution"><span class="index-entry-level-1">Extreme Value Distribution</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/dist_ref/dists/f_dist.html" title="F Distribution"><span class="index-entry-level-1">F Distribution</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/dist_ref/dists/gamma_dist.html" title="Gamma (and Erlang) Distribution"><span class="index-entry-level-1">Gamma (and Erlang) Distribution</span></a></p></li>
@@ -7673,8 +7688,10 @@
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/mem_typedef.html" title="Quaternion Member Typedefs"><span class="index-entry-level-1">Quaternion Member Typedefs</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/spec.html" title="Quaternion Specializations"><span class="index-entry-level-1">Quaternion Specializations</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/dist_ref/dists/rayleigh.html" title="Rayleigh Distribution"><span class="index-entry-level-1">Rayleigh Distribution</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_sinh_sinh.html" title="sinh_sinh"><span class="index-entry-level-1">sinh_sinh</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/dist_ref/dists/skew_normal_dist.html" title="Skew Normal Distribution"><span class="index-entry-level-1">Skew Normal Distribution</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/dist_ref/dists/students_t_dist.html" title="Students t Distribution"><span class="index-entry-level-1">Students t Distribution</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/double_exponential/de_tanh_sinh.html" title="tanh_sinh"><span class="index-entry-level-1">tanh_sinh</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/octonion.html" title="Template Class octonion"><span class="index-entry-level-1">Template Class octonion</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/quat.html" title="Template Class quaternion"><span class="index-entry-level-1">Template Class quaternion</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/special_tut/special_tut_test.html" title="Testing"><span class="index-entry-level-1">Testing</span></a></p></li>

View File

@@ -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="id896776"></a>
<a class="indexterm" name="id901845"></a>
</p>
<p>
This documentation aims to use of the following naming and formatting conventions.

View File

@@ -63,6 +63,39 @@
<p>
Endpoint singularities and complex-valued integrands are supported by exp-sinh.
</p>
<p>
For example, the modified Bessel function K can be represented via:
</p>
<p>
<span class="inlinemediaobject"><img src="../../../equations/complex_bessel_k_integral.svg"></span>
</p>
<p>
Which we can code up as:
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Complex</span><span class="special">&gt;</span>
<span class="identifier">Complex</span> <span class="identifier">bessel_K</span><span class="special">(</span><span class="identifier">Complex</span> <span class="identifier">alpha</span><span class="special">,</span> <span class="identifier">Complex</span> <span class="identifier">z</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">Complex</span><span class="special">::</span><span class="identifier">value_type</span> <span class="identifier">value_type</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cosh</span><span class="special">;</span> <span class="keyword">using</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">exp</span><span class="special">;</span>
<span class="keyword">auto</span> <span class="identifier">f</span> <span class="special">=</span> <span class="special">[&amp;,</span> <span class="identifier">alpha</span><span class="special">,</span> <span class="identifier">z</span><span class="special">](</span><span class="identifier">value_type</span> <span class="identifier">t</span><span class="special">)</span>
<span class="special">{</span>
<span class="identifier">value_type</span> <span class="identifier">ct</span> <span class="special">=</span> <span class="identifier">cosh</span><span class="special">(</span><span class="identifier">t</span><span class="special">);</span>
<span class="keyword">if</span> <span class="special">(</span><span class="identifier">ct</span> <span class="special">&gt;</span> <span class="identifier">log</span><span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">numeric_limits</span><span class="special">&lt;</span><span class="identifier">value_type</span><span class="special">&gt;::</span><span class="identifier">max</span><span class="special">()))</span>
<span class="keyword">return</span> <span class="identifier">Complex</span><span class="special">(</span><span class="number">0</span><span class="special">);</span>
<span class="keyword">return</span> <span class="identifier">exp</span><span class="special">(-</span><span class="identifier">z</span> <span class="special">*</span> <span class="identifier">ct</span><span class="special">)</span> <span class="special">*</span> <span class="identifier">cosh</span><span class="special">(</span><span class="identifier">alpha</span> <span class="special">*</span> <span class="identifier">t</span><span class="special">);</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">quadrature</span><span class="special">::</span><span class="identifier">exp_sinh</span><span class="special">&lt;</span><span class="identifier">value_type</span><span class="special">&gt;</span> <span class="identifier">integrator</span><span class="special">;</span>
<span class="keyword">return</span> <span class="identifier">integrator</span><span class="special">.</span><span class="identifier">integrate</span><span class="special">(</span><span class="identifier">f</span><span class="special">);</span>
<span class="special">}</span>
</pre>
<p>
The only wrinkle in the above code is the need to check for large <code class="computeroutput"><span class="identifier">cosh</span><span class="special">(</span><span class="identifier">t</span><span class="special">)</span></code> in which case we assume that <code class="computeroutput"><span class="identifier">exp</span><span class="special">(-</span><span class="identifier">x</span>
<span class="identifier">cosh</span><span class="special">(</span><span class="identifier">t</span><span class="special">))</span></code> tends
to zero faster than <code class="computeroutput"><span class="identifier">cosh</span><span class="special">(</span><span class="identifier">alpha</span> <span class="identifier">x</span><span class="special">)</span></code> tends
to infinity and return <code class="computeroutput"><span class="number">0</span></code>. Without
that check we end up with <code class="computeroutput"><span class="number">0</span> <span class="special">*</span> <span class="identifier">Infinity</span></code>
as the result (a NaN).
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>

View File

@@ -52,8 +52,29 @@
</pre>
<p>
Note that the limits of integration are understood to be (-&#8734;, &#8734;).
Complex valued integrands are supported.
</p>
<p>
Complex valued integrands are supported as well, for example the <a href="https://en.wikipedia.org/wiki/Dirichlet_eta_function" target="_top">Dirichlet
Eta function</a> can be represented via:
</p>
<p>
<span class="inlinemediaobject"><img src="../../../equations/complex_eta_integral.svg"></span>
</p>
<p>
which we can directly code up as:
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Complex</span><span class="special">&gt;</span>
<span class="identifier">Complex</span> <span class="identifier">eta</span><span class="special">(</span><span class="identifier">Complex</span> <span class="identifier">s</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">Complex</span><span class="special">::</span><span class="identifier">value_type</span> <span class="identifier">value_type</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">pow</span><span class="special">;</span> <span class="keyword">using</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">exp</span><span class="special">;</span>
<span class="identifier">Complex</span> <span class="identifier">i</span><span class="special">(</span><span class="number">0</span><span class="special">,</span> <span class="number">1</span><span class="special">);</span>
<span class="identifier">value_type</span> <span class="identifier">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">&lt;</span><span class="identifier">value_type</span><span class="special">&gt;();</span>
<span class="keyword">auto</span> <span class="identifier">f</span> <span class="special">=</span> <span class="special">[&amp;,</span> <span class="identifier">s</span><span class="special">,</span> <span class="identifier">i</span><span class="special">](</span><span class="identifier">value_type</span> <span class="identifier">t</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="identifier">pow</span><span class="special">(</span><span class="number">0.5</span> <span class="special">+</span> <span class="identifier">i</span> <span class="special">*</span> <span class="identifier">t</span><span class="special">,</span> <span class="special">-</span><span class="identifier">s</span><span class="special">)</span> <span class="special">/</span> <span class="special">(</span><span class="identifier">exp</span><span class="special">(</span><span class="identifier">pi</span> <span class="special">*</span> <span class="identifier">t</span><span class="special">)</span> <span class="special">+</span> <span class="identifier">exp</span><span class="special">(-</span><span class="identifier">pi</span> <span class="special">*</span> <span class="identifier">t</span><span class="special">));</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">quadrature</span><span class="special">::</span><span class="identifier">sinh_sinh</span><span class="special">&lt;</span><span class="identifier">value_type</span><span class="special">&gt;</span> <span class="identifier">integrator</span><span class="special">;</span>
<span class="keyword">return</span> <span class="identifier">integrator</span><span class="special">.</span><span class="identifier">integrate</span><span class="special">(</span><span class="identifier">f</span><span class="special">);</span>
<span class="special">}</span>
</pre>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>

View File

@@ -489,6 +489,32 @@
have been provided that allow stable computation over infinite domains; these
being the exp-sinh and sinh-sinh quadrature.
</p>
<h5>
<a name="math_toolkit.double_exponential.de_tanh_sinh.h0"></a>
<span class="phrase"><a name="math_toolkit.double_exponential.de_tanh_sinh.complex_integrals"></a></span><a class="link" href="de_tanh_sinh.html#math_toolkit.double_exponential.de_tanh_sinh.complex_integrals">Complex
integrals</a>
</h5>
<p>
The tanh_sinh integrator supports integration of functions which return complex
results, for example the sine-integral <code class="computeroutput"><span class="identifier">Si</span><span class="special">(</span><span class="identifier">z</span><span class="special">)</span></code>
has the integral representation:
</p>
<p>
<span class="inlinemediaobject"><img src="../../../equations/sine_integral.svg"></span>
</p>
<p>
Which we can code up directly as:
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</span><span class="keyword">class</span> <span class="identifier">Complex</span><span class="special">&gt;</span>
<span class="identifier">Complex</span> <span class="identifier">Si</span><span class="special">(</span><span class="identifier">Complex</span> <span class="identifier">z</span><span class="special">)</span>
<span class="special">{</span>
<span class="keyword">typedef</span> <span class="keyword">typename</span> <span class="identifier">Complex</span><span class="special">::</span><span class="identifier">value_type</span> <span class="identifier">value_type</span><span class="special">;</span>
<span class="keyword">using</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">sin</span><span class="special">;</span> <span class="keyword">using</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">cos</span><span class="special">;</span> <span class="keyword">using</span> <span class="identifier">std</span><span class="special">::</span><span class="identifier">exp</span><span class="special">;</span>
<span class="keyword">auto</span> <span class="identifier">f</span> <span class="special">=</span> <span class="special">[&amp;</span><span class="identifier">z</span><span class="special">](</span><span class="identifier">value_type</span> <span class="identifier">t</span><span class="special">)</span> <span class="special">{</span> <span class="keyword">return</span> <span class="special">-</span><span class="identifier">exp</span><span class="special">(-</span><span class="identifier">z</span> <span class="special">*</span> <span class="identifier">cos</span><span class="special">(</span><span class="identifier">t</span><span class="special">))</span> <span class="special">*</span> <span class="identifier">cos</span><span class="special">(</span><span class="identifier">z</span> <span class="special">*</span> <span class="identifier">sin</span><span class="special">(</span><span class="identifier">t</span><span class="special">));</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">quadrature</span><span class="special">::</span><span class="identifier">tanh_sinh</span><span class="special">&lt;</span><span class="identifier">value_type</span><span class="special">&gt;</span> <span class="identifier">integrator</span><span class="special">;</span>
<span class="keyword">return</span> <span class="identifier">integrator</span><span class="special">.</span><span class="identifier">integrate</span><span class="special">(</span><span class="identifier">f</span><span class="special">,</span> <span class="number">0</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">half_pi</span><span class="special">&lt;</span><span class="identifier">value_type</span><span class="special">&gt;())</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">half_pi</span><span class="special">&lt;</span><span class="identifier">value_type</span><span class="special">&gt;();</span>
<span class="special">}</span>
</pre>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
<td align="left"></td>

View File

@@ -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="id896667"></a>
<a class="indexterm" name="id901719"></a>
</p>
<p>
Boost.Math documentation is provided in both HTML and PDF formats.

View File

@@ -213,6 +213,24 @@ to the square root of epsilon, and all tests were conducted in double precision:
Although the tanh-sinh quadrature can compute integral over infinite domains by variable transformations, these transformations can create a very poorly behaved integrand.
For this reason, double-exponential variable transformations have been provided that allow stable computation over infinite domains; these being the exp-sinh and sinh-sinh quadrature.
[h4 Complex integrals]
The tanh_sinh integrator supports integration of functions which return complex results, for example the sine-integral `Si(z)` has the integral representation:
[equation sine_integral]
Which we can code up directly as:
template <class Complex>
Complex Si(Complex z)
{
typedef typename Complex::value_type value_type;
using std::sin; using std::cos; using std::exp;
auto f = [&z](value_type t) { return -exp(-z * cos(t)) * cos(z * sin(t)); };
boost::math::quadrature::tanh_sinh<value_type> integrator;
return integrator.integrate(f, 0, boost::math::constants::half_pi<value_type>()) + boost::math::constants::half_pi<value_type>();
}
[endsect]
[section:de_tanh_sinh_2_arg Handling functions with large features near an endpoint with tanh-sinh quadrature]
@@ -273,7 +291,27 @@ The sinh-sinh quadrature allows computation over the entire real line, and is ca
double L1;
double Q = integrator.integrate(f, &error, &L1);
Note that the limits of integration are understood to be (-\u221E, \u221E). Complex valued integrands are supported.
Note that the limits of integration are understood to be (-\u221E, \u221E).
Complex valued integrands are supported as well, for example the [@https://en.wikipedia.org/wiki/Dirichlet_eta_function Dirichlet Eta function]
can be represented via:
[equation complex_eta_integral]
which we can directly code up as:
template <class Complex>
Complex eta(Complex s)
{
typedef typename Complex::value_type value_type;
using std::pow; using std::exp;
Complex i(0, 1);
value_type pi = boost::math::constants::pi<value_type>();
auto f = [&, s, i](value_type t) { return pow(0.5 + i * t, -s) / (exp(pi * t) + exp(-pi * t)); };
boost::math::quadrature::sinh_sinh<value_type> integrator;
return integrator.integrate(f);
}
[endsect]
@@ -313,6 +351,32 @@ The native integration range of this integrator is (0, [infin]), but we also sup
Endpoint singularities and complex-valued integrands are supported by exp-sinh.
For example, the modified Bessel function K can be represented via:
[equation complex_bessel_k_integral]
Which we can code up as:
template <class Complex>
Complex bessel_K(Complex alpha, Complex z)
{
typedef typename Complex::value_type value_type;
using std::cosh; using std::exp;
auto f = [&, alpha, z](value_type t)
{
value_type ct = cosh(t);
if (ct > log(std::numeric_limits<value_type>::max()))
return Complex(0);
return exp(-z * ct) * cosh(alpha * t);
};
boost::math::quadrature::exp_sinh<value_type> integrator;
return integrator.integrate(f);
}
The only wrinkle in the above code is the need to check for large `cosh(t)` in which case we assume that
`exp(-x cosh(t))` tends to zero faster than `cosh(alpha x)` tends to infinity and return `0`. Without that
check we end up with `0 * Infinity` as the result (a NaN).
[endsect]
[section:de_tol Setting the Termination Condition for Integration]

View File

@@ -45,7 +45,7 @@ public:
}
template<class F>
Real integrate(const F f, Real* error, Real* L1, const char* function, Real left_min_complement, Real right_min_complement, Real tolerance, std::size_t* levels) const;
decltype(std::declval<F>()(std::declval<Real>(), std::declval<Real>())) integrate(const F f, Real* error, Real* L1, const char* function, Real left_min_complement, Real right_min_complement, Real tolerance, std::size_t* levels) const;
private:
const std::vector<Real>& get_abscissa_row(std::size_t n)const
@@ -181,7 +181,7 @@ private:
template<class Real, class Policy>
template<class F>
Real tanh_sinh_detail<Real, Policy>::integrate(const F f, Real* error, Real* L1, const char* function, Real left_min_complement, Real right_min_complement, Real tolerance, std::size_t* levels) const
decltype(std::declval<F>()(std::declval<Real>(), std::declval<Real>())) tanh_sinh_detail<Real, Policy>::integrate(const F f, Real* error, Real* L1, const char* function, Real left_min_complement, Real right_min_complement, Real tolerance, std::size_t* levels) const
{
using std::abs;
using std::fabs;
@@ -224,10 +224,12 @@ Real tanh_sinh_detail<Real, Policy>::integrate(const F f, Real* error, Real* L1,
//
BOOST_ASSERT(m_abscissas[0][max_left_position] < 0);
BOOST_ASSERT(m_abscissas[0][max_right_position] < 0);
//
// The type of the result:
typedef decltype(std::declval<F>()(std::declval<Real>(), std::declval<Real>())) result_type;
Real h = m_t_max / m_inital_row_length;
Real I0 = half_pi<Real>()*f(0, 1);
result_type I0 = half_pi<Real>()*f(0, 1);
Real L1_I0 = abs(I0);
for(size_t i = 1; i < m_abscissas[0].size(); ++i)
{
@@ -243,7 +245,7 @@ Real tanh_sinh_detail<Real, Policy>::integrate(const F f, Real* error, Real* L1,
}
else
xc = x - 1;
Real yp, ym;
result_type yp, ym;
yp = i <= max_right_position ? f(x, -xc) : 0;
ym = i <= max_left_position ? f(-x, xc) : 0;
I0 += (yp + ym)*w;
@@ -257,7 +259,7 @@ Real tanh_sinh_detail<Real, Policy>::integrate(const F f, Real* error, Real* L1,
// L1_I0 and L1_I1 are the absolute integral values.
//
size_t k = 1;
Real I1 = I0;
result_type I1 = I0;
Real L1_I1 = L1_I0;
Real err = 0;
//
@@ -274,7 +276,7 @@ Real tanh_sinh_detail<Real, Policy>::integrate(const F f, Real* error, Real* L1,
I1 = half<Real>()*I0;
L1_I1 = half<Real>()*L1_I0;
h *= half<Real>();
Real sum = 0;
result_type sum = 0;
Real absum = 0;
auto const& abscissa_row = this->get_abscissa_row(k);
auto const& weight_row = this->get_weight_row(k);
@@ -327,9 +329,9 @@ Real tanh_sinh_detail<Real, Policy>::integrate(const F f, Real* error, Real* L1,
xc = x - 1;
}
Real yp = j > max_right_index ? 0 : f(x, -xc);
Real ym = j > max_left_index ? 0 : f(-x, xc);
Real term = (yp + ym)*w;
result_type yp = j > max_right_index ? 0 : f(x, -xc);
result_type ym = j > max_left_index ? 0 : f(-x, xc);
result_type term = (yp + ym)*w;
sum += term;
// A question arises as to how accurately we actually need to estimate the L1 integral.
@@ -372,7 +374,7 @@ Real tanh_sinh_detail<Real, Policy>::integrate(const F f, Real* error, Real* L1,
// parameters. We could keep hunting until we find something, but that would handicap
// integrals which really are zero.... so a compromise then!
//
if (err <= tolerance*L1_I1)
if (err <= abs(tolerance*L1_I1))
{
break;
}

View File

@@ -44,14 +44,14 @@ public:
: m_imp(std::make_shared<detail::tanh_sinh_detail<Real, Policy>>(max_refinements, min_complement)) {}
template<class F>
auto integrate(const F f, Real a, Real b, Real tolerance = tools::root_epsilon<Real>(), Real* error = nullptr, Real* L1 = nullptr, std::size_t* levels = nullptr) ->decltype(Real(std::declval<F>()(std::declval<Real>()))) const;
auto integrate(const F f, Real a, Real b, Real tolerance = tools::root_epsilon<Real>(), Real* error = nullptr, Real* L1 = nullptr, std::size_t* levels = nullptr) ->decltype(std::declval<F>()(std::declval<Real>())) const;
template<class F>
auto integrate(const F f, Real a, Real b, Real tolerance = tools::root_epsilon<Real>(), Real* error = nullptr, Real* L1 = nullptr, std::size_t* levels = nullptr) ->decltype(Real(std::declval<F>()(std::declval<Real>(), std::declval<Real>()))) const;
auto integrate(const F f, Real a, Real b, Real tolerance = tools::root_epsilon<Real>(), Real* error = nullptr, Real* L1 = nullptr, std::size_t* levels = nullptr) ->decltype(std::declval<F>()(std::declval<Real>(), std::declval<Real>())) const;
template<class F>
auto integrate(const F f, Real tolerance = tools::root_epsilon<Real>(), Real* error = nullptr, Real* L1 = nullptr, std::size_t* levels = nullptr) ->decltype(Real(std::declval<F>()(std::declval<Real>()))) const;
auto integrate(const F f, Real tolerance = tools::root_epsilon<Real>(), Real* error = nullptr, Real* L1 = nullptr, std::size_t* levels = nullptr) ->decltype(std::declval<F>()(std::declval<Real>())) const;
template<class F>
auto integrate(const F f, Real tolerance = tools::root_epsilon<Real>(), Real* error = nullptr, Real* L1 = nullptr, std::size_t* levels = nullptr) ->decltype(Real(std::declval<F>()(std::declval<Real>(), std::declval<Real>()))) const;
auto integrate(const F f, Real tolerance = tools::root_epsilon<Real>(), Real* error = nullptr, Real* L1 = nullptr, std::size_t* levels = nullptr) ->decltype(std::declval<F>()(std::declval<Real>(), std::declval<Real>())) const;
private:
std::shared_ptr<detail::tanh_sinh_detail<Real, Policy>> m_imp;
@@ -59,7 +59,7 @@ private:
template<class Real, class Policy>
template<class F>
auto tanh_sinh<Real, Policy>::integrate(const F f, Real a, Real b, Real tolerance, Real* error, Real* L1, std::size_t* levels) ->decltype(Real(std::declval<F>()(std::declval<Real>()))) const
auto tanh_sinh<Real, Policy>::integrate(const F f, Real a, Real b, Real tolerance, Real* error, Real* L1, std::size_t* levels) ->decltype(std::declval<F>()(std::declval<Real>())) const
{
BOOST_MATH_STD_USING
using boost::math::constants::half;
@@ -67,13 +67,15 @@ auto tanh_sinh<Real, Policy>::integrate(const F f, Real a, Real b, Real toleranc
static const char* function = "tanh_sinh<%1%>::integrate";
typedef decltype(std::declval<F>()(std::declval<Real>())) result_type;
if (!(boost::math::isnan)(a) && !(boost::math::isnan)(b))
{
// Infinite limits:
if ((a <= -tools::max_value<Real>()) && (b >= tools::max_value<Real>()))
{
auto u = [&](const Real& t, const Real& tc)->Real
auto u = [&](const Real& t, const Real& tc)->result_type
{
Real t_sq = t*t;
Real inv;
@@ -92,7 +94,7 @@ auto tanh_sinh<Real, Policy>::integrate(const F f, Real a, Real b, Real toleranc
// Right limit is infinite:
if ((boost::math::isfinite)(a) && (b >= tools::max_value<Real>()))
{
auto u = [&](const Real& t, const Real& tc)->Real
auto u = [&](const Real& t, const Real& tc)->result_type
{
Real z, arg;
if (t > -0.5f)
@@ -106,7 +108,7 @@ auto tanh_sinh<Real, Policy>::integrate(const F f, Real a, Real b, Real toleranc
return f(arg)*z*z;
};
Real left_limit = sqrt(tools::min_value<Real>()) * 4;
Real Q = 2 * m_imp->integrate(u, error, L1, function, left_limit, tools::min_value<Real>(), tolerance, levels);
result_type Q = Real(2) * m_imp->integrate(u, error, L1, function, left_limit, tools::min_value<Real>(), tolerance, levels);
if (L1)
{
*L1 *= 2;
@@ -117,7 +119,7 @@ auto tanh_sinh<Real, Policy>::integrate(const F f, Real a, Real b, Real toleranc
if ((boost::math::isfinite)(b) && (a <= -tools::max_value<Real>()))
{
auto v = [&](const Real& t, const Real& tc)->Real
auto v = [&](const Real& t, const Real& tc)->result_type
{
Real z;
if (t > -0.5)
@@ -133,7 +135,7 @@ auto tanh_sinh<Real, Policy>::integrate(const F f, Real a, Real b, Real toleranc
};
Real left_limit = sqrt(tools::min_value<Real>()) * 4;
Real Q = 2 * m_imp->integrate(v, error, L1, function, left_limit, tools::min_value<Real>(), tolerance, levels);
result_type Q = Real(2) * m_imp->integrate(v, error, L1, function, left_limit, tools::min_value<Real>(), tolerance, levels);
if (L1)
{
*L1 *= 2;
@@ -169,7 +171,7 @@ auto tanh_sinh<Real, Policy>::integrate(const F f, Real a, Real b, Real toleranc
//
BOOST_ASSERT((left_min_complement * diff + a) > a);
BOOST_ASSERT((b - right_min_complement * diff) < b);
auto u = [&](Real z, Real zc)->Real
auto u = [&](Real z, Real zc)->result_type
{
Real position;
if (z < -0.5)
@@ -190,7 +192,7 @@ auto tanh_sinh<Real, Policy>::integrate(const F f, Real a, Real b, Real toleranc
BOOST_ASSERT(position != b);
return f(position);
};
Real Q = diff*m_imp->integrate(u, error, L1, function, left_min_complement, right_min_complement, tolerance, levels);
result_type Q = diff*m_imp->integrate(u, error, L1, function, left_min_complement, right_min_complement, tolerance, levels);
if (L1)
{
@@ -204,7 +206,7 @@ auto tanh_sinh<Real, Policy>::integrate(const F f, Real a, Real b, Real toleranc
template<class Real, class Policy>
template<class F>
auto tanh_sinh<Real, Policy>::integrate(const F f, Real a, Real b, Real tolerance, Real* error, Real* L1, std::size_t* levels) ->decltype(Real(std::declval<F>()(std::declval<Real>(), std::declval<Real>()))) const
auto tanh_sinh<Real, Policy>::integrate(const F f, Real a, Real b, Real tolerance, Real* error, Real* L1, std::size_t* levels) ->decltype(std::declval<F>()(std::declval<Real>(), std::declval<Real>())) const
{
BOOST_MATH_STD_USING
using boost::math::constants::half;
@@ -241,7 +243,7 @@ auto tanh_sinh<Real, Policy>::integrate(const F f, Real a, Real b, Real toleranc
template<class Real, class Policy>
template<class F>
auto tanh_sinh<Real, Policy>::integrate(const F f, Real tolerance, Real* error, Real* L1, std::size_t* levels) ->decltype(Real(std::declval<F>()(std::declval<Real>()))) const
auto tanh_sinh<Real, Policy>::integrate(const F f, Real tolerance, Real* error, Real* L1, std::size_t* levels) ->decltype(std::declval<F>()(std::declval<Real>())) const
{
using boost::math::quadrature::detail::tanh_sinh_detail;
static const char* function = "tanh_sinh<%1%>::integrate";
@@ -251,7 +253,7 @@ auto tanh_sinh<Real, Policy>::integrate(const F f, Real tolerance, Real* error,
template<class Real, class Policy>
template<class F>
auto tanh_sinh<Real, Policy>::integrate(const F f, Real tolerance, Real* error, Real* L1, std::size_t* levels) ->decltype(Real(std::declval<F>()(std::declval<Real>(), std::declval<Real>()))) const
auto tanh_sinh<Real, Policy>::integrate(const F f, Real tolerance, Real* error, Real* L1, std::size_t* levels) ->decltype(std::declval<F>()(std::declval<Real>(), std::declval<Real>())) const
{
using boost::math::quadrature::detail::tanh_sinh_detail;
static const char* function = "tanh_sinh<%1%>::integrate";

View File

@@ -1057,6 +1057,10 @@ test-suite misc :
: : : release <toolset>msvc:<cxxflags>/bigobj <define>TEST8 [ check-target-builds ../config//has_float128 "GCC libquadmath and __float128 support" : <linkflags>-lquadmath ]
[ requires cxx11_auto_declarations cxx11_lambdas cxx11_smart_ptr cxx11_unified_initialization_syntax sfinae_expr ] :
tanh_sinh_quadrature_test_8 ]
[ run tanh_sinh_quadrature_test.cpp ../../test/build//boost_unit_test_framework
: : : release <toolset>msvc:<cxxflags>/bigobj <define>TEST9
[ requires cxx11_auto_declarations cxx11_lambdas cxx11_smart_ptr cxx11_unified_initialization_syntax sfinae_expr ] :
tanh_sinh_quadrature_test_9 ]
[ run sinh_sinh_quadrature_test.cpp ../../test/build//boost_unit_test_framework
: : : release [ check-target-builds ../config//has_float128 "GCC libquadmath and __float128 support" : <linkflags>-lquadmath ] [ requires cxx11_auto_declarations cxx11_lambdas cxx11_smart_ptr cxx11_unified_initialization_syntax ] ]

View File

@@ -33,7 +33,7 @@
#endif
#if !defined(TEST1) && !defined(TEST2) && !defined(TEST3) && !defined(TEST4) && !defined(TEST5) && !defined(TEST6) && !defined(TEST7) && !defined(TEST8)\
&& !defined(TEST1A) && !defined(TEST2A) && !defined(TEST3A) && !defined(TEST6A)
&& !defined(TEST1A) && !defined(TEST2A) && !defined(TEST3A) && !defined(TEST6A) && !defined(TEST9)
# define TEST1
# define TEST2
# define TEST3
@@ -46,6 +46,7 @@
# define TEST2A
# define TEST3A
# define TEST6A
# define TEST9
#endif
using std::expm1;
@@ -563,7 +564,7 @@ void test_crc()
// We also use a 2 argument functor so that 1-x is evaluated accurately:
if (std::numeric_limits<Real>::max_exponent > std::numeric_limits<double>::max_exponent)
{
for (Real p = -0.99; p < 1; p += 0.1) {
for (Real p = Real (-0.99); p < 1; p += Real(0.1)) {
auto f = [&](Real x, Real cx)->Real
{
//return pow(x, p) / pow(1 - x, p);
@@ -579,7 +580,7 @@ void test_crc()
// domain (0, INF). Internally we need to expand out the terms and evaluate using logs to avoid spurous overflow,
// this gives us
// for p > 0:
for (Real p = 0.99; p > 0; p -= 0.1) {
for (Real p = Real(0.99); p > 0; p -= Real(0.1)) {
auto f = [&](Real x)->Real
{
return exp(-x * (1 - p) + p * log(-boost::math::expm1(-x)));
@@ -589,7 +590,7 @@ void test_crc()
BOOST_CHECK_CLOSE_FRACTION(Q, Q_expected, 10 * tol);
}
// and for p < 1:
for (Real p = -0.99; p < 0; p += 0.1) {
for (Real p = Real (-0.99); p < 0; p += Real(0.1)) {
auto f = [&](Real x)->Real
{
return exp(-p * log(-boost::math::expm1(-x)) - (1 + p) * x);
@@ -616,7 +617,7 @@ void test_crc()
//
Real limit = std::numeric_limits<Real>::max_exponent > std::numeric_limits<double>::max_exponent
? .95f : .85f;
for (Real h = 0.01; h < limit; h += 0.1) {
for (Real h = Real(0.01); h < limit; h += Real(0.1)) {
auto f = [&](Real x, Real xc)->Real { return xc > 0 ? pow(1/tan(xc), h) : pow(tan(x), h); };
Q = integrator.integrate(f, (Real) 0, half_pi<Real>(), get_convergence_tolerance<Real>(), &error, &L1);
Q_expected = half_pi<Real>()/cos(h*half_pi<Real>());
@@ -706,7 +707,7 @@ void test_sf()
Real x = 2, y = 3, z = 0.5, p = 0.25;
// Elliptic integral RC:
Real Q = integrator.integrate([&](const Real& t) { return 1 / (sqrt(t + x) * (t + y)); }, 0, std::numeric_limits<Real>::has_infinity ? std::numeric_limits<Real>::infinity() : boost::math::tools::max_value<Real>()) / 2;
Real Q = integrator.integrate([&](const Real& t)->Real { return 1 / (sqrt(t + x) * (t + y)); }, 0, std::numeric_limits<Real>::has_infinity ? std::numeric_limits<Real>::infinity() : boost::math::tools::max_value<Real>()) / 2;
BOOST_CHECK_CLOSE_FRACTION(Q, boost::math::ellint_rc(x, y), tol);
// Elliptic Integral RJ:
BOOST_CHECK_CLOSE_FRACTION(Real((Real(3) / 2) * integrator.integrate([&](Real t)->Real { return 1 / (sqrt((t + x) * (t + y) * (t + z)) * (t + p)); }, 0, std::numeric_limits<Real>::has_infinity ? std::numeric_limits<Real>::infinity() : boost::math::tools::max_value<Real>())), boost::math::ellint_rj(x, y, z, p), tol);
@@ -719,7 +720,7 @@ void test_sf()
// tgamma expressed as an integral:
BOOST_CHECK_CLOSE_FRACTION(integrator.integrate([&](Real t)->Real { using std::pow; using std::exp; return t > 10000 ? Real(0) : Real(pow(t, z - 1) * exp(-t)); }, 0, std::numeric_limits<Real>::has_infinity ? std::numeric_limits<Real>::infinity() : boost::math::tools::max_value<Real>()),
boost::math::tgamma(z), tol);
BOOST_CHECK_CLOSE_FRACTION(integrator.integrate([](const Real& t) { using std::exp; return exp(-t*t); }, std::numeric_limits<Real>::has_infinity ? -std::numeric_limits<Real>::infinity() : -boost::math::tools::max_value<Real>(), std::numeric_limits<Real>::has_infinity ? std::numeric_limits<Real>::infinity() : boost::math::tools::max_value<Real>()),
BOOST_CHECK_CLOSE_FRACTION(integrator.integrate([](const Real& t)->Real { using std::exp; return exp(-t*t); }, std::numeric_limits<Real>::has_infinity ? -std::numeric_limits<Real>::infinity() : -boost::math::tools::max_value<Real>(), std::numeric_limits<Real>::has_infinity ? std::numeric_limits<Real>::infinity() : boost::math::tools::max_value<Real>()),
boost::math::constants::root_pi<Real>(), tol);
}
@@ -788,6 +789,50 @@ void test_2_arg()
BOOST_CHECK_CLOSE_FRACTION(L1, -Q_expected, tol);
}
template <class Complex>
void test_complex()
{
typedef typename Complex::value_type value_type;
//
// Integral version of the confluent hypergeometric function:
// https://dlmf.nist.gov/13.4#E1
//
value_type tol = 10 * boost::math::tools::epsilon<value_type>();
Complex a(2, 3), b(3, 4), z(0.5, -2);
auto f = [&](value_type t)
{
return exp(z * t) * pow(t, a - value_type(1)) * pow(value_type(1) - t, b - a - value_type(1));
};
auto integrator = get_integrator<value_type>();
auto Q = integrator.integrate(f, value_type(0), value_type(1), get_convergence_tolerance<value_type>());
//
// Expected result computed from http://www.wolframalpha.com/input/?i=1F1%5B(2%2B3i),+(3%2B4i);+(0.5-2i)%5D+*+gamma(2%2B3i)+*+gamma(1%2Bi)+%2F+gamma(3%2B4i)
//
Complex expected(boost::lexical_cast<value_type>("-0.2911081612888249710582867318081776512805281815037891183828405999609246645054069649838607112484426042883371996"),
boost::lexical_cast<value_type>("0.4507983563969959578849120188097153649211346293694903758252662015991543519595834937475296809912196906074655385"));
value_type error = abs(expected - Q);
BOOST_CHECK_LE(error, tol);
//
// Sin Integral https://dlmf.nist.gov/6.2#E9
//
auto f2 = [z](value_type t)
{
return -exp(-z * cos(t)) * cos(z * sin(t));
};
Q = integrator.integrate(f2, value_type(0), boost::math::constants::half_pi<value_type>(), get_convergence_tolerance<value_type>());
expected = Complex(boost::lexical_cast<value_type>("0.8893822921008980697856313681734926564752476188106405688951257340480164694708337246829840859633322683740376134733"),
-boost::lexical_cast<value_type>("2.381380802906111364088958767973164614925936185337231718483495612539455538280372745733208000514737758457795502168"));
expected -= boost::math::constants::half_pi<value_type>();
error = abs(expected - Q);
BOOST_CHECK_LE(error, tol);
}
BOOST_AUTO_TEST_CASE(tanh_sinh_quadrature_test)
{
@@ -927,6 +972,12 @@ BOOST_AUTO_TEST_CASE(tanh_sinh_quadrature_test)
test_2_arg<boost::multiprecision::float128>();
#endif
#ifdef TEST9
test_complex<std::complex<double> >();
test_complex<std::complex<float> >();
#endif
#endif
}