|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r83512 - in trunk: boost/math/distributions boost/math/tools libs/math/doc/sf_and_dist libs/math/doc/sf_and_dist/html libs/math/doc/sf_and_dist/html/index libs/math/doc/sf_and_dist/html/math_toolkit/backgrounders libs/math/doc/sf_and_dist/html/math_toolkit/main_overview libs/math/doc/sf_and_dist/html/math_toolkit/special/bessel libs/math/doc/sf_and_dist/html/math_toolkit/status libs/math/doc/sf_and_dist/html/math_toolkit/using_udt/high_precision libs/math/test
From: john_at_[hidden]
Date: 2013-03-21 09:01:53
Author: johnmaddock
Date: 2013-03-21 09:01:50 EDT (Thu, 21 Mar 2013)
New Revision: 83512
URL: http://svn.boost.org/trac/boost/changeset/83512
Log:
Fix edge case in Halley iteration where the derivative is flatlining.
Fix edge cases in poisson distribution quantile.
Fixes #8314.
Fixes #8308.
Update and regenerate docs.
Text files modified:
trunk/boost/math/distributions/poisson.hpp | 39 +-
trunk/boost/math/tools/roots.hpp | 12
trunk/libs/math/doc/sf_and_dist/html/index.html | 2
trunk/libs/math/doc/sf_and_dist/html/index/s13.html | 6
trunk/libs/math/doc/sf_and_dist/html/index/s14.html | 4
trunk/libs/math/doc/sf_and_dist/html/index/s15.html | 4
trunk/libs/math/doc/sf_and_dist/html/index/s16.html | 4
trunk/libs/math/doc/sf_and_dist/html/index/s17.html | 10
trunk/libs/math/doc/sf_and_dist/html/math_toolkit/backgrounders/refs.html | 14
trunk/libs/math/doc/sf_and_dist/html/math_toolkit/main_overview/conventions.html | 2
trunk/libs/math/doc/sf_and_dist/html/math_toolkit/main_overview/history1.html | 9
trunk/libs/math/doc/sf_and_dist/html/math_toolkit/main_overview/navigation.html | 2
trunk/libs/math/doc/sf_and_dist/html/math_toolkit/special/bessel/bessel0.html | 667 +++++++++++++++++++++++++++++----------
trunk/libs/math/doc/sf_and_dist/html/math_toolkit/status/history1.html | 9
trunk/libs/math/doc/sf_and_dist/html/math_toolkit/status/issues.html | 31 +
trunk/libs/math/doc/sf_and_dist/html/math_toolkit/using_udt/high_precision/using_test.html | 6
trunk/libs/math/doc/sf_and_dist/roadmap.qbk | 4
trunk/libs/math/test/test_poisson.cpp | 20 +
18 files changed, 622 insertions(+), 223 deletions(-)
Modified: trunk/boost/math/distributions/poisson.hpp
==============================================================================
--- trunk/boost/math/distributions/poisson.hpp (original)
+++ trunk/boost/math/distributions/poisson.hpp 2013-03-21 09:01:50 EDT (Thu, 21 Mar 2013)
@@ -443,9 +443,10 @@
inline RealType quantile(const poisson_distribution<RealType, Policy>& dist, const RealType& p)
{ // Quantile (or Percent Point) Poisson function.
// Return the number of expected events k for a given probability p.
+ static const char* function = "boost::math::quantile(const poisson_distribution<%1%>&, %1%)";
RealType result = 0; // of Argument checks:
if(false == poisson_detail::check_prob(
- "boost::math::quantile(const poisson_distribution<%1%>&, %1%)",
+ function,
p,
&result, Policy()))
{
@@ -455,23 +456,21 @@
if (dist.mean() == 0)
{ // if mean = 0 then p = 0, so k can be anything?
if (false == poisson_detail::check_mean_NZ(
- "boost::math::quantile(const poisson_distribution<%1%>&, %1%)",
+ function,
dist.mean(),
&result, Policy()))
{
return result;
}
}
- /*
- BOOST_MATH_STD_USING // ADL of std functions.
- // if(p == 0) NOT necessarily zero!
- // Not necessarily any special value of k because is unlimited.
- if (p <= exp(-dist.mean()))
- { // if p <= cdf for 0 events (== pdf for 0 events), then quantile must be zero.
- return 0;
+ if(p == 0)
+ {
+ return 0; // Exact result regardless of discrete-quantile Policy
+ }
+ if(p == 1)
+ {
+ return policies::raise_overflow_error<RealType>(function, 0, Policy());
}
- return gamma_q_inva(dist.mean(), p, Policy()) - 1;
- */
typedef typename Policy::discrete_quantile_type discrete_type;
boost::uintmax_t max_iter = policies::get_max_root_iterations<Policy>();
RealType guess, factor = 8;
@@ -512,11 +511,12 @@
// complement of the probability q.
//
// Error checks:
+ static const char* function = "boost::math::quantile(complement(const poisson_distribution<%1%>&, %1%))";
RealType q = c.param;
const poisson_distribution<RealType, Policy>& dist = c.dist;
RealType result = 0; // of argument checks.
if(false == poisson_detail::check_prob(
- "boost::math::quantile(const poisson_distribution<%1%>&, %1%)",
+ function,
q,
&result, Policy()))
{
@@ -526,20 +526,21 @@
if (dist.mean() == 0)
{ // if mean = 0 then p = 0, so k can be anything?
if (false == poisson_detail::check_mean_NZ(
- "boost::math::quantile(const poisson_distribution<%1%>&, %1%)",
+ function,
dist.mean(),
&result, Policy()))
{
return result;
}
}
- /*
- if (-q <= boost::math::expm1(-dist.mean()))
- { // if q <= cdf(complement for 0 events, then quantile must be zero.
- return 0;
+ if(q == 0)
+ {
+ return policies::raise_overflow_error<RealType>(function, 0, Policy());
+ }
+ if(q == 1)
+ {
+ return 0; // Exact result regardless of discrete-quantile Policy
}
- return gamma_p_inva(dist.mean(), q, Policy()) -1;
- */
typedef typename Policy::discrete_quantile_type discrete_type;
boost::uintmax_t max_iter = policies::get_max_root_iterations<Policy>();
RealType guess, factor = 8;
Modified: trunk/boost/math/tools/roots.hpp
==============================================================================
--- trunk/boost/math/tools/roots.hpp (original)
+++ trunk/boost/math/tools/roots.hpp 2013-03-21 09:01:50 EDT (Thu, 21 Mar 2013)
@@ -329,8 +329,18 @@
delta = denom / num;
if(delta * f1 / f0 < 0)
{
- // probably cancellation error, try a Newton step instead:
+ // Oh dear, we have a problem as Newton and Halley steps
+ // disagree about which way we should move. Probably
+ // there is cancelation error in the calculation of the
+ // Halley step, or else the derivatives are so small
+ // that their values are basically trash. We will move
+ // in the direction indicated by a Newton step, but
+ // by no more than twice the current guess value, otherwise
+ // we can jump way out of bounds if we're not careful.
+ // See https://svn.boost.org/trac/boost/ticket/8314.
delta = f0 / f1;
+ if(fabs(delta) > 2 * fabs(guess))
+ delta = (delta < 0 ? -1 : 1) * 2 * fabs(guess);
}
}
else
Modified: trunk/libs/math/doc/sf_and_dist/html/index.html
==============================================================================
--- trunk/libs/math/doc/sf_and_dist/html/index.html (original)
+++ trunk/libs/math/doc/sf_and_dist/html/index.html 2013-03-21 09:01:50 EDT (Thu, 21 Mar 2013)
@@ -599,7 +599,7 @@
</p>
</div>
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
-<td align="left"><p><small>Last revised: March 07, 2013 at 09:36:37 GMT</small></p></td>
+<td align="left"><p><small>Last revised: March 21, 2013 at 12:24:21 GMT</small></p></td>
<td align="right"><div class="copyright-footer"></div></td>
</tr></table>
<hr>
Modified: trunk/libs/math/doc/sf_and_dist/html/index/s13.html
==============================================================================
--- trunk/libs/math/doc/sf_and_dist/html/index/s13.html (original)
+++ trunk/libs/math/doc/sf_and_dist/html/index/s13.html 2013-03-21 09:01:50 EDT (Thu, 21 Mar 2013)
@@ -22,9 +22,9 @@
<div class="spirit-nav">
<a accesskey="p" href="../math_toolkit/status/credits.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="s14.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
-<div class="section id1346486">
+<div class="section id863386">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id1346486"></a>Function Index</h2></div></div></div>
+<a name="id863386"></a>Function Index</h2></div></div></div>
<p><a class="link" href="s13.html#idx_id_0">A</a> <a class="link" href="s13.html#idx_id_1">B</a> <a class="link" href="s13.html#idx_id_2">C</a> <a class="link" href="s13.html#idx_id_3">D</a> <a class="link" href="s13.html#idx_id_4">E</a> <a class="link" href="s13.html#idx_id_5">F</a> <a class="link" href="s13.html#idx_id_6">G</a> <a class="link" href="s13.html#idx_id_7">H</a> <a class="link" href="s13.html#idx_id_8">I</a> <a class="link" href="s13.html#idx_id_9">J</a> <a class="link" href="s13.html#idx_id_10">K</a> <a class="link" href="s13.html#idx_id_11">L</a> <a class="link" href="s13.html#idx_id_12">M</a> <a class="link" href="s13.html#idx_id_13">N</a> <a class="link" href="s13.html#idx_id_14">O</a> <a class="link" href="s13.html#idx_id_15">P</a> <a class="link" href="s13.html#idx_id_16">Q</a> <a class="link" href="s13.html#idx_id_17">R</a> <a class="link" href="s13.html#idx_id_18">S</a> <a class="link" href="s13.html#idx_id_19">T</a> <a class="link" href="s13.html#idx_id_20">U</a> <a class="link" href=
"s13.html#idx_id_21">V</a> <a class="link" href="s13.html#idx_id_22">W</a> <a class="link" href="s13.html#idx_id_23">Z</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
@@ -440,6 +440,7 @@
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/special/bessel/bessel.html" title="Bessel Functions of the First and Second Kinds"><span class="index-entry-level-1">Bessel Functions of the First and Second Kinds</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/main_overview/tr1.html" title="C99 and C++ TR1 C-style Functions"><span class="index-entry-level-1">C99 and C++ TR1 C-style Functions</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/extern_c/tr1.html" title="C99 and TR1 C Functions Overview"><span class="index-entry-level-1">C99 and TR1 C Functions Overview</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/status/issues.html" title="Known Issues, and TODO List"><span class="index-entry-level-1">Known Issues, and TODO List</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/extern_c/tr1_ref.html" title="TR1 C Functions Quick Reference"><span class="index-entry-level-1">TR1 C Functions Quick Reference</span></a></p></li>
</ul></div>
</li>
@@ -494,6 +495,7 @@
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/special/bessel/bessel.html" title="Bessel Functions of the First and Second Kinds"><span class="index-entry-level-1">Bessel Functions of the First and Second Kinds</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/main_overview/tr1.html" title="C99 and C++ TR1 C-style Functions"><span class="index-entry-level-1">C99 and C++ TR1 C-style Functions</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/extern_c/tr1.html" title="C99 and TR1 C Functions Overview"><span class="index-entry-level-1">C99 and TR1 C Functions Overview</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/status/issues.html" title="Known Issues, and TODO List"><span class="index-entry-level-1">Known Issues, and TODO List</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/extern_c/tr1_ref.html" title="TR1 C Functions Quick Reference"><span class="index-entry-level-1">TR1 C Functions Quick Reference</span></a></p></li>
</ul></div>
</li>
Modified: trunk/libs/math/doc/sf_and_dist/html/index/s14.html
==============================================================================
--- trunk/libs/math/doc/sf_and_dist/html/index/s14.html (original)
+++ trunk/libs/math/doc/sf_and_dist/html/index/s14.html 2013-03-21 09:01:50 EDT (Thu, 21 Mar 2013)
@@ -22,9 +22,9 @@
<div class="spirit-nav">
<a accesskey="p" href="s13.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="s15.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
-<div class="section id1363831">
+<div class="section id1364536">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id1363831"></a>Class Index</h2></div></div></div>
+<a name="id1364536"></a>Class Index</h2></div></div></div>
<p><a class="link" href="s14.html#idx_id_25">B</a> <a class="link" href="s14.html#idx_id_26">C</a> <a class="link" href="s14.html#idx_id_27">D</a> <a class="link" href="s14.html#idx_id_28">E</a> <a class="link" href="s14.html#idx_id_29">F</a> <a class="link" href="s14.html#idx_id_30">G</a> <a class="link" href="s14.html#idx_id_31">H</a> <a class="link" href="s14.html#idx_id_32">I</a> <a class="link" href="s14.html#idx_id_35">L</a> <a class="link" href="s14.html#idx_id_36">M</a> <a class="link" href="s14.html#idx_id_37">N</a> <a class="link" href="s14.html#idx_id_39">P</a> <a class="link" href="s14.html#idx_id_41">R</a> <a class="link" href="s14.html#idx_id_42">S</a> <a class="link" href="s14.html#idx_id_43">T</a> <a class="link" href="s14.html#idx_id_44">U</a> <a class="link" href="s14.html#idx_id_46">W</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
Modified: trunk/libs/math/doc/sf_and_dist/html/index/s15.html
==============================================================================
--- trunk/libs/math/doc/sf_and_dist/html/index/s15.html (original)
+++ trunk/libs/math/doc/sf_and_dist/html/index/s15.html 2013-03-21 09:01:50 EDT (Thu, 21 Mar 2013)
@@ -22,9 +22,9 @@
<div class="spirit-nav">
<a accesskey="p" href="s14.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="s16.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
-<div class="section id1364772">
+<div class="section id1368890">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id1364772"></a>Typedef Index</h2></div></div></div>
+<a name="id1368890"></a>Typedef Index</h2></div></div></div>
<p><a class="link" href="s15.html#idx_id_48">A</a> <a class="link" href="s15.html#idx_id_49">B</a> <a class="link" href="s15.html#idx_id_50">C</a> <a class="link" href="s15.html#idx_id_51">D</a> <a class="link" href="s15.html#idx_id_52">E</a> <a class="link" href="s15.html#idx_id_53">F</a> <a class="link" href="s15.html#idx_id_54">G</a> <a class="link" href="s15.html#idx_id_55">H</a> <a class="link" href="s15.html#idx_id_56">I</a> <a class="link" href="s15.html#idx_id_59">L</a> <a class="link" href="s15.html#idx_id_61">N</a> <a class="link" href="s15.html#idx_id_62">O</a> <a class="link" href="s15.html#idx_id_63">P</a> <a class="link" href="s15.html#idx_id_65">R</a> <a class="link" href="s15.html#idx_id_66">S</a> <a class="link" href="s15.html#idx_id_67">T</a> <a class="link" href="s15.html#idx_id_68">U</a> <a class="link" href="s15.html#idx_id_69">V</a> <a class="link" href="s15.html#idx_id_70">W</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
Modified: trunk/libs/math/doc/sf_and_dist/html/index/s16.html
==============================================================================
--- trunk/libs/math/doc/sf_and_dist/html/index/s16.html (original)
+++ trunk/libs/math/doc/sf_and_dist/html/index/s16.html 2013-03-21 09:01:50 EDT (Thu, 21 Mar 2013)
@@ -22,9 +22,9 @@
<div class="spirit-nav">
<a accesskey="p" href="s15.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a><a accesskey="n" href="s17.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
-<div class="section id1367681">
+<div class="section id1370708">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id1367681"></a>Macro Index</h2></div></div></div>
+<a name="id1370708"></a>Macro Index</h2></div></div></div>
<p><a class="link" href="s16.html#idx_id_73">B</a> <a class="link" href="s16.html#idx_id_77">F</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
Modified: trunk/libs/math/doc/sf_and_dist/html/index/s17.html
==============================================================================
--- trunk/libs/math/doc/sf_and_dist/html/index/s17.html (original)
+++ trunk/libs/math/doc/sf_and_dist/html/index/s17.html 2013-03-21 09:01:50 EDT (Thu, 21 Mar 2013)
@@ -21,9 +21,9 @@
<div class="spirit-nav">
<a accesskey="p" href="s16.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../index.html"><img src="../../../../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../../../../doc/src/images/home.png" alt="Home"></a>
</div>
-<div class="section id855986">
+<div class="section id1371934">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
-<a name="id855986"></a>Index</h2></div></div></div>
+<a name="id1371934"></a>Index</h2></div></div></div>
<p><a class="link" href="s17.html#idx_id_96">A</a> <a class="link" href="s17.html#idx_id_97">B</a> <a class="link" href="s17.html#idx_id_98">C</a> <a class="link" href="s17.html#idx_id_99">D</a> <a class="link" href="s17.html#idx_id_100">E</a> <a class="link" href="s17.html#idx_id_101">F</a> <a class="link" href="s17.html#idx_id_102">G</a> <a class="link" href="s17.html#idx_id_103">H</a> <a class="link" href="s17.html#idx_id_104">I</a> <a class="link" href="s17.html#idx_id_105">J</a> <a class="link" href="s17.html#idx_id_106">K</a> <a class="link" href="s17.html#idx_id_107">L</a> <a class="link" href="s17.html#idx_id_108">M</a> <a class="link" href="s17.html#idx_id_109">N</a> <a class="link" href="s17.html#idx_id_110">O</a> <a class="link" href="s17.html#idx_id_111">P</a> <a class="link" href="s17.html#idx_id_112">Q</a> <a class="link" href="s17.html#idx_id_113">R</a> <a class="link" href="s17.html#idx_id_114">S</a> <a class="link" href="s17.html#idx_id_115">T</a> <a class="link" href="s17.html#idx_id_116">
U</a> <a class="link" href="s17.html#idx_id_117">V</a> <a class="link" href="s17.html#idx_id_118">W</a> <a class="link" href="s17.html#idx_id_119">Z</a></p>
<div class="variablelist"><dl class="variablelist">
<dt>
@@ -1416,6 +1416,7 @@
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/special/bessel/bessel.html" title="Bessel Functions of the First and Second Kinds"><span class="index-entry-level-1">Bessel Functions of the First and Second Kinds</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/main_overview/tr1.html" title="C99 and C++ TR1 C-style Functions"><span class="index-entry-level-1">C99 and C++ TR1 C-style Functions</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/extern_c/tr1.html" title="C99 and TR1 C Functions Overview"><span class="index-entry-level-1">C99 and TR1 C Functions Overview</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/status/issues.html" title="Known Issues, and TODO List"><span class="index-entry-level-1">Known Issues, and TODO List</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/extern_c/tr1_ref.html" title="TR1 C Functions Quick Reference"><span class="index-entry-level-1">TR1 C Functions Quick Reference</span></a></p></li>
</ul></div>
</li>
@@ -1470,6 +1471,7 @@
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/special/bessel/bessel.html" title="Bessel Functions of the First and Second Kinds"><span class="index-entry-level-1">Bessel Functions of the First and Second Kinds</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/main_overview/tr1.html" title="C99 and C++ TR1 C-style Functions"><span class="index-entry-level-1">C99 and C++ TR1 C-style Functions</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/extern_c/tr1.html" title="C99 and TR1 C Functions Overview"><span class="index-entry-level-1">C99 and TR1 C Functions Overview</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/status/issues.html" title="Known Issues, and TODO List"><span class="index-entry-level-1">Known Issues, and TODO List</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/extern_c/tr1_ref.html" title="TR1 C Functions Quick Reference"><span class="index-entry-level-1">TR1 C Functions Quick Reference</span></a></p></li>
</ul></div>
</li>
@@ -2026,6 +2028,7 @@
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/special/factorials/sf_factorial.html" title="Factorial"><span class="index-entry-level-1">Factorial</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/constants/FAQ.html" title="FAQs"><span class="index-entry-level-1">FAQs</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/dist/stat_tut/weg/find_eg/find_scale_eg.html" title="Find Scale (Standard Deviation) Example"><span class="index-entry-level-1">Find Scale (Standard Deviation) Example</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/special/bessel/bessel0.html" title="Finding Zeros of Bessel Functions of the First and Second Kinds"><span class="index-entry-level-1">Finding Zeros of Bessel Functions of the First and Second Kinds</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/dist/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>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/dist/stat_tut/weg/geometric_eg.html" title="Geometric Distribution Examples"><span class="index-entry-level-1">Geometric Distribution Examples</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/main_overview/history1.html" title="History and What's New"><span class="index-entry-level-1">History and What's New</span></a></p></li>
@@ -2154,6 +2157,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/special/bessel/bessel0.html" title="Finding Zeros of Bessel Functions of the First and Second Kinds"><span class="index-entry-level-1">cyl_bessel_j_zero</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/special/bessel/bessel0.html" title="Finding Zeros of Bessel Functions of the First and Second Kinds"><span class="index-entry-level-1">cyl_neumann_zero</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/special/bessel/bessel0.html" title="Finding Zeros of Bessel Functions of the First and Second Kinds"><span class="index-entry-level-1">expression</span></a></p></li>
</ul></div>
</li>
<li class="listitem" style="list-style-type: none">
@@ -2997,6 +3001,8 @@
<li class="listitem" style="list-style-type: none">
<p><span class="index-entry-level-0">Known Issues, and TODO List</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/status/issues.html" title="Known Issues, and TODO List"><span class="index-entry-level-1">cyl_bessel_j</span></a></p></li>
+<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/status/issues.html" title="Known Issues, and TODO List"><span class="index-entry-level-1">cyl_neumann</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/status/issues.html" title="Known Issues, and TODO List"><span class="index-entry-level-1">Lanczos approximation</span></a></p></li>
<li class="listitem" style="list-style-type: none"><p><a class="link" href="../math_toolkit/status/issues.html" title="Known Issues, and TODO List"><span class="index-entry-level-1">T</span></a></p></li>
</ul></div>
Modified: trunk/libs/math/doc/sf_and_dist/html/math_toolkit/backgrounders/refs.html
==============================================================================
--- trunk/libs/math/doc/sf_and_dist/html/math_toolkit/backgrounders/refs.html (original)
+++ trunk/libs/math/doc/sf_and_dist/html/math_toolkit/backgrounders/refs.html 2013-03-21 09:01:50 EDT (Thu, 21 Mar 2013)
@@ -47,14 +47,12 @@
D.C.
</p>
<p>
- NIST Handbook of Mathematical Functions
- </p>
-<p>
- Edited by: Frank W. J. Olver, University of Maryland and National Institute
- of Standards and Technology, Maryland, Daniel W. Lozier, National Institute
- of Standards and Technology, Maryland, Ronald F. Boisvert, National Institute
- of Standards and Technology, Maryland, Charles W. Clark, National Institute
- of Standards and Technology, Maryland and University of Maryland.
+ NIST Handbook of Mathematical Functions Edited by: Frank W. J. Olver, University
+ of Maryland and National Institute of Standards and Technology, Maryland,
+ Daniel W. Lozier, National Institute of Standards and Technology, Maryland,
+ Ronald F. Boisvert, National Institute of Standards and Technology, Maryland,
+ Charles W. Clark, National Institute of Standards and Technology, Maryland
+ and University of Maryland.
</p>
<p>
ISBN: 978-0521140638 (paperback), 9780521192255 (hardback), July 2010, Cambridge
Modified: trunk/libs/math/doc/sf_and_dist/html/math_toolkit/main_overview/conventions.html
==============================================================================
--- trunk/libs/math/doc/sf_and_dist/html/math_toolkit/main_overview/conventions.html (original)
+++ trunk/libs/math/doc/sf_and_dist/html/math_toolkit/main_overview/conventions.html 2013-03-21 09:01:50 EDT (Thu, 21 Mar 2013)
@@ -27,7 +27,7 @@
<a name="math_toolkit.main_overview.conventions"></a><a class="link" href="conventions.html" title="Document Conventions">Document Conventions</a>
</h3></div></div></div>
<p>
- <a class="indexterm" name="id848638"></a>
+ <a class="indexterm" name="id855190"></a>
</p>
<p>
This documentation aims to use of the following naming and formatting conventions.
Modified: trunk/libs/math/doc/sf_and_dist/html/math_toolkit/main_overview/history1.html
==============================================================================
--- trunk/libs/math/doc/sf_and_dist/html/math_toolkit/main_overview/history1.html (original)
+++ trunk/libs/math/doc/sf_and_dist/html/math_toolkit/main_overview/history1.html 2013-03-21 09:01:50 EDT (Thu, 21 Mar 2013)
@@ -73,6 +73,15 @@
<li class="listitem">
Added minimal __float128 support.
</li>
+<li class="listitem">
+ Fixed bug in edge-cases of poisson quantile #8308.
+ </li>
+<li class="listitem">
+ Adjusted heuristics used in Halley iteration to cope with inverting the
+ incomplete beta in tricky regions where the derivative is flatlining.
+ Example is computing the quantile of the Fisher F distribution for probabilities
+ smaller than machine epsilon. See ticket #8314.
+ </li>
</ul></div>
<h5>
<a name="math_toolkit.main_overview.history1.h1"></a>
Modified: trunk/libs/math/doc/sf_and_dist/html/math_toolkit/main_overview/navigation.html
==============================================================================
--- trunk/libs/math/doc/sf_and_dist/html/math_toolkit/main_overview/navigation.html (original)
+++ trunk/libs/math/doc/sf_and_dist/html/math_toolkit/main_overview/navigation.html 2013-03-21 09:01:50 EDT (Thu, 21 Mar 2013)
@@ -27,7 +27,7 @@
<a name="math_toolkit.main_overview.navigation"></a><a class="link" href="navigation.html" title="Navigation">Navigation</a>
</h3></div></div></div>
<p>
- <a class="indexterm" name="id848509"></a>
+ <a class="indexterm" name="id855061"></a>
</p>
<p>
Boost.Math documentation is provided in both HTML and PDF formats.
Modified: trunk/libs/math/doc/sf_and_dist/html/math_toolkit/special/bessel/bessel0.html
==============================================================================
--- trunk/libs/math/doc/sf_and_dist/html/math_toolkit/special/bessel/bessel0.html (original)
+++ trunk/libs/math/doc/sf_and_dist/html/math_toolkit/special/bessel/bessel0.html 2013-03-21 09:01:50 EDT (Thu, 21 Mar 2013)
@@ -43,75 +43,127 @@
The signature of the single value functions are:
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
-<span class="identifier">T</span> <span class="identifier">cyl_bessel_j_zero</span><span class="special">(</span><span class="identifier">T</span> <span class="identifier">v</span><span class="special">,</span> <span class="comment">// Floating-point value for Jv.</span>
- <span class="keyword">int</span> <span class="identifier">m</span><span class="special">);</span> <span class="comment">// 1-based index of zero.</span>
+<span class="identifier">T</span> <span class="identifier">cyl_bessel_j_zero</span><span class="special">(</span>
+ <span class="identifier">T</span> <span class="identifier">v</span><span class="special">,</span> <span class="comment">// Floating-point value for Jv.</span>
+ <span class="keyword">int</span> <span class="identifier">m</span><span class="special">);</span> <span class="comment">// 1-based index of zero.</span>
+
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
-<span class="identifier">T</span> <span class="identifier">cyl_neumann_zero</span><span class="special">(</span><span class="identifier">T</span> <span class="identifier">v</span><span class="special">,</span> <span class="comment">// Floating-point value for Jv.</span>
- <span class="keyword">int</span> <span class="identifier">m</span><span class="special">);</span> <span class="comment">// 1-based index of zero.</span>
+<span class="identifier">T</span> <span class="identifier">cyl_neumann_zero</span><span class="special">(</span>
+ <span class="identifier">T</span> <span class="identifier">v</span><span class="special">,</span> <span class="comment">// Floating-point value for Jv.</span>
+ <span class="keyword">int</span> <span class="identifier">m</span><span class="special">);</span> <span class="comment">// 1-based index of zero.</span>
</pre>
<p>
and for multiple zeros:
</p>
<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">OutputIterator</span><span class="special">></span>
-<span class="identifier">OutputIterator</span> <span class="identifier">cyl_bessel_j_zero</span><span class="special">(</span><span class="identifier">T</span> <span class="identifier">v</span><span class="special">,</span> <span class="comment">// Floating-point value for Jv.</span>
- <span class="keyword">int</span> <span class="identifier">start_index</span><span class="special">,</span> <span class="comment">// 1-based index of zero.</span>
- <span class="keyword">unsigned</span> <span class="identifier">number_of_zeros</span><span class="special">,</span>
- <span class="identifier">OutputIterator</span> <span class="identifier">out_it</span><span class="special">);</span> <span class="comment">//</span>
+<span class="identifier">OutputIterator</span> <span class="identifier">cyl_bessel_j_zero</span><span class="special">(</span>
+ <span class="identifier">T</span> <span class="identifier">v</span><span class="special">,</span> <span class="comment">// Floating-point value for Jv.</span>
+ <span class="keyword">int</span> <span class="identifier">start_index</span><span class="special">,</span> <span class="comment">// 1-based index of first zero.</span>
+ <span class="keyword">unsigned</span> <span class="identifier">number_of_zeros</span><span class="special">,</span> <span class="comment">// How many zeros to generate.</span>
+ <span class="identifier">OutputIterator</span> <span class="identifier">out_it</span><span class="special">);</span> <span class="comment">// Destination for zeros.</span>
+
<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">OutputIterator</span><span class="special">></span>
-<span class="identifier">OutputIterator</span> <span class="identifier">cyl_neumann_zero</span><span class="special">(</span><span class="identifier">T</span> <span class="identifier">v</span><span class="special">,</span> <span class="comment">// Floating-point value for Jv.</span>
- <span class="keyword">int</span> <span class="identifier">start_index</span><span class="special">,</span> <span class="comment">// 1-based index of zero.</span>
- <span class="keyword">unsigned</span> <span class="identifier">number_of_zeros</span><span class="special">,</span>
- <span class="identifier">OutputIterator</span> <span class="identifier">out_it</span><span class="special">);</span> <span class="comment">//</span>
+<span class="identifier">OutputIterator</span> <span class="identifier">cyl_neumann_zero</span><span class="special">(</span>
+ <span class="identifier">T</span> <span class="identifier">v</span><span class="special">,</span> <span class="comment">// Floating-point value for Jv.</span>
+ <span class="keyword">int</span> <span class="identifier">start_index</span><span class="special">,</span> <span class="comment">// 1-based index of zero.</span>
+ <span class="keyword">unsigned</span> <span class="identifier">number_of_zeros</span><span class="special">,</span> <span class="comment">// How many zeros to generate</span>
+ <span class="identifier">OutputIterator</span> <span class="identifier">out_it</span><span class="special">);</span> <span class="comment">// Destination for zeros.</span>
</pre>
<p>
- There are also versions which allows control of the <a class="link" href="../../policy.html" title="Policies">Policies</a>
+ There are also versions which allow control of the <a class="link" href="../../policy.html" title="Policies">Policies</a>
for error handling and precision.
</p>
-<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
-<span class="identifier">T</span> <span class="identifier">cyl_bessel_j_zero</span><span class="special">(</span><span class="identifier">T</span> <span class="identifier">v</span><span class="special">,</span> <span class="comment">// Floating-point value for Jv.</span>
- <span class="keyword">int</span> <span class="identifier">m</span><span class="special">,</span> <span class="comment">// 1-based start index.</span>
- <span class="keyword">const</span> <span class="identifier">Policy</span><span class="special">&</span> <span class="identifier">pol</span><span class="special">);</span> <span class="comment">// Policy</span>
-<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
-<span class="identifier">T</span> <span class="identifier">cyl_neumann_zero</span><span class="special">(</span><span class="identifier">T</span> <span class="identifier">v</span><span class="special">,</span> <span class="comment">// Floating-point value for Jv.</span>
- <span class="keyword">int</span> <span class="identifier">m</span><span class="special">,</span> <span class="comment">// 1-based start index.</span>
- <span class="keyword">const</span> <span class="identifier">Policy</span><span class="special">&</span> <span class="identifier">pol</span><span class="special">);</span> <span class="comment">// Policy</span>
-
-<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">OutputIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Policy</span><span class="special">></span>
-<span class="identifier">OutputIterator</span> <span class="identifier">cyl_bessel_j_zero</span><span class="special">(</span><span class="identifier">T</span> <span class="identifier">v</span><span class="special">,</span> <span class="comment">// Floating-point value for Jv.</span>
- <span class="keyword">int</span> <span class="identifier">start_index</span><span class="special">,</span> <span class="comment">// 1-based start index.</span>
- <span class="keyword">unsigned</span> <span class="identifier">number_of_zeros</span><span class="special">,</span>
- <span class="identifier">OutputIterator</span> <span class="identifier">out_it</span><span class="special">,</span>
- <span class="keyword">const</span> <span class="identifier">Policy</span><span class="special">&</span> <span class="identifier">pol</span><span class="special">);</span>
-<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">OutputIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Policy</span><span class="special">></span>
-<span class="identifier">OutputIterator</span> <span class="identifier">cyl_neumann_zero</span><span class="special">(</span><span class="identifier">T</span> <span class="identifier">v</span><span class="special">,</span> <span class="comment">// Floating-point value for Jv.</span>
- <span class="keyword">int</span> <span class="identifier">start_index</span><span class="special">,</span> <span class="comment">// 1-based start index.</span>
- <span class="keyword">unsigned</span> <span class="identifier">number_of_zeros</span><span class="special">,</span>
- <span class="identifier">OutputIterator</span> <span class="identifier">out_it</span><span class="special">,</span>
- <span class="keyword">const</span> <span class="identifier">Policy</span><span class="special">&</span> <span class="identifier">pol</span><span class="special">);</span>
+<pre class="programlisting"> <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
+ <span class="identifier">T</span> <span class="identifier">cyl_bessel_j_zero</span><span class="special">(</span>
+ <span class="identifier">T</span> <span class="identifier">v</span><span class="special">,</span> <span class="comment">// Floating-point value for Jv.</span>
+ <span class="keyword">int</span> <span class="identifier">m</span><span class="special">,</span> <span class="comment">// 1-based index of zero.</span>
+ <span class="keyword">const</span> <span class="identifier">Policy</span><span class="special">&);</span> <span class="comment">// Policy to use.</span>
+
+ <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
+ <span class="identifier">T</span> <span class="identifier">cyl_neumann_zero</span><span class="special">(</span>
+ <span class="identifier">T</span> <span class="identifier">v</span><span class="special">,</span> <span class="comment">// Floating-point value for Jv.</span>
+ <span class="keyword">int</span> <span class="identifier">m</span><span class="special">,</span> <span class="comment">// 1-based index of zero.</span>
+ <span class="keyword">const</span> <span class="identifier">Policy</span><span class="special">&);</span> <span class="comment">// Policy to use.</span>
+
+
+<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">OutputIterator</span><span class="special">></span>
+<span class="identifier">OutputIterator</span> <span class="identifier">cyl_bessel_j_zero</span><span class="special">(</span>
+ <span class="identifier">T</span> <span class="identifier">v</span><span class="special">,</span> <span class="comment">// Floating-point value for Jv.</span>
+ <span class="keyword">int</span> <span class="identifier">start_index</span><span class="special">,</span> <span class="comment">// 1-based index of first zero.</span>
+ <span class="keyword">unsigned</span> <span class="identifier">number_of_zeros</span><span class="special">,</span> <span class="comment">// How many zeros to generate.</span>
+ <span class="identifier">OutputIterator</span> <span class="identifier">out_it</span><span class="special">,</span> <span class="comment">// Destination for zeros.</span>
+ <span class="keyword">const</span> <span class="identifier">Policy</span><span class="special">&</span> <span class="identifier">pol</span><span class="special">);</span> <span class="comment">// Policy to use.</span>
+
+<span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">OutputIterator</span><span class="special">></span>
+<span class="identifier">OutputIterator</span> <span class="identifier">cyl_neumann_zero</span><span class="special">(</span>
+ <span class="identifier">T</span> <span class="identifier">v</span><span class="special">,</span> <span class="comment">// Floating-point value for Jv.</span>
+ <span class="keyword">int</span> <span class="identifier">start_index</span><span class="special">,</span> <span class="comment">// 1-based index of zero.</span>
+ <span class="keyword">unsigned</span> <span class="identifier">number_of_zeros</span><span class="special">,</span> <span class="comment">// How many zeros to generate.</span>
+ <span class="identifier">OutputIterator</span> <span class="identifier">out_it</span><span class="special">,</span> <span class="comment">// Destination for zeros.</span>
+ <span class="keyword">const</span> <span class="identifier">Policy</span><span class="special">&</span> <span class="identifier">pol</span><span class="special">);</span> <span class="comment">// Policy to use.</span>
</pre>
<h5>
<a name="math_toolkit.special.bessel.bessel.h6"></a>
<span class="phrase"><a name="math_toolkit.special.bessel.bessel.description0"></a></span><a class="link" href="bessel0.html#math_toolkit.special.bessel.bessel.description0">Description</a>
</h5>
<p>
- The zeros or roots (values of x where the function crosses the y = 0 axis)
- of the Bessel and Neumann functions are computed by two functions, <code class="computeroutput"><span class="identifier">cyl_bessel_j_zero</span></code> and <code class="computeroutput"><span class="identifier">cyl_neumann_zero</span></code>.
+ Every real order ν cylindrical Bessel and Neumann functions have an infinite
+ number of zeros on the positive real axis. The real zeros on the positive
+ real axis can be found by solving for the roots of
+ </p>
+<p>
+   <span class="emphasis"><em>J<sub>ν</sub>(j<sub>ν, m</sub>) = 0</em></span>
+ </p>
+<p>
+   <span class="emphasis"><em>Y<sub>ν</sub>(y<sub>ν, m</sub>) = 0</em></span>
+ </p>
+<p>
+ Here, <span class="emphasis"><em>j<sub>ν, m</sub></em></span> represents the <span class="emphasis"><em>m<sup>th</sup></em></span>
+ root of the cylindrical Bessel function of order <span class="emphasis"><em>ν</em></span>,
+ and <span class="emphasis"><em>y<sub>ν, m</sub></em></span> represents the <span class="emphasis"><em>m<sup>th</sup></em></span> root
+ of the cylindrical Neumann function of order <span class="emphasis"><em>ν</em></span>.
</p>
<p>
- In each case the index of the zero returned is 1-based, which is to say:
+ The zeros or roots (values of <code class="computeroutput"><span class="identifier">x</span></code>
+ where the function crosses the horizontal <code class="computeroutput"><span class="identifier">y</span>
+ <span class="special">=</span> <span class="number">0</span></code>
+ axis) of the Bessel and Neumann functions are computed by two functions,
+ <code class="computeroutput"><span class="identifier">cyl_bessel_j_zero</span></code> and
+ <code class="computeroutput"><span class="identifier">cyl_neumann_zero</span></code>.
+ </p>
+<p>
+ In each case the index or rank of the zero returned is 1-based, which is
+ to say:
</p>
<pre class="programlisting"><span class="identifier">cyl_bessel_j_zero</span><span class="special">(</span><span class="identifier">v</span><span class="special">,</span> <span class="number">1</span><span class="special">);</span>
</pre>
<p>
- returns the first zero of Bessel J, and
+ returns the first zero of Bessel J.
+ </p>
+<p>
+ Passing an <code class="computeroutput"><span class="identifier">start_index</span> <span class="special"><=</span> <span class="number">0</span></code> results
+ in a <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">domain_error</span></code> being raised.
+ </p>
+<p>
+ For certain parameters, however, the zero'th root is defined and it has
+ a value of zero. For example, the zero'th root of <code class="computeroutput"><span class="identifier">J</span><span class="special">[</span><span class="identifier">sub</span> <span class="identifier">v</span><span class="special">](</span><span class="identifier">x</span><span class="special">)</span></code> is defined and it has a value of zero
+ for all values of <code class="computeroutput"><span class="identifier">v</span> <span class="special">></span>
+ <span class="number">0</span></code> and for negative integer values
+ of <code class="computeroutput"><span class="identifier">v</span> <span class="special">=</span>
+ <span class="special">-</span><span class="identifier">n</span></code>.
+ Similar cases are described in the implementation details below.
</p>
-<pre class="programlisting"><span class="identifier">cyl_bessel_j_zero</span><span class="special">(</span><span class="identifier">v</span><span class="special">,</span> <span class="number">0</span><span class="special">);</span>
-</pre>
<p>
- results in a <a class="link" href="../../main_overview/error_handling.html#domain_error">domain_error</a> being raised.
+ The order <code class="computeroutput"><span class="identifier">v</span></code> of <code class="computeroutput"><span class="identifier">J</span></code> can be positive, negative and zero
+ for the <code class="computeroutput"><span class="identifier">cyl_bessel_j</span></code> and
+ <code class="computeroutput"><span class="identifier">cyl_neumann</span></code> functions,
+ but not infinite nor NaN.
</p>
<p>
- <span class="inlinemediaobject"><img src="../../../../graphs/bessel_zeros.png" align="middle"></span>
+ <span class="inlinemediaobject"><img src="../../../../graphs/bessel_j_zeros.png" align="middle"></span>
+ </p>
+<p>
+ <span class="inlinemediaobject"><img src="../../../../graphs/neumann_y_zeros.png" align="middle"></span>
</p>
<h5>
<a name="math_toolkit.special.bessel.bessel.h7"></a>
@@ -119,10 +171,10 @@
of finding Bessel and Neumann zeros</a>
</h5>
<p>
- This example demonstrates calculating zeros of the Bessel, Neumann and
- Airy functions. It also shows how Boost.Math and Boost.Multiprecision can
- be combined to provide a many decimal digit precision. For 50 decimal digit
- precision we need to include
+ This example demonstrates calculating zeros of the Bessel and Neumann functions.
+ It also shows how Boost.Math and Boost.Multiprecision can be combined to
+ provide a many decimal digit precision. For 50 decimal digit precision
+ we need to include
</p>
<p>
</p>
@@ -167,40 +219,8 @@
<p>
This example shows obtaining both a single zero of the Bessel function,
and then placing multiple zeros into a container like <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span></code>
- by providing an iterator. The signature of the single value function is:
- </p>
-<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">></span>
-<span class="keyword">inline</span> <span class="keyword">typename</span> <span class="identifier">detail</span><span class="special">::</span><span class="identifier">bessel_traits</span><span class="special"><</span><span class="identifier">T</span><span class="special">,</span> <span class="identifier">T</span><span class="special">,</span> <span class="identifier">policies</span><span class="special">::</span><span class="identifier">policy</span><span class="special"><></span> <span class="special">>::</span><span class="identifier">result_type</span>
- <span class="identifier">cyl_bessel_j_zero</span><span class="special">(</span><span class="identifier">T</span> <span class="identifier">v</span><span class="special">,</span> <span class="comment">// Floating-point value for Jv.</span>
- <span class="keyword">int</span> <span class="identifier">m</span><span class="special">);</span> <span class="comment">// start index.</span>
-</pre>
-<p>
- The result type is controlled by the floating-point type of parameter
- <code class="computeroutput"><span class="identifier">v</span></code> (but subject to the usual
- <a class="link" href="../../policy/pol_ref/precision_pol.html" title="Precision Policies">precision policy</a>
- and <a class="link" href="../../policy/pol_ref/internal_promotion.html" title="Internal Floating-point Promotion Policies">internal
- promotion policy</a>).
- </p>
-<p>
- The signature of multiple zeros function is:
- </p>
-<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">OutputIterator</span><span class="special">></span>
-<span class="keyword">inline</span> <span class="identifier">OutputIterator</span> <span class="identifier">cyl_bessel_j_zero</span><span class="special">(</span><span class="identifier">T</span> <span class="identifier">v</span><span class="special">,</span> <span class="comment">// Floating-point value for Jv.</span>
- <span class="keyword">int</span> <span class="identifier">start_index</span><span class="special">,</span> <span class="comment">// 1-based start index.</span>
- <span class="keyword">unsigned</span> <span class="identifier">number_of_zeros</span><span class="special">,</span>
- <span class="identifier">OutputIterator</span> <span class="identifier">out_it</span><span class="special">);</span> <span class="comment">// iterator into container for zeros.</span>
-</pre>
-<p>
- There is also a version which allows control of the <a class="link" href="../../policy.html" title="Policies">Policies</a>
- for error handling and precision.
+ by providing an iterator.
</p>
-<pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">OutputIterator</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">Policy</span><span class="special">></span>
-<span class="keyword">inline</span> <span class="identifier">OutputIterator</span> <span class="identifier">cyl_bessel_j_zero</span><span class="special">(</span><span class="identifier">T</span> <span class="identifier">v</span><span class="special">,</span> <span class="comment">// Floating-point value for Jv.</span>
- <span class="keyword">int</span> <span class="identifier">start_index</span><span class="special">,</span> <span class="comment">// 1-based start index.</span>
- <span class="keyword">unsigned</span> <span class="identifier">number_of_zeros</span><span class="special">,</span>
- <span class="identifier">OutputIterator</span> <span class="identifier">out_it</span><span class="special">,</span>
- <span class="keyword">const</span> <span class="identifier">Policy</span><span class="special">&</span> <span class="identifier">pol</span><span class="special">);</span> <span class="comment">// iterator into container for zeros.</span>
-</pre>
<div class="tip"><table border="0" summary="Tip">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../../../../../doc/src/images/tip.png"></td>
@@ -208,7 +228,7 @@
</tr>
<tr><td align="left" valign="top"><p>
It is always wise to place code using Boost.Math inside try'n'catch blocks;
- this will ensure that helpful error messages can be shown when exceptional
+ this will ensure that helpful error messages are shown when exceptional
conditions arise.
</p></td></tr>
</table></div>
@@ -224,12 +244,12 @@
</p>
<p>
</p>
-<pre class="programlisting"><span class="keyword">double</span> <span class="identifier">root</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">cyl_bessel_j_zero</span><span class="special">(</span><span class="number">0.0</span><span class="special">,</span> <span class="number">1</span><span class="special">);</span>
-<span class="comment">// Displaying with default precision of 6 decimal digits:</span>
-<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"boost::math::cyl_bessel_j_zero(0.0, 1) "</span> <span class="special"><<</span> <span class="identifier">root</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">// 2.40483</span>
-<span class="comment">// And with all the guaranteed (15) digits:</span>
-<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="keyword">double</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="string">"boost::math::cyl_bessel_j_zero(0.0, 1) "</span> <span class="special"><<</span> <span class="identifier">root</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">// 2.40482555769577</span>
+<pre class="programlisting"><span class="comment">// double root = boost::math::cyl_bessel_j_zero(0.0, 1);</span>
+<span class="comment">// // Displaying with default precision of 6 decimal digits:</span>
+<span class="comment">// std::cout << "boost::math::cyl_bessel_j_zero(0.0, 1) " << root << std::endl; // 2.40483</span>
+<span class="comment">// // And with all the guaranteed (15) digits:</span>
+<span class="comment">// std::cout.precision(std::numeric_limits<double>::digits10);</span>
+<span class="comment">// std::cout << "boost::math::cyl_bessel_j_zero(0.0, 1) " << root << std::endl; // 2.40482555769577</span>
</pre>
<p>
</p>
@@ -255,30 +275,37 @@
handling</a>).
</p>
<p>
- To create a (possibly unwise!) policy that ignores all errors:
+ To create a (possibly unwise!) policy <code class="computeroutput"><span class="identifier">ignore_all_policy</span></code>
+ that ignores all errors:
</p>
<p>
</p>
-<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">policies</span><span class="special">::</span><span class="identifier">policy</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">policies</span><span class="special">::</span><span class="identifier">domain_error</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">policies</span><span class="special">::</span><span class="identifier">ignore_error</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">policies</span><span class="special">::</span><span class="identifier">overflow_error</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">policies</span><span class="special">::</span><span class="identifier">ignore_error</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">policies</span><span class="special">::</span><span class="identifier">underflow_error</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">policies</span><span class="special">::</span><span class="identifier">ignore_error</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">policies</span><span class="special">::</span><span class="identifier">denorm_error</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">policies</span><span class="special">::</span><span class="identifier">ignore_error</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">policies</span><span class="special">::</span><span class="identifier">pole_error</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">policies</span><span class="special">::</span><span class="identifier">ignore_error</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">policies</span><span class="special">::</span><span class="identifier">evaluation_error</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">policies</span><span class="special">::</span><span class="identifier">ignore_error</span><span class="special">></span>
- <span class="special">></span> <span class="identifier">ignore_all_policy</span><span class="special">;</span>
-
- <span class="keyword">double</span> <span class="identifier">inf</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="keyword">double</span><span class="special">>::</span><span class="identifier">infinity</span><span class="special">();</span>
- <span class="keyword">double</span> <span class="identifier">nan</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="keyword">double</span><span class="special">>::</span><span class="identifier">quiet_NaN</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">"boost::math::cyl_bessel_j_zero(-1.0, 0) "</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="keyword">double</span> <span class="identifier">dodgy_root</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">cyl_bessel_j_zero</span><span class="special">(-</span><span class="number">1.0</span><span class="special">,</span> <span class="number">0</span><span class="special">,</span> <span class="identifier">ignore_all_policy</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">"boost::math::cyl_bessel_j_zero(-1.0, 1) "</span> <span class="special"><<</span> <span class="identifier">dodgy_root</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">// 1.#QNAN</span>
- <span class="keyword">double</span> <span class="identifier">inf_root</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">cyl_bessel_j_zero</span><span class="special">(</span><span class="identifier">inf</span><span class="special">,</span> <span class="number">1</span><span class="special">,</span> <span class="identifier">ignore_all_policy</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">"boost::math::cyl_bessel_j_zero(inf, 1) "</span> <span class="special"><<</span> <span class="identifier">inf_root</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">// 1.#QNAN</span>
- <span class="keyword">double</span> <span class="identifier">nan_root</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">cyl_bessel_j_zero</span><span class="special">(</span><span class="identifier">nan</span><span class="special">,</span> <span class="number">1</span><span class="special">,</span> <span class="identifier">ignore_all_policy</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">"boost::math::cyl_bessel_j_zero(nan, 1) "</span> <span class="special"><<</span> <span class="identifier">nan_root</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">// 1.#QNAN</span>
+<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">policies</span><span class="special">::</span><span class="identifier">policy</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">policies</span><span class="special">::</span><span class="identifier">domain_error</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">policies</span><span class="special">::</span><span class="identifier">ignore_error</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">policies</span><span class="special">::</span><span class="identifier">overflow_error</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">policies</span><span class="special">::</span><span class="identifier">ignore_error</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">policies</span><span class="special">::</span><span class="identifier">underflow_error</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">policies</span><span class="special">::</span><span class="identifier">ignore_error</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">policies</span><span class="special">::</span><span class="identifier">denorm_error</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">policies</span><span class="special">::</span><span class="identifier">ignore_error</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">policies</span><span class="special">::</span><span class="identifier">pole_error</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">policies</span><span class="special">::</span><span class="identifier">ignore_error</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">policies</span><span class="special">::</span><span class="identifier">evaluation_error</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">policies</span><span class="special">::</span><span class="identifier">ignore_error</span><span class="special">></span>
+ <span class="special">></span> <span class="identifier">ignore_all_policy</span><span class="special">;</span>
+</pre>
+<p>
+ </p>
+<p>
+ Examples of use of this <code class="computeroutput"><span class="identifier">ignore_all_policy</span></code>
+ are
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">double</span> <span class="identifier">inf</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="keyword">double</span><span class="special">>::</span><span class="identifier">infinity</span><span class="special">();</span>
+<span class="keyword">double</span> <span class="identifier">nan</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="keyword">double</span><span class="special">>::</span><span class="identifier">quiet_NaN</span><span class="special">();</span>
+
+<span class="keyword">double</span> <span class="identifier">dodgy_root</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">cyl_bessel_j_zero</span><span class="special">(-</span><span class="number">1.0</span><span class="special">,</span> <span class="number">1</span><span class="special">,</span> <span class="identifier">ignore_all_policy</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">"boost::math::cyl_bessel_j_zero(-1.0, 1) "</span> <span class="special"><<</span> <span class="identifier">dodgy_root</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">// 1.#QNAN</span>
+<span class="keyword">double</span> <span class="identifier">inf_root</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">cyl_bessel_j_zero</span><span class="special">(</span><span class="identifier">inf</span><span class="special">,</span> <span class="number">1</span><span class="special">,</span> <span class="identifier">ignore_all_policy</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">"boost::math::cyl_bessel_j_zero(inf, 1) "</span> <span class="special"><<</span> <span class="identifier">inf_root</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">// 1.#QNAN</span>
+<span class="keyword">double</span> <span class="identifier">nan_root</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">cyl_bessel_j_zero</span><span class="special">(</span><span class="identifier">nan</span><span class="special">,</span> <span class="number">1</span><span class="special">,</span> <span class="identifier">ignore_all_policy</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">"boost::math::cyl_bessel_j_zero(nan, 1) "</span> <span class="special"><<</span> <span class="identifier">nan_root</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">// 1.#QNAN</span>
</pre>
<p>
</p>
@@ -286,11 +313,9 @@
Another version of <code class="computeroutput"><span class="identifier">cyl_bessel_j_zero</span></code>
allows calculation of multiple zeros with one call, placing the results
in a container, often <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span></code>.
- For example, generate five <code class="computeroutput"><span class="keyword">double</span></code>
- roots of J<sub>v</sub> for integral order 2.
- </p>
-<p>
- As column J<sub>2</sub>(x) in table 1 of <a href="http://mathworld.wolfram.com/BesselFunctionZeros.html" target="_top">Wolfram
+ For example, generate and display the first five <code class="computeroutput"><span class="keyword">double</span></code>
+ roots of J<sub>v</sub> for integral order 2, as column <span class="emphasis"><em>J<sub>2</sub>(x)</em></span> in
+ table 1 of <a href="http://mathworld.wolfram.com/BesselFunctionZeros.html" target="_top">Wolfram
Bessel Function Zeros</a>.
</p>
<p>
@@ -305,10 +330,13 @@
<p>
</p>
<p>
- Or generate 50 decimal digit roots of J<sub>v</sub> for non-integral order <code class="computeroutput"><span class="identifier">v</span><span class="special">=</span><span class="number">71</span><span class="special">/</span><span class="number">19</span></code>.
+ Or we can use Boost.Multiprecision to generate 50 decimal digit roots of
+ <span class="emphasis"><em>J<sub>v</sub></em></span> for non-integral order <code class="computeroutput"><span class="identifier">v</span><span class="special">=</span> <span class="number">71</span><span class="special">/</span><span class="number">19</span> <span class="special">==</span> <span class="number">3.736842</span></code>,
+ expressed as an exact-integer fraction to generate the most accurate value
+ possible for all floating-point types.
</p>
<p>
- We set the precision of the output stream and show trailing zeros to display
+ We set the precision of the output stream, and show trailing zeros to display
a fixed 50 decimal digits.
</p>
<p>
@@ -333,48 +361,26 @@
</pre>
<p>
</p>
+<h6>
+<a name="math_toolkit.special.bessel.bessel.h8"></a>
+ <span class="phrase"><a name="math_toolkit.special.bessel.bessel.using_output_iterator_to_sum_zeros_of_bessel_functions"></a></span><a class="link" href="bessel0.html#math_toolkit.special.bessel.bessel.using_output_iterator_to_sum_zeros_of_bessel_functions">Using
+ Output Iterator to sum zeros of Bessel Functions</a>
+ </h6>
<p>
- The Neumann function zeros are evaluated very similarly:
+ This example demonstrates summing zeros of the Bessel functions. To use
+ the functions for finding zeros of the functions we need
</p>
<p>
</p>
-<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">cyl_neumann_zero</span><span class="special">;</span>
-
-<span class="keyword">double</span> <span class="identifier">zn</span> <span class="special">=</span> <span class="identifier">cyl_neumann_zero</span><span class="special">(</span><span class="number">2.</span><span class="special">,</span> <span class="number">1</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">"cyl_neumann_zero(2., 1) = "</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">//double zn0 = zn;</span>
-<span class="comment">// std::cout << "zn0 = " << std::endl;</span>
-<span class="comment">// std::cout << zn0 << std::endl;</span>
-<span class="comment">//</span>
-<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="identifier">zn</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">// std::cout << cyl_neumann_zero(2., 1) << std::endl;</span>
-
-<span class="identifier">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">float</span><span class="special">></span> <span class="identifier">nzeros</span><span class="special">(</span><span class="number">3</span><span class="special">);</span> <span class="comment">// Space for 3 zeros.</span>
-<span class="identifier">cyl_neumann_zero</span><span class="special"><</span><span class="keyword">float</span><span class="special">>(</span><span class="number">2.F</span><span class="special">,</span> <span class="number">1</span><span class="special">,</span> <span class="identifier">nzeros</span><span class="special">.</span><span class="identifier">size</span><span class="special">(),</span> <span class="identifier">nzeros</span><span class="special">.</span><span class="identifier">begin</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">"cyl_neumann_zero<float>(2.F, 1, "</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">// Print the zeros to the output stream.</span>
-<span class="identifier">std</span><span class="special">::</span><span class="identifier">copy</span><span class="special">(</span><span class="identifier">nzeros</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">nzeros</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special"><</span><span class="keyword">float</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">"\n"</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">cyl_neumann_zero</span><span class="special">(</span><span class="keyword">static_cast</span><span class="special"><</span><span class="identifier">float_type</span><span class="special">>(</span><span class="number">220</span><span class="special">)/</span><span class="number">100</span><span class="special">,</span> <span class="number">1</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="comment">// 3.6154383428745996706772556069431792744372398748422</span>
+<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">special_functions</span><span class="special">/</span><span class="identifier">bessel</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
</pre>
<p>
</p>
<p>
- Finally we show how the output iterator can be used to compute a sum of
- zeros.
- </p>
-<p>
- (See <a href="http://dx.doi.org/10.1017/S2040618500034067" target="_top">Ian N. Sneddon,
- Infinite Sums of Bessel Zeros</a>, page 150 equation 40).
- </p>
-<p>
We use the <code class="computeroutput"><span class="identifier">cyl_bessel_j_zero</span></code>
output iterator parameter <code class="computeroutput"><span class="identifier">out_it</span></code>
- to create a sum of 1/zeros<sup>2</sup> by defining a custom output iterator:
+ to create a sum of <span class="emphasis"><em>1/zeros<sup>2</sup></em></span> by defining a custom output
+ iterator:
</p>
<p>
</p>
@@ -419,22 +425,112 @@
</pre>
<p>
</p>
+<h6>
+<a name="math_toolkit.special.bessel.bessel.h9"></a>
+ <span class="phrase"><a name="math_toolkit.special.bessel.bessel.calculating_zeros_of_the_neumann_function_"></a></span><a class="link" href="bessel0.html#math_toolkit.special.bessel.bessel.calculating_zeros_of_the_neumann_function_">Calculating
+ zeros of the Neumann function.</a>
+ </h6>
+<p>
+ This example also shows how Boost.Math and Boost.Multiprecision can be
+ combined to provide a many decimal digit precision. For 50 decimal digit
+ precision we need to include
+ </p>
+<p>
+</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">multiprecision</span><span class="special">/</span><span class="identifier">cpp_dec_float</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+</pre>
+<p>
+ </p>
+<p>
+ and a <code class="computeroutput"><span class="keyword">typedef</span></code> for <code class="computeroutput"><span class="identifier">float_type</span></code> may be convenient (allowing
+ a quick switch to re-compute at built-in <code class="computeroutput"><span class="keyword">double</span></code>
+ or other precision)
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">cpp_dec_float_50</span> <span class="identifier">float_type</span><span class="special">;</span>
+</pre>
+<p>
+ </p>
+<p>
+ To use the functions for finding zeros of the <code class="computeroutput"><span class="identifier">cyl_neumann</span></code>
+ function we need:
+ </p>
+<p>
+</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">special_functions</span><span class="special">/</span><span class="identifier">bessel</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+</pre>
+<p>
+ </p>
+<p>
+ The Neumann (Bessel Y) function zeros are evaluated very similarly:
+ </p>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">using</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">math</span><span class="special">::</span><span class="identifier">cyl_neumann_zero</span><span class="special">;</span>
+<span class="keyword">double</span> <span class="identifier">zn</span> <span class="special">=</span> <span class="identifier">cyl_neumann_zero</span><span class="special">(</span><span class="number">2.</span><span class="special">,</span> <span class="number">1</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">"cyl_neumann_zero(2., 1) = "</span> <span class="special"><<</span> <span class="identifier">zn</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">std</span><span class="special">::</span><span class="identifier">vector</span><span class="special"><</span><span class="keyword">float</span><span class="special">></span> <span class="identifier">nzeros</span><span class="special">(</span><span class="number">3</span><span class="special">);</span> <span class="comment">// Space for 3 zeros.</span>
+<span class="identifier">cyl_neumann_zero</span><span class="special"><</span><span class="keyword">float</span><span class="special">>(</span><span class="number">2.F</span><span class="special">,</span> <span class="number">1</span><span class="special">,</span> <span class="identifier">nzeros</span><span class="special">.</span><span class="identifier">size</span><span class="special">(),</span> <span class="identifier">nzeros</span><span class="special">.</span><span class="identifier">begin</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">"cyl_neumann_zero<float>(2.F, 1, "</span><span class="special">;</span>
+<span class="comment">// Print the zeros to the output stream.</span>
+<span class="identifier">std</span><span class="special">::</span><span class="identifier">copy</span><span class="special">(</span><span class="identifier">nzeros</span><span class="special">.</span><span class="identifier">begin</span><span class="special">(),</span> <span class="identifier">nzeros</span><span class="special">.</span><span class="identifier">end</span><span class="special">(),</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">ostream_iterator</span><span class="special"><</span><span class="keyword">float</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">", "</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">"\n"</span><span class="string">"cyl_neumann_zero(static_cast<float_type>(220)/100, 1) = "</span>
+ <span class="special"><<</span> <span class="identifier">cyl_neumann_zero</span><span class="special">(</span><span class="keyword">static_cast</span><span class="special"><</span><span class="identifier">float_type</span><span class="special">>(</span><span class="number">220</span><span class="special">)/</span><span class="number">100</span><span class="special">,</span> <span class="number">1</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="comment">// 3.6154383428745996706772556069431792744372398748422</span>
+</pre>
+<p>
+ </p>
+<h6>
+<a name="math_toolkit.special.bessel.bessel.h10"></a>
+ <span class="phrase"><a name="math_toolkit.special.bessel.bessel.error_messages_from__bad__input"></a></span><a class="link" href="bessel0.html#math_toolkit.special.bessel.bessel.error_messages_from__bad__input">Error
+ messages from 'bad' input</a>
+ </h6>
+<p>
+ Another example demonstrates calculating zeros of the Bessel functions
+ showing the error messages from 'bad' input is handled by throwing exceptions.
+ </p>
+<p>
+ To use the functions for finding zeros of the functions we need:
+ </p>
+<p>
+</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">special_functions</span><span class="special">/</span><span class="identifier">bessel</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">math</span><span class="special">/</span><span class="identifier">special_functions</span><span class="special">/</span><span class="identifier">airy</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">></span>
+</pre>
+<p>
+ </p>
+<div class="tip"><table border="0" summary="Tip">
+<tr>
+<td rowspan="2" align="center" valign="top" width="25"><img alt="[Tip]" src="../../../../../../../../doc/src/images/tip.png"></td>
+<th align="left">Tip</th>
+</tr>
+<tr><td align="left" valign="top"><p>
+ It is always wise to place all code using Boost.Math inside try'n'catch
+ blocks; this will ensure that helpful error messages can be shown when
+ exceptional conditions arise.
+ </p></td></tr>
+</table></div>
<p>
- Examples below show effect of 'bad' arguments that throw a <code class="computeroutput"><span class="identifier">domain_error</span></code> exception.
+ Examples below show messages from several 'bad' arguments that throw a
+ <code class="computeroutput"><span class="identifier">domain_error</span></code> exception.
</p>
<p>
</p>
<pre class="programlisting"><span class="keyword">try</span>
-<span class="special">{</span> <span class="comment">// Try a negative rank m.</span>
- <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"boost::math::cyl_bessel_j_zero(-1.F, -1) "</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="keyword">float</span> <span class="identifier">dodgy_root</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">cyl_bessel_j_zero</span><span class="special">(-</span><span class="number">1.F</span><span class="special">,</span> <span class="special">-</span><span class="number">1</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">"boost::math::cyl_bessel_j_zero(-1.F, -1) "</span> <span class="special"><<</span> <span class="identifier">dodgy_root</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">// Throw exception Error in function boost::math::cyl_bessel_j_zero<double>(double, int):</span>
- <span class="comment">// Order argument is -1, but must be >= 0 !</span>
+<span class="special">{</span> <span class="comment">// Try a zero order v.</span>
+ <span class="keyword">float</span> <span class="identifier">dodgy_root</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">cyl_bessel_j_zero</span><span class="special">(</span><span class="number">0.F</span><span class="special">,</span> <span class="number">0</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">"boost::math::cyl_bessel_j_zero(0.F, 0) "</span> <span class="special"><<</span> <span class="identifier">dodgy_root</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">// Thrown exception Error in function boost::math::cyl_bessel_j_zero<double>(double, int):</span>
+ <span class="comment">// Requested the 0'th zero of J0, but the rank must be > 0 !</span>
<span class="special">}</span>
<span class="keyword">catch</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">exception</span><span class="special">&</span> <span class="identifier">ex</span><span class="special">)</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">"Throw exception "</span> <span class="special"><<</span> <span class="identifier">ex</span><span class="special">.</span><span class="identifier">what</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">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"Thrown exception "</span> <span class="special"><<</span> <span class="identifier">ex</span><span class="special">.</span><span class="identifier">what</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="special">}</span>
</pre>
<p>
@@ -445,8 +541,8 @@
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
- The type shown is the type <span class="bold"><strong>after promotion</strong></span>,
- using <a class="link" href="../../policy/pol_ref/precision_pol.html" title="Precision Policies">precision
+ The type shown in the error message is the type <span class="bold"><strong>after
+ promotion</strong></span>, using <a class="link" href="../../policy/pol_ref/precision_pol.html" title="Precision Policies">precision
policy</a> and <a class="link" href="../../policy/pol_ref/internal_promotion.html" title="Internal Floating-point Promotion Policies">internal
promotion policy</a>, from <code class="computeroutput"><span class="keyword">float</span></code>
to <code class="computeroutput"><span class="keyword">double</span></code> in this case.
@@ -470,8 +566,8 @@
- so that's the precision we want (and the type that will be returned).
</li>
<li class="listitem">
- Evaluate internally as <code class="computeroutput"><span class="keyword">long</span>
- <span class="keyword">double</span></code> for full <code class="computeroutput"><span class="keyword">double</span></code> precision.
+ Evaluate internally as <code class="computeroutput"><span class="keyword">double</span></code>
+ for full <code class="computeroutput"><span class="keyword">float</span></code> precision.
</li>
</ol></div>
<p>
@@ -479,24 +575,253 @@
to <code class="computeroutput"><span class="keyword">long</span> <span class="keyword">double</span></code>.
</p>
<p>
- The full code (and output) for this example for Bessel <code class="computeroutput"><span class="identifier">cyl_bessel_j_zeros</span></code>
- is at <a href="../../../../../../example/bessel_zeros_example.cpp" target="_top">Bessel, Neumann
- and Airy zeros</a>.
+ Other examples of 'bad' inputs like infinity and NaN are below. Some compiler
+ warnings indicate that 'bad' values are detected at compile time.
</p>
-<h5>
-<a name="math_toolkit.special.bessel.bessel.h8"></a>
+<p>
+</p>
+<pre class="programlisting"><span class="keyword">try</span>
+<span class="special">{</span> <span class="comment">// order v = inf</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"boost::math::cyl_bessel_j_zero(inf, 1) "</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="keyword">double</span> <span class="identifier">inf</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="keyword">double</span><span class="special">>::</span><span class="identifier">infinity</span><span class="special">();</span>
+ <span class="keyword">double</span> <span class="identifier">inf_root</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">cyl_bessel_j_zero</span><span class="special">(</span><span class="identifier">inf</span><span class="special">,</span> <span class="number">1</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">"boost::math::cyl_bessel_j_zero(inf, 1) "</span> <span class="special"><<</span> <span class="identifier">inf_root</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">// Throw exception Error in function boost::math::cyl_bessel_j_zero<long double>(long double, unsigned):</span>
+ <span class="comment">// Order argument is 1.#INF, but must be finite >= 0 !</span>
+<span class="special">}</span>
+<span class="keyword">catch</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">exception</span><span class="special">&</span> <span class="identifier">ex</span><span class="special">)</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">"Thrown exception "</span> <span class="special"><<</span> <span class="identifier">ex</span><span class="special">.</span><span class="identifier">what</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="special">}</span>
+
+<span class="keyword">try</span>
+<span class="special">{</span> <span class="comment">// order v = NaN, rank m = 1</span>
+ <span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span> <span class="string">"boost::math::cyl_bessel_j_zero(nan, 1) "</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="keyword">double</span> <span class="identifier">nan</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="keyword">double</span><span class="special">>::</span><span class="identifier">quiet_NaN</span><span class="special">();</span>
+ <span class="keyword">double</span> <span class="identifier">nan_root</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">cyl_bessel_j_zero</span><span class="special">(</span><span class="identifier">nan</span><span class="special">,</span> <span class="number">1</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">"boost::math::cyl_bessel_j_zero(nan, 1) "</span> <span class="special"><<</span> <span class="identifier">nan_root</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">// Throw exception Error in function boost::math::cyl_bessel_j_zero<long double>(long double, unsigned):</span>
+ <span class="comment">// Order argument is 1.#QNAN, but must be finite >= 0 !</span>
+<span class="special">}</span>
+<span class="keyword">catch</span> <span class="special">(</span><span class="identifier">std</span><span class="special">::</span><span class="identifier">exception</span><span class="special">&</span> <span class="identifier">ex</span><span class="special">)</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">"Thrown exception "</span> <span class="special"><<</span> <span class="identifier">ex</span><span class="special">.</span><span class="identifier">what</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="special">}</span>
+</pre>
+<p>
+ </p>
+<p>
+ The output from other examples are shown appended to the full code listing.
+ </p>
+<p>
+ The full code (and output) for these examples is at <a href="../../../../../../example/bessel_zeros_example_1.cpp" target="_top">Bessel
+ zeros</a>, <a href="../../../../../../example/bessel_zeros_interator_example.cpp" target="_top">Bessel
+ zeros iterator</a>, <a href="../../../../../../example/neumann_zeros_example_1.cpp" target="_top">Neumann
+ zeros</a>, <a href="../../../../../../example/bessel_errors_example.cpp" target="_top">Bessel
+ error messages</a>.
+ </p>
+<h4>
+<a name="math_toolkit.special.bessel.bessel.h11"></a>
<span class="phrase"><a name="math_toolkit.special.bessel.bessel.implementation0"></a></span><a class="link" href="bessel0.html#math_toolkit.special.bessel.bessel.implementation0">Implementation</a>
- </h5>
+ </h4>
<p>
- The method uses Newton-Raphson method starting with McMahon's approximation.
- See "Handbook of Mathematical Functions", M. Abramowitz and I.
- A. Stegan, section 9.5. Also: NIST Digital Library of Mathematical Functions,
- Bessel Function Zeros.
+ Various methods are used to compute initial estimates for <span class="emphasis"><em>j<sub>ν,
+ m</sub></em></span> and <span class="emphasis"><em>y<sub>ν, m</sub></em></span> ; these are described in detail
+ below.
</p>
-<h5>
-<a name="math_toolkit.special.bessel.bessel.h9"></a>
+<p>
+ After finding the initial estimate of a given root, its precision is subsequently
+ refined to the desired level using Newton-Raphson iteration from Boost.Math's
+ <a class="link" href="../../toolkit/internals1/roots.html" title="Root Finding With Derivatives: Newton-Raphson, Halley & Schroeder">root-finding with
+ derivatives</a> utilities combined with the functions <a class="link" href="bessel.html" title="Bessel Functions of the First and Second Kinds">cyl_bessel_j</a>
+ and <a class="link" href="bessel.html" title="Bessel Functions of the First and Second Kinds">cyl_neumann</a>.
+ </p>
+<p>
+ Newton iteration requires both <span class="emphasis"><em>J<sub>ν</sub>(x)</em></span> or <span class="emphasis"><em>Y<sub>ν</sub>(x)</em></span>
+ as well as its derivative. The derivatives of <span class="emphasis"><em>J<sub>ν</sub>(x)</em></span>
+ and <span class="emphasis"><em>Y<sub>ν</sub>(x)</em></span> with respect to <span class="emphasis"><em>x</em></span> are
+ given by M. Abramowitz and I. A. Stegun, Handbook of Mathematical Functions,
+ NBS (1964). In particular,
+ </p>
+<p>
+   <span class="emphasis"><em>d/<sub>dx</sub> <span class="emphasis"><em>J<sub>ν</sub>(x)</em></span> = <span class="emphasis"><em>J<sub>ν-1</sub>(x)</em></span> -
+ ν J<sub>ν</sub>(x)</em></span> / x
+ </p>
+<p>
+   <span class="emphasis"><em>d/<sub>dx</sub> <span class="emphasis"><em>Y<sub>ν</sub>(x)</em></span> = <span class="emphasis"><em>Y<sub>ν-1</sub>(x)</em></span> -
+ ν Y<sub>ν</sub>(x)</em></span> / x
+ </p>
+<p>
+ Enumeration of the rank of a root (in other words the index of a root)
+ begins with one and counts up, in other words <span class="emphasis"><em>m,=1,2,3,…</em></span>
+ The value of the first root is always greater than zero.
+ </p>
+<p>
+ For certain special parameters, cylindrical Bessel functions and cylindrical
+ Neumann functions have a root at the origin. For example, <span class="emphasis"><em>J<sub>ν</sub>(x)</em></span>
+ has a root at the origin for every positive order <span class="emphasis"><em>ν > 0</em></span>,
+ and for every negative integer order <span class="emphasis"><em>ν = -n</em></span> with <span class="emphasis"><em>n
+ ∈ ℕ <sup>+</sup></em></span> and <span class="emphasis"><em>n ≠ 0</em></span>.
+ </p>
+<p>
+ In addition, <span class="emphasis"><em>Y<sub>ν</sub>(x)</em></span> has a root at the origin for every
+ negative half-integer order <span class="emphasis"><em>ν = -n/2</em></span>, with <span class="emphasis"><em>n
+ ∈ ℕ <sup>+</sup></em></span> and and <span class="emphasis"><em>n ≠ 0</em></span>.
+ </p>
+<p>
+ For these special parameter values, the origin with a value of <span class="emphasis"><em>x
+ = 0</em></span> is provided as the <span class="emphasis"><em>0<sup>th</sup></em></span> root generated
+ by <code class="computeroutput"><span class="identifier">cyl_bessel_j_zero</span><span class="special">()</span></code>
+ and <code class="computeroutput"><span class="identifier">cyl_neumann_zero</span><span class="special">()</span></code>.
+ </p>
+<p>
+ When calculating initial estimates for the roots of Bessel functions, a
+ distinction is made between positive order and negative order, and different
+ methods are used for these. In addition, different algorithms are used
+ for the first root <span class="emphasis"><em>m = 1</em></span> and for subsequent roots
+ with higher rank <span class="emphasis"><em>m ≥ 2</em></span>. Furthermore, estimates of the
+ roots for Bessel functions with order above and below a cutoff at <span class="emphasis"><em>ν =
+ 2.2</em></span> are calculated with different methods.
+ </p>
+<p>
+ Calculations of the estimates of <span class="emphasis"><em>j<sub>ν,1</sub></em></span> and <span class="emphasis"><em>y<sub>ν,1</sub></em></span>
+ with <span class="emphasis"><em>0 ≤ ν < 2.2</em></span> use empirically tabulated values.
+ The coefficients for these have been generated by a computer algebra system.
+ </p>
+<p>
+ Calculations of the estimates of <span class="emphasis"><em>j<sub>ν,1</sub></em></span> and <span class="emphasis"><em>y<sub>ν,1</sub></em></span>
+ with <span class="emphasis"><em>ν≥ 2.2</em></span> use Eqs.9.5.14 and 9.5.15 in M. Abramowitz
+ and I. A. Stegun, Handbook of Mathematical Functions, NBS (1964).
+ </p>
+<p>
+ In particular,
+ </p>
+<p>
+   <span class="emphasis"><em>j<sub>ν,1</sub> ≅ ν + 1.85575 ν<sup>⅓</sup> + 1.033150 ν<sup>-⅓</sup> - 0.00397 ν<sup>-1</sup> - 0.0908 ν<sup>-5/3</sup> + 0.043 ν<sup>-7/3</sup> +
+ …</em></span>
+ </p>
+<p>
+ and
+ </p>
+<p>
+   <span class="emphasis"><em>y<sub>ν,1</sub> ≅ ν + 0.93157 ν<sup>⅓</sup> + 0.26035 ν<sup>-⅓</sup> + 0.01198 ν<sup>-1</sup> - 0.0060 ν<sup>-5/3</sup> - 0.001 ν<sup>-7/3</sup> +
+ …</em></span>
+ </p>
+<p>
+ Calculations of the estimates of <span class="emphasis"><em>j<sub>ν, m</sub></em></span> and <span class="emphasis"><em>y<sub>ν,
+ m</sub></em></span> with rank <span class="emphasis"><em>m > 2</em></span> and <span class="emphasis"><em>0 ≤ ν <
+ 2.2</em></span> use McMahon's approximation, as described in M. Abramowitz
+ and I. A. Stegan, Section 9.5 and 9.5.12. In particular,
+ </p>
+<p>
+   <span class="emphasis"><em>j<sub>ν,m</sub>, y<sub>ν,m</sub> ≅ β - (μ-1) / 8β</em></span>
+ </p>
+<p>
+       <span class="emphasis"><em>- 4(μ-1)(7μ - 31) / 3(8β)<sup>3</sup></em></span>
+ </p>
+<p>
+       <span class="emphasis"><em>-32(μ-1)(83μ² - 982μ + 3779) / 15(8β)<sup>5</sup></em></span>
+ </p>
+<p>
+       <span class="emphasis"><em>-64(μ-1)(6949μ<sup>3</sup> - 153855μ² + 1585743μ- 6277237) / 105(8a)<sup>7</sup></em></span>
+ </p>
+<p>
+       <span class="emphasis"><em>- …</em></span>     (5)
+ </p>
+<p>
+ where <span class="emphasis"><em>μ = 4ν<sup>2</sup></em></span> and <span class="emphasis"><em>β = (m + ½ν - ¼)π</em></span> for
+ <span class="emphasis"><em>j<sub>ν,m</sub></em></span> and <span class="emphasis"><em>β = (m + ½ν -¾)π for <span class="emphasis"><em>y<sub>ν,m</sub></em></span></em></span>.
+ </p>
+<p>
+ Calculations of the estimates of <span class="emphasis"><em>j<sub>ν, m</sub></em></span> and <span class="emphasis"><em>y<sub>ν,
+ m</sub></em></span> with <span class="emphasis"><em>ν ≥ 2.2</em></span> use one term in the asymptotic
+ expansion given in Eq.9.5.22 and top line of Eq.9.5.26 combined with Eq.
+ 9.3.39, all in M. Abramowitz and I. A. Stegun, Handbook of Mathematical
+ Functions, NBS (1964) explicit and easy-to-understand treatment for asymptotic
+ expansion of zeros. The latter two equations are expressed for argument
+ <span class="emphasis"><em>(x)</em></span> greater than one. (Olver also gives the series
+ form of the equations in <a href="http://dlmf.nist.gov/10.21#vi" target="_top">§10.21(vi)
+ McMahon's Asymptotic Expansions for Large Zeros</a> - using slightly
+ different variable names).
+ </p>
+<p>
+ In summary,
+ </p>
+<p>
+   <span class="emphasis"><em>j<sub>ν, m</sub> ∼ νx(-ζ) + f<sub>1</sub>(-ζ/ν)</em></span>
+ </p>
+<p>
+ where <span class="emphasis"><em>-ζ = ν<sup>-2/3</sup>a<sub>m</sub></em></span> and <span class="emphasis"><em>a<sub>m</sub></em></span> is the
+ absolute value of the <span class="emphasis"><em>m<sup>th</sup></em></span> root of <span class="emphasis"><em>Ai(x)</em></span>
+ on the negative real axis.
+ </p>
+<p>
+ Here <span class="emphasis"><em>x = x(-ζ)</em></span> is the inverse of the function
+ </p>
+<p>
+   <span class="emphasis"><em>⅔(-ζ)<sup>3/2</sup> = √(x² - 1) - cos⁻¹(1/x)</em></span>     (7)
+ </p>
+<p>
+ Furthermore,
+ </p>
+<p>
+   <span class="emphasis"><em>f<sub>1</sub>(-ζ) = ½x(-ζ) {h(-ζ)}² ⋅ b<sub>0</sub>(-ζ)</em></span>
+ </p>
+<p>
+ where
+ </p>
+<p>
+   <span class="emphasis"><em>h(-ζ) = {4(-ζ) / (x² - 1)}<sup>4</sup></em></span>
+ </p>
+<p>
+ and
+ </p>
+<p>
+   <span class="emphasis"><em>b<sub>0</sub>(-ζ) = -5/(48ζ²) + 1/(-ζ)<sup>½</sup> ⋅ { 5/(24(x<sup>2</sup>-1)<sup>3/2</sup>) + 1/(8(x<sup>2</sup>-1)<sup>½)</sup>}</em></span>
+ </p>
+<p>
+ When solving for <span class="emphasis"><em>x(-ζ)</em></span> in Eq. 7 above, the right-hand-side
+ is expanded to order 2 in a Taylor series for large <span class="emphasis"><em>x</em></span>.
+ This results in
+ </p>
+<p>
+   <span class="emphasis"><em>⅔(-ζ)<sup>3/2</sup> ≈ x + 1/2x - π/2</em></span>
+ </p>
+<p>
+ The positive root of the resulting quadratic equation is used to find an
+ initial estimate <span class="emphasis"><em>x(-ζ)</em></span>. This initial estimate is subsequently
+ refined with several steps of Newton-Raphson iteration in Eq. 7.
+ </p>
+<p>
+ Estimates of the roots of cylindrical Bessel functions of negative order
+ on the positive real axis are found using interlacing relations. For example,
+ the <span class="emphasis"><em>m<sup>th</sup></em></span> root of the cylindrical Bessel function <span class="emphasis"><em>j<sub>-ν,m</sub></em></span>
+ is bracketed by the <span class="emphasis"><em>m<sup>th</sup></em></span> root and the <span class="emphasis"><em>(m+1)<sup>th</sup></em></span>
+ root of the Bessel function of corresponding positive integer order. In
+ other words,
+ </p>
+<p>
+   <span class="emphasis"><em>j<sub>nν,m</sub></em></span> < <span class="emphasis"><em>j<sub>-ν,m</sub></em></span> < <span class="emphasis"><em>j<sub>nν,m+1</sub></em></span>
+ </p>
+<p>
+ where <span class="emphasis"><em>m > 1</em></span> and <span class="emphasis"><em>n<sub>ν</sub></em></span> represents
+ the integral floor of the absolute value of <span class="emphasis"><em>|-ν|</em></span>.
+ </p>
+<p>
+ Similar bracketing relations are used to find estimates of the roots of
+ Neumann functions of negative order, whereby a discontinuity at every negative
+ half-integer order needs to be handled.
+ </p>
+<p>
+ Bracketing relations do not hold for the first root of cylindrical Bessel
+ functions and cylindrical Neumann functions with negative order. Therefore,
+ iterative algorithms combined with root-finding via bisection are used
+ to localize <span class="emphasis"><em>j<sub>-ν,1</sub></em></span> and <span class="emphasis"><em>y<sub>-ν,1</sub></em></span>.
+ </p>
+<h4>
+<a name="math_toolkit.special.bessel.bessel.h12"></a>
<span class="phrase"><a name="math_toolkit.special.bessel.bessel.testing0"></a></span><a class="link" href="bessel0.html#math_toolkit.special.bessel.bessel.testing0">Testing</a>
- </h5>
+ </h4>
<p>
The precision of evaluation of zeros was tested at 50 decimal digits using
<code class="computeroutput"><span class="identifier">cpp_dec_float_50</span></code> and found
Modified: trunk/libs/math/doc/sf_and_dist/html/math_toolkit/status/history1.html
==============================================================================
--- trunk/libs/math/doc/sf_and_dist/html/math_toolkit/status/history1.html (original)
+++ trunk/libs/math/doc/sf_and_dist/html/math_toolkit/status/history1.html 2013-03-21 09:01:50 EDT (Thu, 21 Mar 2013)
@@ -72,6 +72,15 @@
<li class="listitem">
Added minimal __float128 support.
</li>
+<li class="listitem">
+ Fixed bug in edge-cases of poisson quantile #8308.
+ </li>
+<li class="listitem">
+ Adjusted heuristics used in Halley iteration to cope with inverting the
+ incomplete beta in tricky regions where the derivative is flatlining.
+ Example is computing the quantile of the Fisher F distribution for probabilities
+ smaller than machine epsilon. See ticket #8314.
+ </li>
</ul></div>
<h5>
<a name="math_toolkit.status.history1.h1"></a>
Modified: trunk/libs/math/doc/sf_and_dist/html/math_toolkit/status/issues.html
==============================================================================
--- trunk/libs/math/doc/sf_and_dist/html/math_toolkit/status/issues.html (original)
+++ trunk/libs/math/doc/sf_and_dist/html/math_toolkit/status/issues.html 2013-03-21 09:01:50 EDT (Thu, 21 Mar 2013)
@@ -41,6 +41,21 @@
</p>
<h5>
<a name="math_toolkit.status.issues.h0"></a>
+ <span class="phrase"><a name="math_toolkit.status.issues.derivatives_of_bessel_functions__and_their_zeros_"></a></span><a class="link" href="issues.html#math_toolkit.status.issues.derivatives_of_bessel_functions__and_their_zeros_">Derivatives
+ of Bessel functions (and their zeros)</a>
+ </h5>
+<p>
+ Potentially, there could be native support for <code class="computeroutput"><span class="identifier">cyl_bessel_j_prime</span><span class="special">()</span></code> and <code class="computeroutput"><span class="identifier">cyl_neumann_prime</span><span class="special">()</span></code>. One could also imagine supporting the
+ zeros thereof, but they might be slower to calculate since root bracketing
+ might be needed instead of Newton iteration (for the lack of 2nd derivatives).
+ </p>
+<p>
+ Since Boost.Math's Bessel functions are so excellent, the quick way to <code class="computeroutput"><span class="identifier">cyl_bessel_j_prime</span><span class="special">()</span></code>
+ and <code class="computeroutput"><span class="identifier">cyl_neumann_prime</span><span class="special">()</span></code>
+ would be via relationship with <code class="computeroutput"><span class="identifier">cyl_bessel_j</span><span class="special">()</span></code> and <code class="computeroutput"><span class="identifier">cyl_neumann</span><span class="special">()</span></code>.
+ </p>
+<h5>
+<a name="math_toolkit.status.issues.h1"></a>
<span class="phrase"><a name="math_toolkit.status.issues.tgamma"></a></span><a class="link" href="issues.html#math_toolkit.status.issues.tgamma">tgamma</a>
</h5>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
@@ -48,7 +63,7 @@
be optimized any further? (low priority)
</li></ul></div>
<h5>
-<a name="math_toolkit.status.issues.h1"></a>
+<a name="math_toolkit.status.issues.h2"></a>
<span class="phrase"><a name="math_toolkit.status.issues.incomplete_beta"></a></span><a class="link" href="issues.html#math_toolkit.status.issues.incomplete_beta">Incomplete
Beta</a>
</h5>
@@ -57,7 +72,7 @@
b (medium priority).
</li></ul></div>
<h5>
-<a name="math_toolkit.status.issues.h2"></a>
+<a name="math_toolkit.status.issues.h3"></a>
<span class="phrase"><a name="math_toolkit.status.issues.inverse_gamma"></a></span><a class="link" href="issues.html#math_toolkit.status.issues.inverse_gamma">Inverse
Gamma</a>
</h5>
@@ -66,7 +81,7 @@
is good enough (Medium Priority).
</li></ul></div>
<h5>
-<a name="math_toolkit.status.issues.h3"></a>
+<a name="math_toolkit.status.issues.h4"></a>
<span class="phrase"><a name="math_toolkit.status.issues.polynomials"></a></span><a class="link" href="issues.html#math_toolkit.status.issues.polynomials">Polynomials</a>
</h5>
<div class="itemizedlist"><ul class="itemizedlist" style="list-style-type: disc; "><li class="listitem">
@@ -76,7 +91,7 @@
not (Low Priority).
</li></ul></div>
<h5>
-<a name="math_toolkit.status.issues.h4"></a>
+<a name="math_toolkit.status.issues.h5"></a>
<span class="phrase"><a name="math_toolkit.status.issues.elliptic_integrals"></a></span><a class="link" href="issues.html#math_toolkit.status.issues.elliptic_integrals">Elliptic
Integrals</a>
</h5>
@@ -129,7 +144,7 @@
</li>
</ul></div>
<h5>
-<a name="math_toolkit.status.issues.h5"></a>
+<a name="math_toolkit.status.issues.h6"></a>
<span class="phrase"><a name="math_toolkit.status.issues.owen_s_t_function"></a></span><a class="link" href="issues.html#math_toolkit.status.issues.owen_s_t_function">Owen's
T Function</a>
</h5>
@@ -145,7 +160,7 @@
but it remains elusive at present.
</p>
<h5>
-<a name="math_toolkit.status.issues.h6"></a>
+<a name="math_toolkit.status.issues.h7"></a>
<span class="phrase"><a name="math_toolkit.status.issues.jocobi_elliptic_functions"></a></span><a class="link" href="issues.html#math_toolkit.status.issues.jocobi_elliptic_functions">Jocobi elliptic
functions</a>
</h5>
@@ -154,7 +169,7 @@
these.
</p>
<h5>
-<a name="math_toolkit.status.issues.h7"></a>
+<a name="math_toolkit.status.issues.h8"></a>
<span class="phrase"><a name="math_toolkit.status.issues.statistical_distributions"></a></span><a class="link" href="issues.html#math_toolkit.status.issues.statistical_distributions">Statistical
distributions</a>
</h5>
@@ -163,7 +178,7 @@
for very large degrees of freedom?
</li></ul></div>
<h5>
-<a name="math_toolkit.status.issues.h8"></a>
+<a name="math_toolkit.status.issues.h9"></a>
<span class="phrase"><a name="math_toolkit.status.issues.feature_requests"></a></span><a class="link" href="issues.html#math_toolkit.status.issues.feature_requests">Feature
Requests</a>
</h5>
Modified: trunk/libs/math/doc/sf_and_dist/html/math_toolkit/using_udt/high_precision/using_test.html
==============================================================================
--- trunk/libs/math/doc/sf_and_dist/html/math_toolkit/using_udt/high_precision/using_test.html (original)
+++ trunk/libs/math/doc/sf_and_dist/html/math_toolkit/using_udt/high_precision/using_test.html 2013-03-21 09:01:50 EDT (Thu, 21 Mar 2013)
@@ -65,7 +65,7 @@
with <code class="computeroutput"><span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">et_off</span></code>, an enumerated type.
</p>
<pre class="programlisting"><span class="keyword">typedef</span> <span class="identifier">boost</span><span class="special">::</span><span class="identifier">multiprecision</span><span class="special">::</span><span class="identifier">number</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_dec_float</span><span class="special"><</span><span class="number">50</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">et_off</span><span class="special">></span>
-<span class="identifier">cpp_dec_float_50_noet</span><span class="special">;</span><span class="error">`</span>
+<span class="identifier">cpp_dec_float_50_noet</span><span class="special">;</span>
</pre>
<p>
You can reduce typing with a <code class="computeroutput"><span class="keyword">using</span></code>
@@ -101,8 +101,8 @@
<span class="identifier">std</span><span class="special">::</span><span class="identifier">cout</span> <span class="special"><<</span><span class="string">"a = "</span> <span class="special"><<</span> <span class="identifier">a</span> <span class="special"><<</span> <span class="string">",\nb = "</span> <span class="special"><<</span> <span class="identifier">b</span> <span class="special"><<</span> <span class="string">",\neps = "</span> <span class="special"><<</span> <span class="identifier">eps</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">BOOST_CHECK_CLOSE</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">eps</span><span class="special">);</span> <span class="comment">// Expected to pass (because tolerance is as percent).</span>
- <span class="identifier">BOOST_CHECK_CLOSE_FRACTION</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">eps</span><span class="special">);</span> <span class="comment">// Expected to fail.</span>
+ <span class="identifier">BOOST_CHECK_CLOSE</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">eps</span> <span class="special">*</span> <span class="number">100</span><span class="special">);</span> <span class="comment">// Expected to pass (because tolerance is as percent).</span>
+ <span class="identifier">BOOST_CHECK_CLOSE_FRACTION</span><span class="special">(</span><span class="identifier">a</span><span class="special">,</span> <span class="identifier">b</span><span class="special">,</span> <span class="identifier">eps</span><span class="special">);</span> <span class="comment">// Expected to pass (because tolerance is as fraction).</span>
</pre>
<p>
</p>
Modified: trunk/libs/math/doc/sf_and_dist/roadmap.qbk
==============================================================================
--- trunk/libs/math/doc/sf_and_dist/roadmap.qbk (original)
+++ trunk/libs/math/doc/sf_and_dist/roadmap.qbk 2013-03-21 09:01:50 EDT (Thu, 21 Mar 2013)
@@ -17,6 +17,10 @@
* Fixed bug in __tgamma that caused spurious overflow for arguments between 142.5 and 143.
* Fixed bug in raise_rounding_error that caused it to return an incorrect result when throwing an exception is turned off [@https://svn.boost.org/trac/boost/ticket/7905 #7905].
* Added minimal __float128 support.
+* Fixed bug in edge-cases of poisson quantile [@https://svn.boost.org/trac/boost/ticket/8308 #8308].
+* Adjusted heuristics used in Halley iteration to cope with inverting the incomplete beta in tricky regions
+where the derivative is flatlining. Example is computing the quantile of the Fisher F distribution for probabilities
+smaller than machine epsilon. See ticket [@https://svn.boost.org/trac/boost/ticket/8314 #8314].
[h4 Boost-1.53]
Modified: trunk/libs/math/test/test_poisson.cpp
==============================================================================
--- trunk/libs/math/test/test_poisson.cpp (original)
+++ trunk/libs/math/test/test_poisson.cpp 2013-03-21 09:01:50 EDT (Thu, 21 Mar 2013)
@@ -146,6 +146,26 @@
static_cast<RealType>(-1)), // bad probability.
std::domain_error);
+ BOOST_CHECK_THROW(
+ quantile(poisson_distribution<RealType>(static_cast<RealType>(1)),
+ static_cast<RealType>(1)), // bad probability.
+ std::overflow_error);
+
+ BOOST_CHECK_THROW(
+ quantile(complement(poisson_distribution<RealType>(static_cast<RealType>(1)),
+ static_cast<RealType>(0))), // bad probability.
+ std::overflow_error);
+
+ BOOST_CHECK_EQUAL(
+ quantile(poisson_distribution<RealType>(static_cast<RealType>(1)),
+ static_cast<RealType>(0)), // bad probability.
+ 0);
+
+ BOOST_CHECK_EQUAL(
+ quantile(complement(poisson_distribution<RealType>(static_cast<RealType>(1)),
+ static_cast<RealType>(1))), // bad probability.
+ 0);
+
// Check some test values.
BOOST_CHECK_CLOSE( // mode
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk