9
* double v, x, y, struve();
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
* Not accurately characterized, but spot checked against tables.
34
Cephes Math Library Release 2.81: June, 2000
35
Copyright 1984, 1987, 1989, 2000 by Stephen L. Moshier
40
extern double gamma ( double );
41
extern double pow ( double, double );
42
extern double sqrt ( double );
43
extern double yn ( int, double );
44
extern double jv ( double, double );
45
extern double fabs ( double );
46
extern double floor ( double );
47
extern double sin ( double );
48
extern double cos ( double );
49
double yv ( double, double );
50
double onef2 (double, double, double, double, double * );
51
double threef0 (double, double, double, double, double * );
53
double gamma(), pow(), sqrt(), yn(), yv(), jv(), fabs(), floor();
55
double onef2(), threef0();
57
static double stop = 1.37e-17;
58
extern double MACHEP, INFINITY;
60
double onef2( a, b, c, x, err )
65
double an, bn, cn, max, z;
84
if( (a0 > 1.0e34) || (n > 200) )
86
a0 *= (an * x) / (bn * cn * n);
104
*err = fabs( MACHEP*max /sum );
107
printf(" onef2 cancellation error %.5E\n", *err );
114
printf("onef2 does not converge\n");
121
printf("onef2( %.2E %.2E %.2E %.5E ) = %.3E %.6E\n", a, b, c, x, n, sum);
129
double threef0( a, b, c, x, err )
133
double n, a0, sum, t, conv, conv1;
134
double an, bn, cn, max, z;
155
if( (a0 > 1.0e34) || (n > 200) )
157
a0 *= (an * bn * cn * x) / n;
167
if( (z < max) && (z > conv1) )
174
t = fabs( a0 / sum );
182
t = fabs( MACHEP*max/sum );
184
printf(" threef0 cancellation error %.5E\n", t );
187
max = fabs( conv/sum );
191
printf(" threef0 convergence %.5E\n", max );
198
printf("threef0 does not converge\n");
205
printf("threef0( %.2E %.2E %.2E %.5E ) = %.3E %.6E\n", a, b, c, x, n, sum);
217
double struve( v, x )
220
double y, ya, f, g, h, t;
221
double onef2err, threef0err;
227
if ((int)(floor(0.5-v)-1) % 2) return -INFINITY;
228
else return INFINITY;
235
if( (v < 0) && ( v-f == 0.5 ) )
239
g = 2.0 * floor(f/2.0);
247
if( (f > 30.0) && (f > g) )
254
y = onef2( 1.0, 1.5, 1.5+v, -t, &onef2err );
257
if( (f < 18.0) || (x < 0.0) )
264
ya = threef0( 1.0, 0.5, 0.5-v, -1.0/t, &threef0err );
268
h = pow( 0.5*x, v-1.0 );
270
if( onef2err <= threef0err )
272
g = gamma( v + 1.5 );
273
y = y * h * t / ( 0.5 * f * g );
278
g = gamma( v + 0.5 );
279
ya = ya * h / ( f * g );
280
ya = ya + yv( v, x );
288
/* Bessel function of noninteger order
305
y = (cos(t) * jv( v, x ) - jv( -v, x ))/sin(t);
309
/* Crossover points between ascending series and asymptotic series
310
* for Struve function