3 <meta http-equiv=
"Content-Type" content=
"text/html; charset=US-ASCII">
4 <title>Spherical 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.77.1">
7 <link rel=
"home" href=
"../../index.html" title=
"Math Toolkit 2.5.1">
8 <link rel=
"up" href=
"../bessel.html" title=
"Bessel Functions">
9 <link rel=
"prev" href=
"mbessel.html" title=
"Modified Bessel Functions of the First and Second Kinds">
10 <link rel=
"next" href=
"bessel_derivatives.html" title=
"Derivatives of the Bessel Functions">
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=
"mbessel.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_derivatives.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.sph_bessel"></a><a class=
"link" href=
"sph_bessel.html" title=
"Spherical Bessel Functions of the First and Second Kinds">Spherical Bessel Functions
28 of the First and Second Kinds
</a>
29 </h3></div></div></div>
31 <a name=
"math_toolkit.bessel.sph_bessel.h0"></a>
32 <span class=
"phrase"><a name=
"math_toolkit.bessel.sph_bessel.synopsis"></a></span><a class=
"link" href=
"sph_bessel.html#math_toolkit.bessel.sph_bessel.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">sph_bessel
</span><span class=
"special">(
</span><span class=
"keyword">unsigned
</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 15. 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">sph_bessel
</span><span class=
"special">(
</span><span class=
"keyword">unsigned
</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 15. 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">sph_neumann
</span><span class=
"special">(
</span><span class=
"keyword">unsigned
</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 15. 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">sph_neumann
</span><span class=
"special">(
</span><span class=
"keyword">unsigned
</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 15. Policies: Controlling Precision, Error Handling etc">Policy
</a><span class=
"special">&);
</span>
50 <a name=
"math_toolkit.bessel.sph_bessel.h1"></a>
51 <span class=
"phrase"><a name=
"math_toolkit.bessel.sph_bessel.description"></a></span><a class=
"link" href=
"sph_bessel.html#math_toolkit.bessel.sph_bessel.description">Description
</a>
54 The functions
<a class=
"link" href=
"sph_bessel.html" title=
"Spherical Bessel Functions of the First and Second Kinds">sph_bessel
</a>
55 and
<a class=
"link" href=
"sph_bessel.html" title=
"Spherical Bessel Functions of the First and Second Kinds">sph_neumann
</a> return
56 the result of the Spherical Bessel functions of the first and second kinds
60 sph_bessel(v, x) = j
<sub>v
</sub>(x)
63 sph_neumann(v, x) = y
<sub>v
</sub>(x) = n
<sub>v
</sub>(x)
69 <span class=
"inlinemediaobject"><img src=
"../../../equations/sbessel2.svg"></span>
72 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
73 type calculation rules
</em></span></a> for the single argument type T.
76 The final
<a class=
"link" href=
"../../policy.html" title=
"Chapter 15. Policies: Controlling Precision, Error Handling etc">Policy
</a> argument is optional and can
77 be used to control the behaviour of the function: how it handles errors,
78 what level of precision to use etc. Refer to the
<a class=
"link" href=
"../../policy.html" title=
"Chapter 15. Policies: Controlling Precision, Error Handling etc">policy
79 documentation for more details
</a>.
82 The functions return the result of
<a class=
"link" href=
"../error_handling.html#math_toolkit.error_handling.domain_error">domain_error
</a>
83 whenever the result is undefined or complex: this occurs when
<code class=
"computeroutput"><span class=
"identifier">x
</span> <span class=
"special"><</span> <span class=
"number">0</span></code>.
86 The j
<sub>v
</sub>   function is cyclic like J
<sub>v
</sub>   but differs in its behaviour at the origin:
89 <span class=
"inlinemediaobject"><img src=
"../../../graphs/sph_bessel.svg" align=
"middle"></span>
92 Likewise y
<sub>v
</sub>   is also cyclic for large x, but tends to -
∞  
93 for small
<span class=
"emphasis"><em>x
</em></span>:
96 <span class=
"inlinemediaobject"><img src=
"../../../graphs/sph_neumann.svg" align=
"middle"></span>
99 <a name=
"math_toolkit.bessel.sph_bessel.h2"></a>
100 <span class=
"phrase"><a name=
"math_toolkit.bessel.sph_bessel.testing"></a></span><a class=
"link" href=
"sph_bessel.html#math_toolkit.bessel.sph_bessel.testing">Testing
</a>
103 There are two sets of test values: spot values calculated using
<a href=
"http://functions.wolfram.com/" target=
"_top">functions.wolfram.com
</a>,
104 and a much larger set of tests computed using a simplified version of this
105 implementation (with all the special case handling removed).
108 <a name=
"math_toolkit.bessel.sph_bessel.h3"></a>
109 <span class=
"phrase"><a name=
"math_toolkit.bessel.sph_bessel.accuracy"></a></span><a class=
"link" href=
"sph_bessel.html#math_toolkit.bessel.sph_bessel.accuracy">Accuracy
</a>
112 <a name=
"math_toolkit.bessel.sph_bessel.table_sph_bessel"></a><p class=
"title"><b>Table
 6.48.
 Error rates for sph_bessel
</b></p>
113 <div class=
"table-contents"><table class=
"table" summary=
"Error rates for sph_bessel">
126 Microsoft Visual C++ version
12.0<br> Win32
<br> double
131 GNU C++ version
5.1.0<br> linux
<br> long double
136 GNU C++ version
5.1.0<br> linux
<br> double
141 Sun compiler version
0x5130<br> Sun Solaris
<br> long double
148 Bessel j: Random Data
153 <span class=
"blue">Max =
245ε (Mean =
16.3ε)
</span>
158 <span class=
"blue">Max =
243ε (Mean =
13.3ε)
</span><br> <br>
159 (
<span class=
"emphasis"><em><tr1/cmath
>:
</em></span> Max =
1.91e+06ε (Mean =
165 <span class=
"blue">Max =
0.978ε (Mean =
0.0539ε)
</span><br>
166 <br> (
<span class=
"emphasis"><em>GSL
1.16:
</em></span> Max =
1.79e+03ε (Mean =
107ε))
171 <span class=
"blue">Max =
243ε (Mean =
33.7ε)
</span>
177 <br class=
"table-break"><div class=
"table">
178 <a name=
"math_toolkit.bessel.sph_bessel.table_sph_neumann"></a><p class=
"title"><b>Table
 6.49.
 Error rates for sph_neumann
</b></p>
179 <div class=
"table-contents"><table class=
"table" summary=
"Error rates for sph_neumann">
192 Microsoft Visual C++ version
12.0<br> Win32
<br> double
197 GNU C++ version
5.1.0<br> linux
<br> double
202 GNU C++ version
5.1.0<br> linux
<br> long double
207 Sun compiler version
0x5130<br> Sun Solaris
<br> long double
219 <span class=
"blue">Max =
281ε (Mean =
31.1ε)
</span>
224 <span class=
"blue">Max =
0.995ε (Mean =
0.0665ε)
</span><br>
225 <br> (
<span class=
"emphasis"><em>GSL
1.16:
</em></span> Max =
8.5e+04ε (Mean =
5.33e+03ε))
230 <span class=
"blue">Max =
234ε (Mean =
19.5ε)
</span><br> <br>
231 (
<span class=
"emphasis"><em><tr1/cmath
>:
</em></span> Max =
1.6e+06ε (Mean =
1.4e+05ε))
236 <span class=
"blue">Max =
234ε (Mean =
19.8ε)
</span>
242 <br class=
"table-break"><h5>
243 <a name=
"math_toolkit.bessel.sph_bessel.h4"></a>
244 <span class=
"phrase"><a name=
"math_toolkit.bessel.sph_bessel.implementation"></a></span><a class=
"link" href=
"sph_bessel.html#math_toolkit.bessel.sph_bessel.implementation">Implementation
</a>
247 Other than error handling and a couple of special cases these functions are
248 implemented directly in terms of their definitions:
251 <span class=
"inlinemediaobject"><img src=
"../../../equations/sbessel2.svg"></span>
254 The special cases occur for:
257 j
<sub>0</sub>  =
<a class=
"link" href=
"../sinc/sinc_pi.html" title=
"sinc_pi">sinc_pi
</a>(x) = sin(x)
261 and for small
<span class=
"emphasis"><em>x
< 1</em></span>, we can use the series:
264 <span class=
"inlinemediaobject"><img src=
"../../../equations/sbessel5.svg"></span>
267 which neatly avoids the problem of calculating
0/
0 that can occur with the
268 main definition as x
→ 0.
271 <table xmlns:
rev=
"http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width=
"100%"><tr>
272 <td align=
"left"></td>
273 <td align=
"right"><div class=
"copyright-footer">Copyright
© 2006-
2010,
2012-
2014 Nikhar Agrawal,
274 Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
275 Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R
åde, Gautam Sewani,
276 Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang
<p>
277 Distributed under the Boost Software License, Version
1.0. (See accompanying
278 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>)
283 <div class=
"spirit-nav">
284 <a accesskey=
"p" href=
"mbessel.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_derivatives.html"><img src=
"../../../../../../doc/src/images/next.png" alt=
"Next"></a>