Imported Upstream version 1.72.0
[platform/upstream/boost.git] / libs / math / doc / html / math_toolkit / bessel / sph_bessel.html
1 <html>
2 <head>
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.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="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">
11 </head>
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>
20 </tr></table>
21 <hr>
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>
24 </div>
25 <div class="section">
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>
30 <h5>
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>
33       </h5>
34 <p>
35         <code class="computeroutput"><span class="preprocessor">#include</span> <span class="special">&lt;</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">&gt;</span></code>
36       </p>
37 <pre class="programlisting"><span class="keyword">template</span> <span class="special">&lt;</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">&gt;</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>
39
40 <span class="keyword">template</span> <span class="special">&lt;</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&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</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&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
42
43 <span class="keyword">template</span> <span class="special">&lt;</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">&gt;</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>
45
46 <span class="keyword">template</span> <span class="special">&lt;</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&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&gt;</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&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a><span class="special">&amp;);</span>
48 </pre>
49 <h5>
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>
52       </h5>
53 <p>
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
57         respectively:
58       </p>
59 <div class="blockquote"><blockquote class="blockquote"><p>
60           sph_bessel(v, x) = j<sub>v</sub>(x)
61         </p></blockquote></div>
62 <div class="blockquote"><blockquote class="blockquote"><p>
63           sph_neumann(v, x) = y<sub>v</sub>(x) = n<sub>v</sub>(x)
64         </p></blockquote></div>
65 <p>
66         where:
67       </p>
68 <div class="blockquote"><blockquote class="blockquote"><p>
69           <span class="inlinemediaobject"><img src="../../../equations/sbessel2.svg"></span>
70
71         </p></blockquote></div>
72 <p>
73         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
74         type calculation rules</em></span></a> for the single argument type T.
75       </p>
76 <p>
77         The final <a class="link" href="../../policy.html" title="Chapter&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">Policy</a> argument is optional and can
78         be used to control the behaviour of the function: how it handles errors,
79         what level of precision to use etc. Refer to the <a class="link" href="../../policy.html" title="Chapter&#160;20.&#160;Policies: Controlling Precision, Error Handling etc">policy
80         documentation for more details</a>.
81       </p>
82 <p>
83         The functions return the result of <a class="link" href="../error_handling.html#math_toolkit.error_handling.domain_error">domain_error</a>
84         whenever the result is undefined or complex: this occurs when <code class="computeroutput"><span class="identifier">x</span> <span class="special">&lt;</span> <span class="number">0</span></code>.
85       </p>
86 <p>
87         The j<sub>v</sub> function is cyclic like J<sub>v</sub> but differs in its behaviour at the origin:
88       </p>
89 <div class="blockquote"><blockquote class="blockquote"><p>
90           <span class="inlinemediaobject"><img src="../../../graphs/sph_bessel.svg" align="middle"></span>
91
92         </p></blockquote></div>
93 <p>
94         Likewise y<sub>v</sub> is also cyclic for large x, but tends to -&#8734;
95 for small <span class="emphasis"><em>x</em></span>:
96       </p>
97 <div class="blockquote"><blockquote class="blockquote"><p>
98           <span class="inlinemediaobject"><img src="../../../graphs/sph_neumann.svg" align="middle"></span>
99
100         </p></blockquote></div>
101 <h5>
102 <a name="math_toolkit.bessel.sph_bessel.h2"></a>
103         <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>
104       </h5>
105 <p>
106         There are two sets of test values: spot values calculated using <a href="http://functions.wolfram.com/" target="_top">functions.wolfram.com</a>,
107         and a much larger set of tests computed using a simplified version of this
108         implementation (with all the special case handling removed).
109       </p>
110 <h5>
111 <a name="math_toolkit.bessel.sph_bessel.h3"></a>
112         <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>
113       </h5>
114 <div class="table">
115 <a name="math_toolkit.bessel.sph_bessel.table_sph_bessel"></a><p class="title"><b>Table&#160;8.48.&#160;Error rates for sph_bessel</b></p>
116 <div class="table-contents"><table class="table" summary="Error rates for sph_bessel">
117 <colgroup>
118 <col>
119 <col>
120 <col>
121 <col>
122 <col>
123 </colgroup>
124 <thead><tr>
125 <th>
126               </th>
127 <th>
128                 <p>
129                   GNU C++ version 7.1.0<br> linux<br> long double
130                 </p>
131               </th>
132 <th>
133                 <p>
134                   GNU C++ version 7.1.0<br> linux<br> double
135                 </p>
136               </th>
137 <th>
138                 <p>
139                   Sun compiler version 0x5150<br> Sun Solaris<br> long double
140                 </p>
141               </th>
142 <th>
143                 <p>
144                   Microsoft Visual C++ version 14.1<br> Win32<br> double
145                 </p>
146               </th>
147 </tr></thead>
148 <tbody><tr>
149 <td>
150                 <p>
151                   Bessel j: Random Data
152                 </p>
153               </td>
154 <td>
155                 <p>
156                   <span class="blue">Max = 243&#949; (Mean = 13.3&#949;)</span><br> <br>
157                   (<span class="emphasis"><em>&lt;cmath&gt;:</em></span> Max = 1.91e+06&#949; (Mean = 1.09e+05&#949;))
158                 </p>
159               </td>
160 <td>
161                 <p>
162                   <span class="blue">Max = 0.978&#949; (Mean = 0.0445&#949;)</span><br>
163                   <br> (<span class="emphasis"><em>GSL 2.1:</em></span> Max = 1.79e+03&#949; (Mean = 107&#949;))
164                 </p>
165               </td>
166 <td>
167                 <p>
168                   <span class="blue">Max = 243&#949; (Mean = 33.7&#949;)</span>
169                 </p>
170               </td>
171 <td>
172                 <p>
173                   <span class="blue">Max = 245&#949; (Mean = 16.3&#949;)</span>
174                 </p>
175               </td>
176 </tr></tbody>
177 </table></div>
178 </div>
179 <br class="table-break"><div class="table">
180 <a name="math_toolkit.bessel.sph_bessel.table_sph_neumann"></a><p class="title"><b>Table&#160;8.49.&#160;Error rates for sph_neumann</b></p>
181 <div class="table-contents"><table class="table" summary="Error rates for sph_neumann">
182 <colgroup>
183 <col>
184 <col>
185 <col>
186 <col>
187 <col>
188 </colgroup>
189 <thead><tr>
190 <th>
191               </th>
192 <th>
193                 <p>
194                   GNU C++ version 7.1.0<br> linux<br> long double
195                 </p>
196               </th>
197 <th>
198                 <p>
199                   GNU C++ version 7.1.0<br> linux<br> double
200                 </p>
201               </th>
202 <th>
203                 <p>
204                   Sun compiler version 0x5150<br> Sun Solaris<br> long double
205                 </p>
206               </th>
207 <th>
208                 <p>
209                   Microsoft Visual C++ version 14.1<br> Win32<br> double
210                 </p>
211               </th>
212 </tr></thead>
213 <tbody><tr>
214 <td>
215                 <p>
216                   y: Random Data
217                 </p>
218               </td>
219 <td>
220                 <p>
221                   <span class="blue">Max = 234&#949; (Mean = 19.5&#949;)</span><br> <br>
222                   (<span class="emphasis"><em>&lt;cmath&gt;:</em></span> Max = 1.6e+06&#949; (Mean = 1.4e+05&#949;))
223                 </p>
224               </td>
225 <td>
226                 <p>
227                   <span class="blue">Max = 0.995&#949; (Mean = 0.0665&#949;)</span><br>
228                   <br> (<span class="emphasis"><em>GSL 2.1:</em></span> Max = 8.5e+04&#949; (Mean = 5.33e+03&#949;))
229                 </p>
230               </td>
231 <td>
232                 <p>
233                   <span class="blue">Max = 234&#949; (Mean = 19.8&#949;)</span>
234                 </p>
235               </td>
236 <td>
237                 <p>
238                   <span class="blue">Max = 281&#949; (Mean = 31.1&#949;)</span>
239                 </p>
240               </td>
241 </tr></tbody>
242 </table></div>
243 </div>
244 <br class="table-break"><h5>
245 <a name="math_toolkit.bessel.sph_bessel.h4"></a>
246         <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       </h5>
248 <p>
249         Other than error handling and a couple of special cases these functions are
250         implemented directly in terms of their definitions:
251       </p>
252 <div class="blockquote"><blockquote class="blockquote"><p>
253           <span class="inlinemediaobject"><img src="../../../equations/sbessel2.svg"></span>
254
255         </p></blockquote></div>
256 <p>
257         The special cases occur for:
258       </p>
259 <div class="blockquote"><blockquote class="blockquote"><p>
260           j<sub>0</sub>= <a class="link" href="../sinc/sinc_pi.html" title="sinc_pi">sinc_pi</a>(x) = sin(x)
261           / x
262         </p></blockquote></div>
263 <p>
264         and for small <span class="emphasis"><em>x &lt; 1</em></span>, we can use the series:
265       </p>
266 <div class="blockquote"><blockquote class="blockquote"><p>
267           <span class="inlinemediaobject"><img src="../../../equations/sbessel5.svg"></span>
268
269         </p></blockquote></div>
270 <p>
271         which neatly avoids the problem of calculating 0/0 that can occur with the
272         main definition as x &#8594; 0.
273       </p>
274 </div>
275 <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
276 <td align="left"></td>
277 <td align="right"><div class="copyright-footer">Copyright &#169; 2006-2019 Nikhar
278       Agrawal, Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos,
279       Hubert Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Matthew Pulver, Johan
280       R&#229;de, Gautam Sewani, Benjamin Sobotta, Nicholas Thompson, Thijs van den Berg,
281       Daryle Walker and Xiaogang Zhang<p>
282         Distributed under the Boost Software License, Version 1.0. (See accompanying
283         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>)
284       </p>
285 </div></td>
286 </tr></table>
287 <hr>
288 <div class="spirit-nav">
289 <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>
290 </div>
291 </body>
292 </html>