9 * float v, x, y, struvef();
11 * y = struvef( v, x );
17 * Computes the Struve function Hv(x) of order v, argument x.
18 * Negative x is rejected unless v is an integer.
20 * This module also contains the hypergeometric functions 1F2
21 * and 3F0 and a routine for the Bessel function Yv(x) with
28 * v varies from 0 to 10.
29 * Absolute error (relative error when |Hv(x)| > 1):
30 * arithmetic domain # trials peak rms
31 * IEEE -10,10 100000 9.0e-5 4.0e-6
37 Cephes Math Library Release 2.2: July, 1992
38 Copyright 1984, 1987, 1989 by Stephen L. Moshier
39 Direct inquiries to 30 Frost Street, Cambridge, MA 02140
45 extern float MACHEPF, MAXNUMF, PIF;
47 #define fabsf(x) ( (x) < 0 ? -(x) : (x) )
50 float gammaf(float), powf(float, float), sqrtf(float);
51 float yvf(float, float);
52 float floorf(float), ynf(int, float);
53 float jvf(float, float);
54 float sinf(float), cosf(float);
56 float gammaf(), powf(), sqrtf(), yvf();
57 float floorf(), ynf(), jvf(), sinf(), cosf();
61 float onef2f( float aa, float bb, float cc, float xx, float *err )
63 float onef2f( aa, bb, cc, xx, err )
64 double aa, bb, cc, xx;
68 float a, b, c, x, n, a0, sum, t;
69 float an, bn, cn, max, z;
92 if( (a0 > 1.0e34) || (n > 200) )
94 a0 *= (an * x) / (bn * cn * n);
104 t = fabsf( a0 / sum );
108 while( t > MACHEPF );
112 *err = fabsf( MACHEPF*max /sum );
115 printf(" onef2f cancellation error %.5E\n", *err );
122 printf("onef2f does not converge\n");
129 printf("onef2( %.2E %.2E %.2E %.5E ) = %.3E %.6E\n", a, b, c, x, n, sum);
137 float threef0f( float aa, float bb, float cc, float xx, float *err )
139 float threef0f( aa, bb, cc, xx, err )
140 double aa, bb, cc, xx;
144 float a, b, c, x, n, a0, sum, t, conv, conv1;
145 float an, bn, cn, max, z;
170 if( (a0 > 1.0e34) || (n > 200) )
172 a0 *= (an * bn * cn * x) / n;
182 if( (z < max) && (z > conv1) )
189 t = fabsf( a0 / sum );
193 while( t > MACHEPF );
197 t = fabsf( MACHEPF*max/sum );
199 printf(" threef0f cancellation error %.5E\n", t );
202 max = fabsf( conv/sum );
206 printf(" threef0f convergence %.5E\n", max );
213 printf("threef0f does not converge\n");
220 printf("threef0f( %.2E %.2E %.2E %.5E ) = %.3E %.6E\n", a, b, c, x, n, sum);
231 float struvef( float vv, float xx )
233 float struvef( vv, xx )
237 float v, x, y, ya, f, g, h, t;
238 float onef2err, threef0err;
243 if( (v < 0) && ( v-f == 0.5 ) )
247 g = 2.0 * floorf(0.5*f);
255 if( (f > 30.0) && (f > g) )
262 y = onef2f( 1.0, 1.5, 1.5+v, -t, &onef2err );
265 if( (f < 18.0) || (x < 0.0) )
267 threef0err = MAXNUMF;
272 ya = threef0f( 1.0, 0.5, 0.5-v, -1.0/t, &threef0err );
276 h = powf( 0.5*x, v-1.0 );
278 if( onef2err <= threef0err )
280 g = gammaf( v + 1.5 );
281 y = y * h * t / ( 0.5 * f * g );
286 g = gammaf( v + 0.5 );
287 ya = ya * h / ( f * g );
288 ya = ya + yvf( v, x );
296 /* Bessel function of noninteger order
300 float yvf( float vv, float xx )
319 y = (cosf(t) * jvf( v, x ) - jvf( -v, x ))/sinf(t);
323 /* Crossover points between ascending series and asymptotic series
324 * for Struve function