3 * Modified Bessel function of noninteger order
9 * float v, x, y, ivf();
17 * Returns modified Bessel function of order v of the
18 * argument. If x is negative, v must be integer valued.
20 * The function is defined as Iv(x) = Jv( ix ). It is
21 * here computed in terms of the confluent hypergeometric
22 * function, according to the formula
25 * Iv(x) = (x/2) e hyperg( v+0.5, 2v+1, 2x ) / gamma(v+1)
27 * If v is a negative integer, then v is replaced by -v.
32 * Tested at random points (v, x), with v between 0 and
33 * 30, x between 0 and 28.
34 * arithmetic domain # trials peak rms
36 * IEEE 0,15 3000 4.7e-6 5.4e-7
37 * Absolute error (relative when function > 1)
38 * IEEE 0,30 5000 8.5e-6 1.3e-6
40 * Accuracy is diminished if v is near a negative integer.
41 * The useful domain for relative error is limited by overflow
42 * of the single precision exponential function.
48 /* Modified Bessel function of noninteger order */
49 /* If x < 0, then v must be an integer. */
53 Cephes Math Library Release 2.2: June, 1992
54 Copyright 1984, 1987, 1988, 1992 by Stephen L. Moshier
55 Direct inquiries to 30 Frost Street, Cambridge, MA 02140
61 extern double MAXNUMF;
62 #define fabsf(x) ( (x) < 0 ? -(x) : (x) )
65 float hypergf(float, float, float);
66 float expf(float), gammaf(float), logf(float), floorf(float);
68 float ivf( float v, float x )
70 float hypergf(), expf(), gammaf(), logf(), floorf();
79 /* If v is a negative integer, invoke symmetry */
85 v = -v; /* symmetry */
89 /* If x is negative, require v to be an integer */
95 mtherr( "ivf", DOMAIN );
98 if( v != 2.0 * floorf(v/2.0) )
102 /* Avoid logarithm singularity */
109 mtherr( "ivf", OVERFLOW );
117 t = v * logf( 0.5 * ax ) - x;
118 t = sign * expf(t) / gammaf( v + 1.0 );
120 return( t * hypergf( ax, 2.0 * ax, 2.0 * x ) );