3 * Modified Bessel function of noninteger order
9 * double v, x, y, iv();
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.
35 * arithmetic domain # trials peak rms
36 * DEC 0,30 2000 3.1e-15 5.4e-16
37 * IEEE 0,30 10000 1.7e-14 2.7e-15
39 * Accuracy is diminished if v is near a negative integer.
45 /* Modified Bessel function of noninteger order */
46 /* If x < 0, then v must be an integer. */
50 Cephes Math Library Release 2.8: June, 2000
51 Copyright 1984, 1987, 1988, 2000 by Stephen L. Moshier
57 extern double hyperg ( double, double, double );
58 extern double exp ( double );
59 extern double gamma ( double );
60 extern double log ( double );
61 extern double fabs ( double );
62 extern double floor ( double );
64 double hyperg(), exp(), gamma(), log(), fabs(), floor();
66 extern double MACHEP, MAXNUM;
74 /* If v is a negative integer, invoke symmetry */
80 v = -v; /* symmetry */
84 /* If x is negative, require v to be an integer */
90 mtherr( "iv", DOMAIN );
93 if( v != 2.0 * floor(v/2.0) )
97 /* Avoid logarithm singularity */
104 mtherr( "iv", OVERFLOW );
112 t = v * log( 0.5 * ax ) - x;
113 t = sign * exp(t) / gamma( v + 1.0 );
115 return( t * hyperg( ax, 2.0 * ax, 2.0 * x ) );