1 <?xml version="1.0" encoding="UTF-8"?>
3 * Scilab ( http://www.scilab.org/ ) - This file is part of Scilab
4 * Copyright (C) 2008 - INRIA
6 * This file must be used under the terms of the CeCILL.
7 * This source file is licensed as described in the file COPYING, which
8 * you should have received as part of this distribution. The terms
9 * are also available at
10 * http://www.cecill.info/licences/Licence_CeCILL_V2-en.txt
13 <refentry xmlns="http://docbook.org/ns/docbook" xmlns:xlink="http://www.w3.org/1999/xlink" xmlns:svg="http://www.w3.org/2000/svg" xmlns:ns4="http://www.w3.org/1999/xhtml" xmlns:mml="http://www.w3.org/1998/Math/MathML" xmlns:db="http://docbook.org/ns/docbook" xmlns:scilab="http://www.scilab.org" version="5.0-subset Scilab" xml:id="bessel" xml:lang="en">
14 <refnamediv xml:id="besseli">
15 <refname>besseli</refname>
16 <refpurpose>Modified Bessel functions of the first kind (I sub
20 <refnamediv xml:id="besselj">
21 <refname>besselj</refname>
22 <refpurpose>Bessel functions of the first kind (J sub alpha).</refpurpose>
24 <refnamediv xml:id="besselk">
25 <refname>besselk</refname>
26 <refpurpose>Modified Bessel functions of the second kind (K sub
30 <refnamediv xml:id="bessely">
31 <refname>bessely</refname>
32 <refpurpose>Bessel functions of the second kind (Y sub
36 <refnamediv xml:id="besselh">
37 <refname>besselh</refname>
38 <refpurpose>Bessel functions of the third kind (aka Hankel
43 <title>Calling Sequence</title>
44 <synopsis>y = besseli(alpha,x [,ice])
45 y = besselj(alpha,x [,ice])
46 y = besselk(alpha,x [,ice])
47 y = bessely(alpha,x [,ice])
49 y = besselh(alpha,K,x [,ice])
53 <title>Arguments</title>
58 <para>real or complex vector.</para>
64 <para>real vector</para>
70 <para>integer flag, with default value 0</para>
76 <para>integer, with possible values 1 or 2, the Hankel function
84 <title>Description</title>
88 <literal>besseli(alpha,x)</literal> computes modified Bessel
89 functions of the first kind (I sub alpha), for real order
90 <literal>alpha</literal> and argument <literal>x</literal>.
91 <literal>besseli(alpha,x,1)</literal> computes
92 <literal>besseli(alpha,x).*exp(-abs(real(x)))</literal>.
97 <literal>besselj(alpha,x)</literal> computes Bessel functions of
98 the first kind (J sub alpha), for real order <literal>alpha</literal>
99 and argument <literal>x</literal>.
100 <literal>besselj(alpha,x,1)</literal> computes
101 <literal>besselj(alpha,x).*exp(-abs(imag(x)))</literal>.
106 <literal>besselk(alpha,x)</literal> computes modified Bessel
107 functions of the second kind (K sub alpha), for real order
108 <literal>alpha</literal> and argument <literal>x</literal>.
109 <literal>besselk(alpha,x,1)</literal> computes
110 <literal>besselk(alpha,x).*exp(x)</literal>.
115 <literal>bessely(alpha,x)</literal> computes Bessel functions of
116 the second kind (Y sub alpha), for real order <literal>alpha</literal>
117 and argument <literal>x</literal>.
118 <literal>bessely(alpha,x,1)</literal> computes
119 <literal>bessely(alpha,x).*exp(-abs(imag(x)))</literal>.
124 <literal>besselh(alpha [,K] ,x)</literal> computes Bessel
125 functions of the third kind (Hankel function H1 or H2 depending on
126 <literal>K</literal>), for real order <literal>alpha</literal> and
127 argument <literal>x</literal>. If omitted <literal>K</literal> is
128 supposed to be equal to 1. <literal>besselh(alpha,1,x,1)</literal>
129 computes <literal>besselh(alpha,1,x).*exp(-%i*x)</literal> and
130 <literal>besselh(alpha,2,x,1)</literal> computes
131 <literal>besselh(alpha,2,x).*exp(%i*x)</literal>
137 <title>Remarks</title>
139 If <literal>alpha</literal> and <literal>x</literal> are arrays of
140 the same size, the result <literal>y</literal> is also that size. If
141 either input is a scalar, it is expanded to the other input's size. If one
142 input is a row vector and the other is a column vector, the
143 result<literal>y</literal> is a two-dimensional table of function
146 <para>Y_alpha and J_alpha Bessel functions are 2 independent solutions of
147 the Bessel 's differential equation :
152 <imagedata align="center" fileref="../mml/bessel_equation1.mml"/>
156 <para>K_alpha and I_alpha modified Bessel functions are 2 independant
157 solutions of the modified Bessel 's differential equation :
162 <imagedata align="center" fileref="../mml/bessel_equation2.mml"/>
166 <para>H^1_alpha and H^2_alpha, the Hankel functions of first and second
167 kind, are linear linear combinations of Bessel functions of the first and
173 <imagedata align="center" fileref="../mml/bessel_equation3.mml"/>
179 <title>Examples</title>
180 <programlisting role="example"><![CDATA[
182 // ==================
183 x = linspace(0.01,10,5000)';
186 plot2d(x,besseli(0:4,x), style=2:6)
187 legend('I'+string(0:4),2);
188 xtitle("Some modified Bessel functions of the first kind")
190 plot2d(x,besseli(0:4,x,1), style=2:6)
191 legend('I'+string(0:4),1);
192 xtitle("Some modified scaled Bessel functions of the first kind")
196 x = linspace(0.01,10,5000)';
199 plot2d(x,besseli(0:4,x), style=2:6)
200 legend('I'+string(0:4),2);
201 xtitle("Some modified Bessel functions of the first kind")
203 plot2d(x,besseli(0:4,x,1), style=2:6)
204 legend('I'+string(0:4),1);
205 xtitle("Some modified scaled Bessel functions of the first kind")
210 <programlisting role="example"><![CDATA[
214 x = linspace(0,40,5000)';
215 plot2d(x,besselj(0:4,x), style=2:6, leg="J0@J1@J2@J3@J4")
216 legend('I'+string(0:4),1);
217 xtitle("Some Bessel functions of the first kind")
221 x = linspace(0,40,5000)';
222 plot2d(x,besselj(0:4,x), style=2:6, leg="J0@J1@J2@J3@J4")
223 legend('I'+string(0:4),1);
224 xtitle("Some Bessel functions of the first kind")
227 <programlisting role="example"><![CDATA[
228 // use the fact that J_(1/2)(x) = sqrt(2/(x pi)) sin(x)
229 // to compare the algorithm of besselj(0.5,x) with a more direct formula
230 x = linspace(0.1,40,5000)';
231 y1 = besselj(0.5, x);
232 y2 = sqrt(2 ./(%pi*x)).*sin(x);
233 er = abs((y1-y2)./y2);
234 ind = find(er < 0 & y2 ~= 0);
238 xtitle("besselj(0.5,x)")
240 plot2d(x(ind), er(ind), style=2, logflag="nl")
241 xtitle("relative error between 2 formulae for besselj(0.5,x)")
244 <scilab:image><![CDATA[
245 x = linspace(0.1,40,5000)';
246 y1 = besselj(0.5, x);
247 y2 = sqrt(2 ./(%pi*x)).*sin(x);
248 er = abs((y1-y2)./y2);
249 ind = find(er < 0 & y2 ~= 0);
253 xtitle("besselj(0.5,x)")
255 plot2d(x(ind), er(ind), style=2, logflag="nl")
256 xtitle("relative error between 2 formulae for besselj(0.5,x)")
259 <programlisting role="example"><![CDATA[
262 x = linspace(0.01,10,5000)';
265 plot2d(x,besselk(0:4,x), style=0:4, rect=[0,0,6,10])
266 legend('K'+string(0:4),1);
267 xtitle("Some modified Bessel functions of the second kind")
269 plot2d(x,besselk(0:4,x,1), style=0:4, rect=[0,0,6,10])
270 legend('K'+string(0:4),1);
271 xtitle("Some modified scaled Bessel functions of the second kind")
275 x = linspace(0.01,10,5000)';
278 plot2d(x,besselk(0:4,x), style=0:4, rect=[0,0,6,10])
279 legend('K'+string(0:4),1);
280 xtitle("Some modified Bessel functions of the second kind")
282 plot2d(x,besselk(0:4,x,1), style=0:4, rect=[0,0,6,10])
283 legend('K'+string(0:4),1);
284 xtitle("Some modified scaled Bessel functions of the second kind")
287 <programlisting role="example"><![CDATA[
290 x = linspace(0.1,40,5000)'; // Y Bessel functions are unbounded for x -> 0+
292 plot2d(x,bessely(0:4,x), style=0:4, rect=[0,-1.5,40,0.6])
293 legend('Y'+string(0:4),4);
294 xtitle("Some Bessel functions of the second kind")
298 x = linspace(0.1,40,5000)'; // Y Bessel functions are unbounded for x -> 0+
300 plot2d(x,bessely(0:4,x), style=0:4, rect=[0,-1.5,40,0.6])
301 legend('Y'+string(0:4),4);
302 xtitle("Some Bessel functions of the second kind")
305 <programlisting role="example"><![CDATA[
308 x=-4:0.025:2; y=-1.5:0.025:1.5;
310 H = besselh(0,1,X+%i*Y);
313 f.color_map=jetcolormap(16);
314 contour2d(x,y,abs(H),0.2:0.2:3.2,strf="034",rect=[-4,-1.5,3,1.5])
315 legends(string(0.2:0.2:3.2),1:16,"ur")
316 xtitle("Level curves of |H1(0,z)|")
320 x=-4:0.025:2; y=-1.5:0.025:1.5;
322 H = besselh(0,1,X+%i*Y);
325 f.color_map=jetcolormap(16);
326 contour2d(x,y,abs(H),0.2:0.2:3.2,strf="034",rect=[-4,-1.5,3,1.5])
327 legends(string(0.2:0.2:3.2),1:16,"ur")
328 xtitle("Level curves of |H1(0,z)|")
333 <title>Used Functions</title>
334 <para>The source codes can be found in SCI/modules/special_functions/src/fortran/slatec and
335 SCI/modules/special_functions/src/fortran
337 <para>Slatec : dbesi.f, zbesi.f, dbesj.f, zbesj.f, dbesk.f, zbesk.f,
338 dbesy.f, zbesy.f, zbesh.f
340 <para>Drivers to extend definition area (Serge Steer INRIA): dbesig.f,
341 zbesig.f, dbesjg.f, zbesjg.f, dbeskg.f, zbeskg.f, dbesyg.f, zbesyg.f,