3 <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
4 <title>Bessel Functions of the First and Second Kinds</title>
5 <link rel="stylesheet" href="../../math.css" type="text/css">
6 <meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
7 <link rel="home" href="../../index.html" title="Math Toolkit 2.11.0">
8 <link rel="up" href="../bessel.html" title="Bessel Functions">
9 <link rel="prev" href="bessel_over.html" title="Bessel Function Overview">
10 <link rel="next" href="bessel_root.html" title="Finding Zeros of Bessel Functions of the First and Second Kinds">
12 <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
13 <table cellpadding="2" width="100%"><tr>
14 <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../../boost.png"></td>
15 <td align="center"><a href="../../../../../../index.html">Home</a></td>
16 <td align="center"><a href="../../../../../../libs/libraries.htm">Libraries</a></td>
17 <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
18 <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
19 <td align="center"><a href="../../../../../../more/index.htm">More</a></td>
22 <div class="spirit-nav">
23 <a accesskey="p" href="bessel_over.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../bessel.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="bessel_root.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>
26 <div class="titlepage"><div><div><h3 class="title">
27 <a name="math_toolkit.bessel.bessel_first"></a><a class="link" href="bessel_first.html" title="Bessel Functions of the First and Second Kinds">Bessel Functions of
28 the First and Second Kinds</a>
29 </h3></div></div></div>
31 <a name="math_toolkit.bessel.bessel_first.h0"></a>
32 <span class="phrase"><a name="math_toolkit.bessel.bessel_first.synopsis"></a></span><a class="link" href="bessel_first.html#math_toolkit.bessel.bessel_first.synopsis">Synopsis</a>
35 <code class="computeroutput"><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></code>
37 <pre class="programlisting"><span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">></span>
38 <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">cyl_bessel_j</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">v</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">x</span><span class="special">);</span>
40 <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
41 <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">cyl_bessel_j</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">v</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
43 <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">></span>
44 <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">cyl_neumann</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">v</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">x</span><span class="special">);</span>
46 <span class="keyword">template</span> <span class="special"><</span><span class="keyword">class</span> <span class="identifier">T1</span><span class="special">,</span> <span class="keyword">class</span> <span class="identifier">T2</span><span class="special">,</span> <span class="keyword">class</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">></span>
47 <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>calculated-result-type</em></span></a> <span class="identifier">cyl_neumann</span><span class="special">(</span><span class="identifier">T1</span> <span class="identifier">v</span><span class="special">,</span> <span class="identifier">T2</span> <span class="identifier">x</span><span class="special">,</span> <span class="keyword">const</span> <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&);</span>
50 <a name="math_toolkit.bessel.bessel_first.h1"></a>
51 <span class="phrase"><a name="math_toolkit.bessel.bessel_first.description"></a></span><a class="link" href="bessel_first.html#math_toolkit.bessel.bessel_first.description">Description</a>
54 The functions <a class="link" href="bessel_first.html" title="Bessel Functions of the First and Second Kinds">cyl_bessel_j</a>
55 and <a class="link" href="bessel_first.html" title="Bessel Functions of the First and Second Kinds">cyl_neumann</a> return
56 the result of the Bessel functions of the first and second kinds respectively:
58 <div class="blockquote"><blockquote class="blockquote"><p>
59 <span class="serif_italic">cyl_bessel_j(v, x) = J<sub>v</sub>(x)</span>
60 </p></blockquote></div>
61 <div class="blockquote"><blockquote class="blockquote"><p>
62 <span class="serif_italic">cyl_neumann(v, x) = Y<sub>v</sub>(x) = N<sub>v</sub>(x)</span>
63 </p></blockquote></div>
67 <div class="blockquote"><blockquote class="blockquote"><p>
68 <span class="inlinemediaobject"><img src="../../../equations/bessel2.svg"></span>
70 </p></blockquote></div>
71 <div class="blockquote"><blockquote class="blockquote"><p>
72 <span class="inlinemediaobject"><img src="../../../equations/bessel3.svg"></span>
74 </p></blockquote></div>
76 The return type of these functions is computed using the <a class="link" href="../result_type.html" title="Calculation of the Type of the Result"><span class="emphasis"><em>result
77 type calculation rules</em></span></a> when T1 and T2 are different types.
78 The functions are also optimised for the relatively common case that T1 is
82 The final <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">Policy</a> argument is optional and can
83 be used to control the behaviour of the function: how it handles errors,
84 what level of precision to use etc. Refer to the <a class="link" href="../../policy.html" title="Chapter 20. Policies: Controlling Precision, Error Handling etc">policy
85 documentation for more details</a>.
88 The functions return the result of <a class="link" href="../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>
89 whenever the result is undefined or complex. For <a class="link" href="bessel_first.html" title="Bessel Functions of the First and Second Kinds">cyl_bessel_j</a>
90 this occurs when <code class="computeroutput"><span class="identifier">x</span> <span class="special"><</span>
91 <span class="number">0</span></code> and v is not an integer, or when
92 <code class="computeroutput"><span class="identifier">x</span> <span class="special">==</span>
93 <span class="number">0</span></code> and <code class="computeroutput"><span class="identifier">v</span>
94 <span class="special">!=</span> <span class="number">0</span></code>.
95 For <a class="link" href="bessel_first.html" title="Bessel Functions of the First and Second Kinds">cyl_neumann</a> this
96 occurs when <code class="computeroutput"><span class="identifier">x</span> <span class="special"><=</span>
97 <span class="number">0</span></code>.
100 The following graph illustrates the cyclic nature of J<sub>v</sub>:
102 <div class="blockquote"><blockquote class="blockquote"><p>
103 <span class="inlinemediaobject"><img src="../../../graphs/cyl_bessel_j.svg" align="middle"></span>
105 </p></blockquote></div>
107 The following graph shows the behaviour of Y<sub>v</sub>: this is also cyclic for large
108 <span class="emphasis"><em>x</em></span>, but tends to -∞ for small <span class="emphasis"><em>x</em></span>:
110 <div class="blockquote"><blockquote class="blockquote"><p>
111 <span class="inlinemediaobject"><img src="../../../graphs/cyl_neumann.svg" align="middle"></span>
113 </p></blockquote></div>
115 <a name="math_toolkit.bessel.bessel_first.h2"></a>
116 <span class="phrase"><a name="math_toolkit.bessel.bessel_first.testing"></a></span><a class="link" href="bessel_first.html#math_toolkit.bessel.bessel_first.testing">Testing</a>
119 There are two sets of test values: spot values calculated using <a href="http://functions.wolfram.com" target="_top">functions.wolfram.com</a>,
120 and a much larger set of tests computed using a simplified version of this
121 implementation (with all the special case handling removed).
124 <a name="math_toolkit.bessel.bessel_first.h3"></a>
125 <span class="phrase"><a name="math_toolkit.bessel.bessel_first.accuracy"></a></span><a class="link" href="bessel_first.html#math_toolkit.bessel.bessel_first.accuracy">Accuracy</a>
128 The following tables show how the accuracy of these functions varies on various
129 platforms, along with comparisons to other libraries. Note that the cyclic
130 nature of these functions means that they have an infinite number of irrational
131 roots: in general these functions have arbitrarily large <span class="emphasis"><em>relative</em></span>
132 errors when the arguments are sufficiently close to a root. Of course the
133 absolute error in such cases is always small. Note that only results for
134 the widest floating-point type on the system are given as narrower types
135 have <a class="link" href="../relative_error.html#math_toolkit.relative_error.zero_error">effectively zero
136 error</a>. All values are relative errors in units of epsilon. Most of
137 the gross errors exhibited by other libraries occur for very large arguments
138 - you will need to drill down into the actual program output if you need
139 more information on this.
142 <a name="math_toolkit.bessel.bessel_first.table_cyl_bessel_j_integer_orders_"></a><p class="title"><b>Table 8.40. Error rates for cyl_bessel_j (integer orders)</b></p>
143 <div class="table-contents"><table class="table" summary="Error rates for cyl_bessel_j (integer orders)">
156 GNU C++ version 7.1.0<br> linux<br> long double
161 GNU C++ version 7.1.0<br> linux<br> double
166 Sun compiler version 0x5150<br> Sun Solaris<br> long double
171 Microsoft Visual C++ version 14.1<br> Win32<br> double
179 Bessel J0: Mathworld Data (Integer Version)
184 <span class="blue">Max = 6.55ε (Mean = 2.86ε)</span><br> <br>
185 (<span class="emphasis"><em><cmath>:</em></span> Max = 5.04ε (Mean = 1.78ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_long_double_cyl_bessel_j_integer_orders___cmath__Bessel_J0_Mathworld_Data_Integer_Version_">And
191 <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
192 2.1:</em></span> Max = 1.12ε (Mean = 0.488ε))<br> (<span class="emphasis"><em>Rmath
193 3.2.3:</em></span> Max = 0.629ε (Mean = 0.223ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_cyl_bessel_j_integer_orders__Rmath_3_2_3_Bessel_J0_Mathworld_Data_Integer_Version_">And
199 <span class="blue">Max = 6.55ε (Mean = 2.86ε)</span>
204 <span class="blue">Max = 2.52ε (Mean = 1.2ε)</span><br> <br>
205 (<span class="emphasis"><em><math.h>:</em></span> Max = 1.89ε (Mean = 0.988ε))
212 Bessel J0: Mathworld Data (Tricky cases) (Integer Version)
217 <span class="blue">Max = 1.64e+08ε (Mean = 6.69e+07ε)</span><br>
218 <br> (<span class="emphasis"><em><cmath>:</em></span> Max = 4.79e+08ε (Mean
224 <span class="blue">Max = 8e+04ε (Mean = 3.27e+04ε)</span><br>
225 <br> (<span class="emphasis"><em>GSL 2.1:</em></span> Max = 1e+07ε (Mean = 4.11e+06ε))<br>
226 (<span class="emphasis"><em>Rmath 3.2.3:</em></span> Max = 1.04e+07ε (Mean = 4.29e+06ε))
231 <span class="blue">Max = 1.64e+08ε (Mean = 6.69e+07ε)</span>
236 <span class="blue">Max = 1e+07ε (Mean = 4.09e+06ε)</span><br>
237 <br> (<span class="emphasis"><em><math.h>:</em></span> <span class="red">Max
238 = 2.54e+08ε (Mean = 1.04e+08ε))</span>
245 Bessel J1: Mathworld Data (Integer Version)
250 <span class="blue">Max = 3.59ε (Mean = 1.33ε)</span><br> <br>
251 (<span class="emphasis"><em><cmath>:</em></span> Max = 6.1ε (Mean = 2.95ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_long_double_cyl_bessel_j_integer_orders___cmath__Bessel_J1_Mathworld_Data_Integer_Version_">And
257 <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
258 2.1:</em></span> Max = 1.89ε (Mean = 0.721ε))<br> (<span class="emphasis"><em>Rmath
259 3.2.3:</em></span> Max = 0.946ε (Mean = 0.39ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_cyl_bessel_j_integer_orders__Rmath_3_2_3_Bessel_J1_Mathworld_Data_Integer_Version_">And
265 <span class="blue">Max = 1.44ε (Mean = 0.637ε)</span>
270 <span class="blue">Max = 1.73ε (Mean = 0.976ε)</span><br> <br>
271 (<span class="emphasis"><em><math.h>:</em></span> Max = 11.4ε (Mean = 4.15ε))
278 Bessel J1: Mathworld Data (tricky cases) (Integer Version)
283 <span class="blue">Max = 2.18e+05ε (Mean = 9.76e+04ε)</span><br>
284 <br> (<span class="emphasis"><em><cmath>:</em></span> Max = 2.15e+06ε (Mean
290 <span class="blue">Max = 106ε (Mean = 47.5ε)</span><br> <br>
291 (<span class="emphasis"><em>GSL 2.1:</em></span> Max = 1.26e+06ε (Mean = 6.28e+05ε))<br>
292 (<span class="emphasis"><em>Rmath 3.2.3:</em></span> Max = 2.93e+06ε (Mean = 1.7e+06ε))
297 <span class="blue">Max = 2.18e+05ε (Mean = 9.76e+04ε)</span>
302 <span class="blue">Max = 3.23e+04ε (Mean = 1.45e+04ε)</span><br>
303 <br> (<span class="emphasis"><em><math.h>:</em></span> Max = 1.44e+07ε (Mean
311 Bessel JN: Mathworld Data (Integer Version)
316 <span class="blue">Max = 6.85ε (Mean = 3.35ε)</span><br> <br>
317 (<span class="emphasis"><em><cmath>:</em></span> <span class="red">Max = 2.13e+19ε (Mean
318 = 5.16e+18ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_long_double_cyl_bessel_j_integer_orders___cmath__Bessel_JN_Mathworld_Data_Integer_Version_">And
319 other failures.</a>)</span>
324 <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
325 2.1:</em></span> Max = 6.9e+05ε (Mean = 2.53e+05ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_cyl_bessel_j_integer_orders__GSL_2_1_Bessel_JN_Mathworld_Data_Integer_Version_">And
326 other failures.</a>)<br> (<span class="emphasis"><em>Rmath 3.2.3:</em></span>
327 <span class="red">Max = +INFε (Mean = +INFε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_cyl_bessel_j_integer_orders__Rmath_3_2_3_Bessel_JN_Mathworld_Data_Integer_Version_">And
328 other failures.</a>)</span>
333 <span class="blue">Max = 463ε (Mean = 112ε)</span>
338 <span class="blue">Max = 14.7ε (Mean = 5.4ε)</span><br> <br>
339 (<span class="emphasis"><em><math.h>:</em></span> <span class="red">Max =
340 +INFε (Mean = +INFε) <a class="link" href="../logs_and_tables/logs.html#errors_Microsoft_Visual_C_version_14_1_Win32_double_cyl_bessel_j_integer_orders___math_h__Bessel_JN_Mathworld_Data_Integer_Version_">And
341 other failures.</a>)</span>
348 <br class="table-break"><div class="table">
349 <a name="math_toolkit.bessel.bessel_first.table_cyl_bessel_j"></a><p class="title"><b>Table 8.41. Error rates for cyl_bessel_j</b></p>
350 <div class="table-contents"><table class="table" summary="Error rates for cyl_bessel_j">
363 GNU C++ version 7.1.0<br> linux<br> long double
368 GNU C++ version 7.1.0<br> linux<br> double
373 Sun compiler version 0x5150<br> Sun Solaris<br> long double
378 Microsoft Visual C++ version 14.1<br> Win32<br> double
386 Bessel J0: Mathworld Data
391 <span class="blue">Max = 6.55ε (Mean = 2.86ε)</span><br> <br>
392 (<span class="emphasis"><em><cmath>:</em></span> Max = 5.04ε (Mean = 1.78ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_long_double_cyl_bessel_j__cmath__Bessel_J0_Mathworld_Data">And
398 <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
399 2.1:</em></span> Max = 0.629ε (Mean = 0.223ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_cyl_bessel_j_GSL_2_1_Bessel_J0_Mathworld_Data">And
400 other failures.</a>)<br> (<span class="emphasis"><em>Rmath 3.2.3:</em></span>
401 Max = 0.629ε (Mean = 0.223ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_cyl_bessel_j_Rmath_3_2_3_Bessel_J0_Mathworld_Data">And
407 <span class="blue">Max = 6.55ε (Mean = 2.86ε)</span>
412 <span class="blue">Max = 2.52ε (Mean = 1.2ε)</span>
419 Bessel J0: Mathworld Data (Tricky cases)
424 <span class="blue">Max = 1.64e+08ε (Mean = 6.69e+07ε)</span><br>
425 <br> (<span class="emphasis"><em><cmath>:</em></span> Max = 4.79e+08ε (Mean
431 <span class="blue">Max = 8e+04ε (Mean = 3.27e+04ε)</span><br>
432 <br> (<span class="emphasis"><em>GSL 2.1:</em></span> Max = 6.5e+07ε (Mean = 2.66e+07ε))<br>
433 (<span class="emphasis"><em>Rmath 3.2.3:</em></span> Max = 1.04e+07ε (Mean = 4.29e+06ε))
438 <span class="blue">Max = 1.64e+08ε (Mean = 6.69e+07ε)</span>
443 <span class="blue">Max = 1e+07ε (Mean = 4.09e+06ε)</span>
450 Bessel J1: Mathworld Data
455 <span class="blue">Max = 3.59ε (Mean = 1.33ε)</span><br> <br>
456 (<span class="emphasis"><em><cmath>:</em></span> Max = 6.1ε (Mean = 2.95ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_long_double_cyl_bessel_j__cmath__Bessel_J1_Mathworld_Data">And
462 <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
463 2.1:</em></span> Max = 6.62ε (Mean = 2.35ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_cyl_bessel_j_GSL_2_1_Bessel_J1_Mathworld_Data">And
464 other failures.</a>)<br> (<span class="emphasis"><em>Rmath 3.2.3:</em></span>
465 Max = 0.946ε (Mean = 0.39ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_cyl_bessel_j_Rmath_3_2_3_Bessel_J1_Mathworld_Data">And
471 <span class="blue">Max = 1.44ε (Mean = 0.637ε)</span>
476 <span class="blue">Max = 1.73ε (Mean = 0.976ε)</span>
483 Bessel J1: Mathworld Data (tricky cases)
488 <span class="blue">Max = 2.18e+05ε (Mean = 9.76e+04ε)</span><br>
489 <br> (<span class="emphasis"><em><cmath>:</em></span> Max = 2.15e+06ε (Mean
495 <span class="blue">Max = 106ε (Mean = 47.5ε)</span><br> <br>
496 (<span class="emphasis"><em>GSL 2.1:</em></span> Max = 8.75e+05ε (Mean = 5.32e+05ε))<br>
497 (<span class="emphasis"><em>Rmath 3.2.3:</em></span> Max = 2.93e+06ε (Mean = 1.7e+06ε))
502 <span class="blue">Max = 2.18e+05ε (Mean = 9.76e+04ε)</span>
507 <span class="blue">Max = 3.23e+04ε (Mean = 1.45e+04ε)</span>
514 Bessel JN: Mathworld Data
519 <span class="blue">Max = 6.85ε (Mean = 3.35ε)</span><br> <br>
520 (<span class="emphasis"><em><cmath>:</em></span> <span class="red">Max = 2.13e+19ε (Mean
521 = 5.16e+18ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_long_double_cyl_bessel_j__cmath__Bessel_JN_Mathworld_Data">And
522 other failures.</a>)</span>
527 <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
528 2.1:</em></span> Max = 6.9e+05ε (Mean = 2.15e+05ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_cyl_bessel_j_GSL_2_1_Bessel_JN_Mathworld_Data">And
529 other failures.</a>)<br> (<span class="emphasis"><em>Rmath 3.2.3:</em></span>
530 <span class="red">Max = +INFε (Mean = +INFε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_cyl_bessel_j_Rmath_3_2_3_Bessel_JN_Mathworld_Data">And
531 other failures.</a>)</span>
536 <span class="blue">Max = 463ε (Mean = 112ε)</span>
541 <span class="blue">Max = 14.7ε (Mean = 5.4ε)</span>
548 Bessel J: Mathworld Data
553 <span class="blue">Max = 14.7ε (Mean = 4.11ε)</span><br> <br>
554 (<span class="emphasis"><em><cmath>:</em></span> Max = 3.49e+05ε (Mean = 8.09e+04ε)
555 <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_long_double_cyl_bessel_j__cmath__Bessel_J_Mathworld_Data">And
561 <span class="blue">Max = 10ε (Mean = 2.24ε)</span><br> <br>
562 (<span class="emphasis"><em>GSL 2.1:</em></span> Max = 2.39e+05ε (Mean = 5.37e+04ε)
563 <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_cyl_bessel_j_GSL_2_1_Bessel_J_Mathworld_Data">And
564 other failures.</a>)<br> (<span class="emphasis"><em>Rmath 3.2.3:</em></span>
565 <span class="red">Max = +INFε (Mean = +INFε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_cyl_bessel_j_Rmath_3_2_3_Bessel_J_Mathworld_Data">And
566 other failures.</a>)</span>
571 <span class="blue">Max = 14.7ε (Mean = 4.22ε)</span>
576 <span class="blue">Max = 14.9ε (Mean = 3.89ε)</span>
583 Bessel J: Mathworld Data (large values)
588 <span class="blue">Max = 607ε (Mean = 305ε)</span><br> <br>
589 (<span class="emphasis"><em><cmath>:</em></span> Max = 34.9ε (Mean = 17.4ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_long_double_cyl_bessel_j__cmath__Bessel_J_Mathworld_Data_large_values_">And
595 <span class="blue">Max = 0.536ε (Mean = 0.268ε)</span><br> <br>
596 (<span class="emphasis"><em>GSL 2.1:</em></span> Max = 4.91e+03ε (Mean = 2.46e+03ε)
597 <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_cyl_bessel_j_GSL_2_1_Bessel_J_Mathworld_Data_large_values_">And
598 other failures.</a>)<br> (<span class="emphasis"><em>Rmath 3.2.3:</em></span>
599 Max = 5.9ε (Mean = 3.76ε))
604 <span class="blue">Max = 607ε (Mean = 305ε)</span>
609 <span class="blue">Max = 9.31ε (Mean = 5.52ε)</span>
616 Bessel JN: Random Data
621 <span class="blue">Max = 50.8ε (Mean = 3.69ε)</span><br> <br>
622 (<span class="emphasis"><em><cmath>:</em></span> Max = 1.12e+03ε (Mean = 88.7ε))
627 <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
628 2.1:</em></span> Max = 75.7ε (Mean = 5.36ε))<br> (<span class="emphasis"><em>Rmath
629 3.2.3:</em></span> Max = 3.93ε (Mean = 1.22ε))
634 <span class="blue">Max = 99.6ε (Mean = 22ε)</span>
639 <span class="blue">Max = 17.5ε (Mean = 1.46ε)</span>
646 Bessel J: Random Data
651 <span class="blue">Max = 11.4ε (Mean = 1.68ε)</span><br> <br>
652 (<span class="emphasis"><em><cmath>:</em></span> Max = 501ε (Mean = 52.3ε))
657 <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
658 2.1:</em></span> Max = 15.5ε (Mean = 3.33ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_cyl_bessel_j_GSL_2_1_Bessel_J_Random_Data">And
659 other failures.</a>)<br> (<span class="emphasis"><em>Rmath 3.2.3:</em></span>
660 Max = 6.74ε (Mean = 1.3ε))
665 <span class="blue">Max = 260ε (Mean = 34ε)</span>
670 <span class="blue">Max = 9.24ε (Mean = 1.17ε)</span>
677 Bessel J: Random Data (Tricky large values)
682 <span class="blue">Max = 785ε (Mean = 94.2ε)</span><br> <br>
683 (<span class="emphasis"><em><cmath>:</em></span> <span class="red">Max = 5.01e+17ε (Mean
684 = 6.23e+16ε))</span>
689 <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
690 2.1:</em></span> Max = 2.48e+05ε (Mean = 5.11e+04ε))<br> (<span class="emphasis"><em>Rmath
691 3.2.3:</em></span> Max = 71.6ε (Mean = 11.7ε))
696 <span class="blue">Max = 785ε (Mean = 97.4ε)</span>
701 <span class="blue">Max = 59.2ε (Mean = 8.67ε)</span>
708 <br class="table-break"><div class="table">
709 <a name="math_toolkit.bessel.bessel_first.table_cyl_neumann_integer_orders_"></a><p class="title"><b>Table 8.42. Error rates for cyl_neumann (integer orders)</b></p>
710 <div class="table-contents"><table class="table" summary="Error rates for cyl_neumann (integer orders)">
723 GNU C++ version 7.1.0<br> linux<br> long double
728 GNU C++ version 7.1.0<br> linux<br> double
733 Sun compiler version 0x5150<br> Sun Solaris<br> long double
738 Microsoft Visual C++ version 14.1<br> Win32<br> double
746 Y0: Mathworld Data (Integer Version)
751 <span class="blue">Max = 5.53ε (Mean = 2.4ε)</span><br> <br>
752 (<span class="emphasis"><em><cmath>:</em></span> Max = 2.05e+05ε (Mean = 6.87e+04ε))
757 <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
758 2.1:</em></span> Max = 6.46ε (Mean = 2.38ε))<br> (<span class="emphasis"><em>Rmath
759 3.2.3:</em></span> Max = 167ε (Mean = 56.5ε))
764 <span class="blue">Max = 5.53ε (Mean = 2.4ε)</span>
769 <span class="blue">Max = 4.61ε (Mean = 2.29ε)</span><br> <br>
770 (<span class="emphasis"><em><math.h>:</em></span> Max = 5.37e+03ε (Mean = 1.81e+03ε))
777 Y1: Mathworld Data (Integer Version)
782 <span class="blue">Max = 6.33ε (Mean = 2.25ε)</span><br> <br>
783 (<span class="emphasis"><em><cmath>:</em></span> Max = 9.71e+03ε (Mean = 4.08e+03ε))
788 <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
789 2.1:</em></span> Max = 1.51ε (Mean = 0.839ε))<br> (<span class="emphasis"><em>Rmath
790 3.2.3:</em></span> Max = 193ε (Mean = 64.4ε))
795 <span class="blue">Max = 6.33ε (Mean = 2.29ε)</span>
800 <span class="blue">Max = 4.75ε (Mean = 1.72ε)</span><br> <br>
801 (<span class="emphasis"><em><math.h>:</em></span> Max = 1.86e+04ε (Mean = 6.2e+03ε))
808 Yn: Mathworld Data (Integer Version)
813 <span class="blue">Max = 55.2ε (Mean = 17.8ε)</span><br> <br>
814 (<span class="emphasis"><em><cmath>:</em></span> <span class="red">Max = 2.2e+20ε (Mean
815 = 6.97e+19ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_long_double_cyl_neumann_integer_orders___cmath__Yn_Mathworld_Data_Integer_Version_">And
816 other failures.</a>)</span>
821 <span class="blue">Max = 0.993ε (Mean = 0.314ε)</span><br> <br>
822 (<span class="emphasis"><em>GSL 2.1:</em></span> Max = 2.41e+05ε (Mean = 7.62e+04ε))<br>
823 (<span class="emphasis"><em>Rmath 3.2.3:</em></span> Max = 1.24e+04ε (Mean = 4e+03ε))
828 <span class="blue">Max = 55.2ε (Mean = 17.8ε)</span>
833 <span class="blue">Max = 35ε (Mean = 11.9ε)</span><br> <br>
834 (<span class="emphasis"><em><math.h>:</em></span> Max = 2.49e+05ε (Mean = 8.14e+04ε))
841 <br class="table-break"><div class="table">
842 <a name="math_toolkit.bessel.bessel_first.table_cyl_neumann"></a><p class="title"><b>Table 8.43. Error rates for cyl_neumann</b></p>
843 <div class="table-contents"><table class="table" summary="Error rates for cyl_neumann">
856 GNU C++ version 7.1.0<br> linux<br> long double
861 GNU C++ version 7.1.0<br> linux<br> double
866 Sun compiler version 0x5150<br> Sun Solaris<br> long double
871 Microsoft Visual C++ version 14.1<br> Win32<br> double
884 <span class="blue">Max = 5.53ε (Mean = 2.4ε)</span><br> <br>
885 (<span class="emphasis"><em><cmath>:</em></span> Max = 2.05e+05ε (Mean = 6.87e+04ε))
890 <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
891 2.1:</em></span> Max = 60.9ε (Mean = 20.4ε))<br> (<span class="emphasis"><em>Rmath
892 3.2.3:</em></span> Max = 167ε (Mean = 56.5ε))
897 <span class="blue">Max = 5.53ε (Mean = 2.4ε)</span>
902 <span class="blue">Max = 4.61ε (Mean = 2.29ε)</span>
914 <span class="blue">Max = 6.33ε (Mean = 2.25ε)</span><br> <br>
915 (<span class="emphasis"><em><cmath>:</em></span> Max = 9.71e+03ε (Mean = 4.08e+03ε))
920 <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
921 2.1:</em></span> Max = 23.4ε (Mean = 8.1ε))<br> (<span class="emphasis"><em>Rmath
922 3.2.3:</em></span> Max = 193ε (Mean = 64.4ε))
927 <span class="blue">Max = 6.33ε (Mean = 2.29ε)</span>
932 <span class="blue">Max = 4.75ε (Mean = 1.72ε)</span>
944 <span class="blue">Max = 55.2ε (Mean = 17.8ε)</span><br> <br>
945 (<span class="emphasis"><em><cmath>:</em></span> <span class="red">Max = 2.2e+20ε (Mean
946 = 6.97e+19ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_long_double_cyl_neumann__cmath__Yn_Mathworld_Data">And
947 other failures.</a>)</span>
952 <span class="blue">Max = 0.993ε (Mean = 0.314ε)</span><br> <br>
953 (<span class="emphasis"><em>GSL 2.1:</em></span> Max = 2.41e+05ε (Mean = 7.62e+04ε)
954 <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_cyl_neumann_GSL_2_1_Yn_Mathworld_Data">And
955 other failures.</a>)<br> (<span class="emphasis"><em>Rmath 3.2.3:</em></span>
956 Max = 1.24e+04ε (Mean = 4e+03ε))
961 <span class="blue">Max = 55.2ε (Mean = 17.8ε)</span>
966 <span class="blue">Max = 35ε (Mean = 11.9ε)</span>
978 <span class="blue">Max = 10.7ε (Mean = 4.93ε)</span><br> <br>
979 (<span class="emphasis"><em><cmath>:</em></span> <span class="red">Max = 3.49e+15ε (Mean
980 = 1.05e+15ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_long_double_cyl_neumann__cmath__Yv_Mathworld_Data">And
981 other failures.</a>)</span>
986 <span class="blue">Max = 10ε (Mean = 3.02ε)</span><br> <br>
987 (<span class="emphasis"><em>GSL 2.1:</em></span> Max = 1.07e+05ε (Mean = 3.22e+04ε)
988 <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_cyl_neumann_GSL_2_1_Yv_Mathworld_Data">And
989 other failures.</a>)<br> (<span class="emphasis"><em>Rmath 3.2.3:</em></span>
990 Max = 243ε (Mean = 73.9ε))
995 <span class="blue">Max = 10.7ε (Mean = 5.1ε)</span>
1000 <span class="blue">Max = 7.89ε (Mean = 3.27ε)</span>
1007 Yv: Mathworld Data (large values)
1012 <span class="blue">Max = 1.7ε (Mean = 1.33ε)</span><br> <br>
1013 (<span class="emphasis"><em><cmath>:</em></span> Max = 43.2ε (Mean = 16.3ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_long_double_cyl_neumann__cmath__Yv_Mathworld_Data_large_values_">And
1014 other failures.</a>)
1019 <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
1020 2.1:</em></span> Max = 60.8ε (Mean = 23ε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_double_cyl_neumann_GSL_2_1_Yv_Mathworld_Data_large_values_">And
1021 other failures.</a>)<br> (<span class="emphasis"><em>Rmath 3.2.3:</em></span>
1022 Max = 0.682ε (Mean = 0.335ε))
1027 <span class="blue">Max = 1.7ε (Mean = 1.33ε)</span>
1032 <span class="blue">Max = 0.682ε (Mean = 0.423ε)</span>
1039 Y0 and Y1: Random Data
1044 <span class="blue">Max = 10.8ε (Mean = 3.04ε)</span><br> <br>
1045 (<span class="emphasis"><em><cmath>:</em></span> Max = 2.59e+03ε (Mean = 500ε))
1050 <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
1051 2.1:</em></span> Max = 34.4ε (Mean = 8.9ε))<br> (<span class="emphasis"><em>Rmath
1052 3.2.3:</em></span> Max = 83ε (Mean = 14.2ε))
1057 <span class="blue">Max = 10.8ε (Mean = 3.04ε)</span>
1062 <span class="blue">Max = 4.17ε (Mean = 1.24ε)</span>
1074 <span class="blue">Max = 338ε (Mean = 27.5ε)</span><br> <br>
1075 (<span class="emphasis"><em><cmath>:</em></span> Max = 4.01e+03ε (Mean = 348ε))
1080 <span class="blue">Max = 0ε (Mean = 0ε)</span><br> <br> (<span class="emphasis"><em>GSL
1081 2.1:</em></span> Max = 500ε (Mean = 47.8ε))<br> (<span class="emphasis"><em>Rmath
1082 3.2.3:</em></span> Max = 691ε (Mean = 67.9ε))
1087 <span class="blue">Max = 338ε (Mean = 27.5ε)</span>
1092 <span class="blue">Max = 117ε (Mean = 10.2ε)</span>
1104 <span class="blue">Max = 2.08e+03ε (Mean = 149ε)</span><br>
1105 <br> (<span class="emphasis"><em><cmath>:</em></span> <span class="red">Max
1106 = +INFε (Mean = +INFε) <a class="link" href="../logs_and_tables/logs.html#errors_GNU_C_version_7_1_0_linux_long_double_cyl_neumann__cmath__Yv_Random_Data">And
1107 other failures.</a>)</span>
1112 <span class="blue">Max = 1.53ε (Mean = 0.102ε)</span><br> <br>
1113 (<span class="emphasis"><em>GSL 2.1:</em></span> Max = 1.41e+06ε (Mean = 7.67e+04ε))<br>
1114 (<span class="emphasis"><em>Rmath 3.2.3:</em></span> Max = 1.79e+05ε (Mean = 9.64e+03ε))
1119 <span class="blue">Max = 2.08e+03ε (Mean = 149ε)</span>
1124 <span class="blue">Max = 1.23e+03ε (Mean = 69.9ε)</span>
1131 <br class="table-break"><p>
1132 Note that for large <span class="emphasis"><em>x</em></span> these functions are largely dependent
1133 on the accuracy of the <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">sin</span></code> and
1134 <code class="computeroutput"><span class="identifier">std</span><span class="special">::</span><span class="identifier">cos</span></code> functions.
1137 Comparison to GSL and <a href="http://www.netlib.org/cephes/" target="_top">Cephes</a>
1138 is interesting: both <a href="http://www.netlib.org/cephes/" target="_top">Cephes</a>
1139 and this library optimise the integer order case - leading to identical results
1140 - simply using the general case is for the most part slightly more accurate
1141 though, as noted by the better accuracy of GSL in the integer argument cases.
1142 This implementation tends to perform much better when the arguments become
1143 large, <a href="http://www.netlib.org/cephes/" target="_top">Cephes</a> in particular
1144 produces some remarkably inaccurate results with some of the test data (no
1145 significant figures correct), and even GSL performs badly with some inputs
1146 to J<sub>v</sub>. Note that by way of double-checking these results, the worst performing
1147 <a href="http://www.netlib.org/cephes/" target="_top">Cephes</a> and GSL cases were
1148 recomputed using <a href="http://functions.wolfram.com" target="_top">functions.wolfram.com</a>,
1149 and the result checked against our test data: no errors in the test data
1153 The following error plot are based on an exhaustive search of the functions
1154 domain for J0 and Y0, MSVC-15.5 at <code class="computeroutput"><span class="keyword">double</span></code>
1155 precision, other compilers and precisions are very similar - the plots simply
1156 illustrate the relatively large errors as you approach a zero, and the very
1157 low errors elsewhere.
1159 <div class="blockquote"><blockquote class="blockquote"><p>
1160 <span class="inlinemediaobject"><img src="../../../graphs/j0__double.svg" align="middle"></span>
1162 </p></blockquote></div>
1163 <div class="blockquote"><blockquote class="blockquote"><p>
1164 <span class="inlinemediaobject"><img src="../../../graphs/y0__double.svg" align="middle"></span>
1166 </p></blockquote></div>
1168 <a name="math_toolkit.bessel.bessel_first.h4"></a>
1169 <span class="phrase"><a name="math_toolkit.bessel.bessel_first.implementation"></a></span><a class="link" href="bessel_first.html#math_toolkit.bessel.bessel_first.implementation">Implementation</a>
1172 The implementation is mostly about filtering off various special cases:
1175 When <span class="emphasis"><em>x</em></span> is negative, then the order <span class="emphasis"><em>v</em></span>
1176 must be an integer or the result is a domain error. If the order is an integer
1177 then the function is odd for odd orders and even for even orders, so we reflect
1178 to <span class="emphasis"><em>x > 0</em></span>.
1181 When the order <span class="emphasis"><em>v</em></span> is negative then the reflection formulae
1182 can be used to move to <span class="emphasis"><em>v > 0</em></span>:
1184 <div class="blockquote"><blockquote class="blockquote"><p>
1185 <span class="inlinemediaobject"><img src="../../../equations/bessel9.svg"></span>
1187 </p></blockquote></div>
1188 <div class="blockquote"><blockquote class="blockquote"><p>
1189 <span class="inlinemediaobject"><img src="../../../equations/bessel10.svg"></span>
1191 </p></blockquote></div>
1193 Note that if the order is an integer, then these formulae reduce to:
1195 <div class="blockquote"><blockquote class="blockquote"><p>
1196 <span class="serif_italic">J<sub>-n</sub> = (-1)<sup>n</sup>J<sub>n</sub></span>
1197 </p></blockquote></div>
1198 <div class="blockquote"><blockquote class="blockquote"><p>
1199 <span class="serif_italic">Y<sub>-n</sub> = (-1)<sup>n</sup>Y<sub>n</sub></span>
1200 </p></blockquote></div>
1202 However, in general, a negative order implies that we will need to compute
1206 When <span class="emphasis"><em>x</em></span> is large compared to the order <span class="emphasis"><em>v</em></span>
1207 then the asymptotic expansions for large <span class="emphasis"><em>x</em></span> in M. Abramowitz
1208 and I.A. Stegun, <span class="emphasis"><em>Handbook of Mathematical Functions</em></span>
1209 9.2.19 are used (these were found to be more reliable than those in A&S
1213 When the order <span class="emphasis"><em>v</em></span> is an integer the method first relates
1214 the result to J<sub>0</sub>, J<sub>1</sub>, Y<sub>0</sub> and Y<sub>1</sub> using either forwards or backwards recurrence
1215 (Miller's algorithm) depending upon which is stable. The values for J<sub>0</sub>, J<sub>1</sub>,
1216 Y<sub>0</sub> and Y<sub>1</sub> are calculated using the rational minimax approximations on root-bracketing
1217 intervals for small <span class="emphasis"><em>|x|</em></span> and Hankel asymptotic expansion
1218 for large <span class="emphasis"><em>|x|</em></span>. The coefficients are from:
1220 <div class="blockquote"><blockquote class="blockquote"><p>
1221 W.J. Cody, <span class="emphasis"><em>ALGORITHM 715: SPECFUN - A Portable FORTRAN Package
1222 of Special Function Routines and Test Drivers</em></span>, ACM Transactions
1223 on Mathematical Software, vol 19, 22 (1993).
1224 </p></blockquote></div>
1228 <div class="blockquote"><blockquote class="blockquote"><p>
1229 J.F. Hart et al, <span class="emphasis"><em>Computer Approximations</em></span>, John Wiley
1230 & Sons, New York, 1968.
1231 </p></blockquote></div>
1233 These approximations are accurate to around 19 decimal digits: therefore
1234 these methods are not used when type T has more than 64 binary digits.
1237 When <span class="emphasis"><em>x</em></span> is smaller than machine epsilon then the following
1238 approximations for Y<sub>0</sub>(x), Y<sub>1</sub>(x), Y<sub>2</sub>(x) and Y<sub>n</sub>(x) can be used (see: <a href="http://functions.wolfram.com/03.03.06.0037.01" target="_top">http://functions.wolfram.com/03.03.06.0037.01</a>,
1239 <a href="http://functions.wolfram.com/03.03.06.0038.01" target="_top">http://functions.wolfram.com/03.03.06.0038.01</a>,
1240 <a href="http://functions.wolfram.com/03.03.06.0039.01" target="_top">http://functions.wolfram.com/03.03.06.0039.01</a>
1241 and <a href="http://functions.wolfram.com/03.03.06.0040.01" target="_top">http://functions.wolfram.com/03.03.06.0040.01</a>):
1243 <div class="blockquote"><blockquote class="blockquote"><p>
1244 <span class="inlinemediaobject"><img src="../../../equations/bessel_y0_small_z.svg"></span>
1246 </p></blockquote></div>
1247 <div class="blockquote"><blockquote class="blockquote"><p>
1248 <span class="inlinemediaobject"><img src="../../../equations/bessel_y1_small_z.svg"></span>
1250 </p></blockquote></div>
1251 <div class="blockquote"><blockquote class="blockquote"><p>
1252 <span class="inlinemediaobject"><img src="../../../equations/bessel_y2_small_z.svg"></span>
1254 </p></blockquote></div>
1255 <div class="blockquote"><blockquote class="blockquote"><p>
1256 <span class="inlinemediaobject"><img src="../../../equations/bessel_yn_small_z.svg"></span>
1258 </p></blockquote></div>
1260 When <span class="emphasis"><em>x</em></span> is small compared to <span class="emphasis"><em>v</em></span> and
1261 <span class="emphasis"><em>v</em></span> is not an integer, then the following series approximation
1262 can be used for Y<sub>v</sub>(x), this is also an area where other approximations are
1263 often too slow to converge to be used (see <a href="http://functions.wolfram.com/03.03.06.0034.01" target="_top">http://functions.wolfram.com/03.03.06.0034.01</a>):
1265 <div class="blockquote"><blockquote class="blockquote"><p>
1266 <span class="inlinemediaobject"><img src="../../../equations/bessel_yv_small_z.svg"></span>
1268 </p></blockquote></div>
1270 When <span class="emphasis"><em>x</em></span> is small compared to <span class="emphasis"><em>v</em></span>,
1271 J<sub>v</sub>x is best computed directly from the series:
1273 <div class="blockquote"><blockquote class="blockquote"><p>
1274 <span class="inlinemediaobject"><img src="../../../equations/bessel2.svg"></span>
1276 </p></blockquote></div>
1278 In the general case we compute J<sub>v</sub> and Y<sub>v</sub> simultaneously.
1281 To get the initial values, let μ = ν - floor(ν + 1/2), then μ is the fractional part
1282 of ν such that |μ| <= 1/2 (we need this for convergence later). The idea
1283 is to calculate J<sub>μ</sub>(x), J<sub>μ+1</sub>(x), Y<sub>μ</sub>(x), Y<sub>μ+1</sub>(x) and use them to obtain J<sub>ν</sub>(x), Y<sub>ν</sub>(x).
1286 The algorithm is called Steed's method, which needs two continued fractions
1287 as well as the Wronskian:
1289 <div class="blockquote"><blockquote class="blockquote"><p>
1290 <span class="inlinemediaobject"><img src="../../../equations/bessel8.svg"></span>
1292 </p></blockquote></div>
1293 <div class="blockquote"><blockquote class="blockquote"><p>
1294 <span class="inlinemediaobject"><img src="../../../equations/bessel11.svg"></span>
1296 </p></blockquote></div>
1297 <div class="blockquote"><blockquote class="blockquote"><p>
1298 <span class="inlinemediaobject"><img src="../../../equations/bessel12.svg"></span>
1300 </p></blockquote></div>
1302 See: F.S. Acton, <span class="emphasis"><em>Numerical Methods that Work</em></span>, The Mathematical
1303 Association of America, Washington, 1997.
1306 The continued fractions are computed using the modified Lentz's method (W.J.
1307 Lentz, <span class="emphasis"><em>Generating Bessel functions in Mie scattering calculations
1308 using continued fractions</em></span>, Applied Optics, vol 15, 668 (1976)).
1309 Their convergence rates depend on <span class="emphasis"><em>x</em></span>, therefore we need
1310 different strategies for large <span class="emphasis"><em>x</em></span> and small <span class="emphasis"><em>x</em></span>:
1312 <div class="blockquote"><blockquote class="blockquote"><p>
1313 <span class="emphasis"><em>x > v</em></span>, CF1 needs O(<span class="emphasis"><em>x</em></span>) iterations
1314 to converge, CF2 converges rapidly
1315 </p></blockquote></div>
1316 <div class="blockquote"><blockquote class="blockquote"><p>
1317 <span class="emphasis"><em>x <= v</em></span>, CF1 converges rapidly, CF2 fails to converge
1318 when <span class="emphasis"><em>x</em></span> <code class="literal">-></code> 0
1319 </p></blockquote></div>
1321 When <span class="emphasis"><em>x</em></span> is large (<span class="emphasis"><em>x</em></span> > 2), both
1322 continued fractions converge (CF1 may be slow for really large <span class="emphasis"><em>x</em></span>).
1323 J<sub>μ</sub>, J<sub>μ+1</sub>, Y<sub>μ</sub>, Y<sub>μ+1</sub> can be calculated by
1325 <div class="blockquote"><blockquote class="blockquote"><p>
1326 <span class="inlinemediaobject"><img src="../../../equations/bessel13.svg"></span>
1328 </p></blockquote></div>
1332 <div class="blockquote"><blockquote class="blockquote"><p>
1333 <span class="inlinemediaobject"><img src="../../../equations/bessel14.svg"></span>
1335 </p></blockquote></div>
1337 J<sub>ν</sub> and Y<sub>μ</sub> are then calculated using backward (Miller's algorithm) and forward
1338 recurrence respectively.
1341 When <span class="emphasis"><em>x</em></span> is small (<span class="emphasis"><em>x</em></span> <= 2), CF2
1342 convergence may fail (but CF1 works very well). The solution here is Temme's
1345 <div class="blockquote"><blockquote class="blockquote"><p>
1346 <span class="inlinemediaobject"><img src="../../../equations/bessel15.svg"></span>
1348 </p></blockquote></div>
1352 <div class="blockquote"><blockquote class="blockquote"><p>
1353 <span class="inlinemediaobject"><img src="../../../equations/bessel16.svg"></span>
1355 </p></blockquote></div>
1357 g<sub>k</sub> and h<sub>k</sub>
1358 are also computed by recursions (involving gamma functions), but
1359 the formulas are a little complicated, readers are refered to N.M. Temme,
1360 <span class="emphasis"><em>On the numerical evaluation of the ordinary Bessel function of
1361 the second kind</em></span>, Journal of Computational Physics, vol 21, 343
1362 (1976). Note Temme's series converge only for |μ| <= 1/2.
1365 As the previous case, Y<sub>ν</sub> is calculated from the forward recurrence, so is Y<sub>ν+1</sub>.
1366 With these two values and f<sub>ν</sub>, the Wronskian yields J<sub>ν</sub>(x) directly without backward
1370 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
1371 <td align="left"></td>
1372 <td align="right"><div class="copyright-footer">Copyright © 2006-2019 Nikhar
1373 Agrawal, Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos,
1374 Hubert Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Matthew Pulver, Johan
1375 Råde, Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg,
1376 Daryle Walker and Xiaogang Zhang<p>
1377 Distributed under the Boost Software License, Version 1.0. (See accompanying
1378 file LICENSE_1_0.txt or copy at <a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
1383 <div class="spirit-nav">
1384 <a accesskey="p" href="bessel_over.html"><img src="../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../bessel.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="bessel_root.html"><img src="../../../../../../doc/src/images/next.png" alt="Next"></a>