2 SUBROUTINE DBSYNU
(X
, FNU
, N
, Y
)
3 C***BEGIN PROLOGUE DBSYNU
5 C***PURPOSE Subsidiary to DBESY
7 C***TYPE DOUBLE PRECISION (BESYNU-S, DBSYNU-D)
8 C***AUTHOR Amos, D. E., (SNLA)
11 C Abstract **** A DOUBLE PRECISION routine ****
12 C DBSYNU computes N member sequences of Y Bessel functions
13 C Y/SUB(FNU+I-1)/(X), I=1,N for non-negative orders FNU and
14 C positive X. Equations of the references are implemented on
15 C small orders DNU for Y/SUB(DNU)/(X) and Y/SUB(DNU+1)/(X).
16 C Forward recursion with the three term recursion relation
17 C generates higher orders FNU+I-1, I=1,...,N.
19 C To start the recursion FNU is normalized to the interval
20 C -0.5.LE.DNU.LT.0.5. A special form of the power series is
21 C implemented on 0.LT.X.LE.X1 while the Miller algorithm for the
22 C K Bessel function in terms of the confluent hypergeometric
23 C function U(FNU+0.5,2*FNU+1,I*X) is implemented on X1.LT.X.LE.X
24 C Here I is the complex number SQRT(-1.).
25 C For X.GT.X2, the asymptotic expansion for large X is used.
26 C When FNU is a half odd integer, a special formula for
27 C DNU=-0.5 and DNU+1.0=0.5 is used to start the recursion.
29 C The maximum number of significant digits obtainable
30 C is the smaller of 14 and the number of digits carried in
31 C DOUBLE PRECISION arithmetic.
33 C DBSYNU assumes that a significant digit SINH function is
36 C Description of Arguments
40 C FNU - Order of initial Y function, FNU.GE.0.0D0
41 C N - Number of members of the sequence, N.GE.1
44 C Y - A vector whose first N components contain values
45 C for the sequence Y(I)=Y/SUB(FNU+I-1), I=1,N.
48 C Improper input arguments - a fatal error
49 C Overflow - a fatal error
52 C***REFERENCES N. M. Temme, On the numerical evaluation of the ordinary
53 C Bessel function of the second kind, Journal of
54 C Computational Physics 21, (1976), pp. 343-350.
55 C N. M. Temme, On the numerical evaluation of the modified
56 C Bessel function of the third kind, Journal of
57 C Computational Physics 19, (1975), pp. 324-337.
58 C***ROUTINES CALLED D1MACH, DGAMMA, XERMSG
59 C***REVISION HISTORY (YYMMDD)
61 C 890531 Changed all specific intrinsics to generic. (WRB)
62 C 890911 Removed unnecessary intrinsics. (WRB)
63 C 891214 Prologue converted to Version 4.0 format. (BAB)
64 C 900315 CALLs to XERROR changed to CALLs to XERMSG. (THJ)
65 C 900326 Removed duplicate information from DESCRIPTION section.
67 C 900328 Added TYPE section. (WRB)
68 C 900727 Added EXTERNAL statement. (WRB)
69 C 910408 Updated the AUTHOR and REFERENCES sections. (WRB)
70 C 920501 Reformatted the REFERENCES section. (WRB)
71 C***END PROLOGUE DBSYNU
73 INTEGER I
, INU
, J
, K
, KK
, N
, NN
74 DOUBLE PRECISION A
,AK
,ARG
,A1
,A2
,BK
,CB
,CBK
,CC
,CCK
,CK
,COEF
,CPT
,
75 1 CP1
, CP2
, CS
, CS1
, CS2
, CX
, DNU
, DNU2
, ETEST
, ETX
, F
, FC
, FHS
,
76 2 FK
, FKS
, FLRX
, FMU
, FN
, FNU
, FX
, G
, G1
, G2
, HPI
, P
, PI
, PT
, Q
,
77 3 RB
, RBK
, RCK
, RELB
, RPT
, RP1
, RP2
, RS
, RS1
, RS2
, RTHPI
, RX
, S
,
78 4 SA
, SB
, SMU
, SS
, ST
, S1
, S2
, TB
, TM
, TOL
, T1
, T2
, X
, X1
, X2
, Y
79 DIMENSION A
(120), RB
(120), CB
(120), Y
(*), CC
(8)
80 DOUBLE PRECISION DGAMMA
, D1MACH
82 SAVE X1
, X2
,PI
, RTHPI
, HPI
, CC
83 DATA X1
, X2
/ 3.0D0
, 20.0D0
/
84 DATA PI
,RTHPI
/ 3.14159265358979D
+00, 7.97884560802865D
-01/
85 DATA HPI
/ 1.57079632679490D
+00/
86 DATA CC
(1), CC
(2), CC
(3), CC
(4), CC
(5), CC
(6), CC
(7), CC
(8)
87 1 / 5.77215664901533D
-01,-4.20026350340952D
-02,
88 2-4.21977345555443D
-02, 7.21894324666300D
-03,-2.15241674114900D
-04,
89 3-2.01348547807000D
-05, 1.13302723200000D
-06, 6.11609500000000D
-09/
90 C***FIRST EXECUTABLE STATEMENT DBSYNU
93 IF (X
.LE
.0.0D0
) GO TO 270
94 IF (FNU
.LT
.0.0D0
) GO TO 280
99 IF (ABS
(DNU
).EQ
.0.5D0
) GO TO 260
101 IF (ABS
(DNU
).LT
.TOL
) GO TO 10
104 IF (X
.GT
.X1
) GO TO 120
110 T1
= 1.0D0
/DGAMMA
(A1
)
111 T2
= 1.0D0
/DGAMMA
(A2
)
112 IF (ABS
(DNU
).GT
.0.1D0
) GO TO 40
113 C SERIES FOR F0 TO RESOLVE INDETERMINACY FOR SMALL ABS(DNU)
120 IF (ABS
(TM
).LT
.TOL
) GO TO 30
133 IF (DNU
.EQ
.0.0D0
) GO TO 60
134 TM
= SIN
(DNU*HPI
)/DNU
137 IF (FMU
.NE
.0.0D0
) SMU
= SINH
(FMU
)/FMU
139 F
= FC*
(G1*COSH
(FMU
)+G2*FLRX*SMU
)
149 IF (INU
.GT
.0 .OR
. N
.GT
.1) GO TO 90
150 IF (X
.LT
.TOL
) GO TO 80
153 F
= (AK*F
+P
+Q
)/(BK
-DNU2
)
160 BK
= BK
+ AK
+ AK
+ 1.0D0
162 S
= ABS
(T1
)/(1.0D0
+ABS
(S1
))
163 IF (S
.GT
.TOL
) GO TO 70
168 IF (X
.LT
.TOL
) GO TO 110
171 F
= (AK*F
+P
+Q
)/(BK
-DNU2
)
180 BK
= BK
+ AK
+ AK
+ 1.0D0
182 S
= ABS
(T1
)/(1.0D0
+ABS
(S1
)) + ABS
(T2
)/(1.0D0
+ABS
(S2
))
183 IF (S
.GT
.TOL
) GO TO 100
190 IF (X
.GT
.X2
) GO TO 210
192 C MILLER ALGORITHM FOR X1.LT.X.LE.X2
194 ETEST
= COS
(PI*DNU
)/(PI*X*TOL
)
208 AK
= (FHS
-DNU2
)/(FKS
+FK
)
214 RP2
= RBK*RPT
- CBK*CPT
- AK*RP1
215 CP2
= CBK*RPT
+ RBK*CPT
- AK*CP1
222 FKS
= FKS
+ FK
+ FK
+ 1.0D0
224 PT
= MAX
(ABS
(RP1
),ABS
(CP1
))
225 FC
= (RP1
/PT
)**2 + (CP1
/PT
)**2
227 IF (ETEST
.GT
.PT
) GO TO 130
238 RP2
= (RB
(KK
)*RPT
-CB
(KK
)*CPT
-RP1
)/A
(KK
)
239 CP2
= (CB
(KK
)*RPT
+RB
(KK
)*CPT
-CP1
)/A
(KK
)
246 PT
= MAX
(ABS
(RS
),ABS
(CS
))
247 FC
= (RS
/PT
)**2 + (CS
/PT
)**2
249 RS1
= (RP2*
(RS
/PT
)+CP2*
(CS
/PT
))/PT
250 CS1
= (CP2*
(RS
/PT
)-RP2*
(CS
/PT
))/PT
251 FC
= HPI*
(DNU
-0.5D0
) - X
254 S1
= (CS1*Q
-RS1*P
)*COEF
255 IF (INU
.GT
.0 .OR
. N
.GT
.1) GO TO 150
259 PT
= MAX
(ABS
(RP2
),ABS
(CP2
))
260 FC
= (RP2
/PT
)**2 + (CP2
/PT
)**2
262 RPT
= DNU
+ 0.5D0
- (RP1*
(RP2
/PT
)+CP1*
(CP2
/PT
))/PT
263 CPT
= X
- (CP1*
(RP2
/PT
)-RP1*
(CP2
/PT
))/PT
264 CS2
= CS1*CPT
- RS1*RPT
265 RS2
= RPT*CS1
+ RS1*CPT
266 S2
= (RS2*Q
+CS2*P
)*COEF
/X
268 C FORWARD RECURSION ON THE THREE TERM RECURSION RELATION
271 CK
= (DNU
+DNU
+2.0D0
)/X
272 IF (N
.EQ
.1) INU
= INU
- 1
273 IF (INU
.GT
.0) GO TO 170
274 IF (N
.GT
.1) GO TO 190
291 Y
(I
) = CK*Y
(I
-1) - Y
(I
-2)
296 C ASYMPTOTIC EXPANSION FOR LARGE X, X.GT.X2
300 IF (INU
.EQ
.0 .AND
. N
.EQ
.1) NN
= 1
303 IF (ABS
(DNU2
).LT
.TOL
) GO TO 220
306 ARG
= X
- HPI*
(DNU
+0.5D0
)
330 IF (ABS
(T2
).LE
.RELB
) GO TO 240
332 240 S2
= COEF*
(S*SA
+SS*SB
)
333 FMU
= FMU
+ 8.0D0*DNU
+ 4.0D0
338 IF (NN
.GT
.1) GO TO 160
342 C FNU=HALF ODD INTEGER CASE
351 270 CALL XERMSG
('SLATEC', 'DBSYNU', 'X NOT GREATER THAN ZERO', 2, 1)
353 280 CALL XERMSG
('SLATEC', 'DBSYNU', 'FNU NOT ZERO OR POSITIVE', 2,
356 290 CALL XERMSG
('SLATEC', 'DBSYNU', 'N NOT GREATER THAN 0', 2, 1)