3 * Bessel function of integer order
10 * long double x, y, jnl();
18 * Returns Bessel function of order n, where n is a
19 * (possibly negative) integer.
21 * The ratio of jn(x) to j0(x) is computed by backward
22 * recurrence. First the ratio jn/jn-1 is found by a
23 * continued fraction expansion. Then the recurrence
24 * relating successive orders is applied until j0 or j1 is
27 * If n = 0 or 1 the routine for j0 or j1 is called
35 * arithmetic domain # trials peak rms
36 * IEEE -30, 30 5000 3.3e-19 4.7e-20
39 * Not suitable for large n or x.
44 Cephes Math Library Release 2.0: April, 1987
45 Copyright 1984, 1987 by Stephen L. Moshier
46 Direct inquiries to 30 Frost Street, Cambridge, MA 02140
50 extern long double MACHEPL;
52 extern long double fabsl ( long double );
53 extern long double j0l ( long double );
54 extern long double j1l ( long double );
56 long double fabsl(), j0l(), j1l();
59 long double jnl( n, x )
63 long double pkm2, pkm1, pk, xk, r, ans;
69 if( (n & 1) == 0 ) /* -1**n */
86 return( sign * j0l(x) );
88 return( sign * j1l(x) );
90 return( sign * (2.0L * j1l(x) / x - j0l(x)) );
95 /* continued fraction */
109 /* backward recurrence */
118 pkm2 = (pkm1 * r - pk * x) / x;
125 if( fabsl(pk) > fabsl(pkm1) )
129 return( sign * ans );