2 SUBROUTINE ZRATI
(ZR
, ZI
, FNU
, N
, CYR
, CYI
, TOL
)
3 C***BEGIN PROLOGUE ZRATI
5 C***PURPOSE Subsidiary to ZBESH, ZBESI and ZBESK
7 C***TYPE ALL (CRATI-A, ZRATI-A)
8 C***AUTHOR Amos, D. E., (SNL)
11 C ZRATI COMPUTES RATIOS OF I BESSEL FUNCTIONS BY BACKWARD
12 C RECURRENCE. THE STARTING INDEX IS DETERMINED BY FORWARD
13 C RECURRENCE AS DESCRIBED IN J. RES. OF NAT. BUR. OF STANDARDS-B,
14 C MATHEMATICAL SCIENCES, VOL 77B, P111-114, SEPTEMBER, 1973,
15 C BESSEL FUNCTIONS I AND J OF COMPLEX ARGUMENT AND INTEGER ORDER,
18 C***SEE ALSO ZBESH, ZBESI, ZBESK
19 C***ROUTINES CALLED ZABS, ZDIV
20 C***REVISION HISTORY (YYMMDD)
22 C 910415 Prologue converted to Version 4.0 format. (BAB)
23 C***END PROLOGUE ZRATI
24 DOUBLE PRECISION AK
, AMAGZ
, AP1
, AP2
, ARG
, AZ
, CDFNUI
, CDFNUR
,
25 * CONEI
, CONER
, CYI
, CYR
, CZEROI
, CZEROR
, DFNU
, FDNU
, FLAM
, FNU
,
26 * FNUP
, PTI
, PTR
, P1I
, P1R
, P2I
, P2R
, RAK
, RAP1
, RHO
, RT2
, RZI
,
27 * RZR
, TEST
, TEST1
, TOL
, TTI
, TTR
, T1I
, T1R
, ZI
, ZR
, ZABS
28 INTEGER I
, ID
, IDNU
, INU
, ITIME
, K
, KK
, MAGZ
, N
29 DIMENSION CYR
(N
), CYI
(N
)
31 DATA CZEROR
,CZEROI
,CONER
,CONEI
,RT2
/
32 1 0.0D0
, 0.0D0
, 1.0D0
, 0.0D0
, 1.41421356237309505D0
/
33 C***FIRST EXECUTABLE STATEMENT ZRATI
40 FNUP
= MAX
(AMAGZ
,FDNU
)
46 RZI
= -PTR*
(ZI
+ZI
)*PTR
58 C-----------------------------------------------------------------------
59 C THE OVERFLOW TEST ON K(FNU+I-1,Z) BEFORE THE CALL TO CBKNU
60 C GUARANTEES THAT P2 IS ON SCALE. SCALE TEST1 AND ALL SUBSEQUENT
61 C P2 VALUES BY AP1 TO ENSURE THAT AN OVERFLOW DOES NOT OCCUR
63 C-----------------------------------------------------------------------
64 ARG
= (AP2
+AP2
)/(AP1*TOL
)
78 P2R
= P1R
- (T1R*PTR
-T1I*PTI
)
79 P2I
= P1I
- (T1R*PTI
+T1I*PTR
)
85 IF (AP1
.LE
.TEST
) GO TO 10
86 IF (ITIME
.EQ
.2) GO TO 20
87 AK
= ZABS
(T1R
,T1I
)*0.5D0
88 FLAM
= AK
+ SQRT
(AK*AK
-1.0D0
)
89 RHO
= MIN
(AP2
/AP1
,FLAM
)
90 TEST
= TEST1*SQRT
(RHO
/(RHO*RHO
-1.0D0
))
109 P1R
= (PTR*TTR
-PTI*TTI
) + P2R
110 P1I
= (PTR*TTI
+PTI*TTR
) + P2I
115 IF (P1R
.NE
.CZEROR
.OR
. P1I
.NE
.CZEROI
) GO TO 40
119 CALL ZDIV
(P2R
, P2I
, P1R
, P1I
, CYR
(N
), CYI
(N
))
128 PTR
= CDFNUR
+ (T1R*RZR
-T1I*RZI
) + CYR
(K
+1)
129 PTI
= CDFNUI
+ (T1R*RZI
+T1I*RZR
) + CYI
(K
+1)
131 IF (AK
.NE
.CZEROR
) GO TO 50
138 CYI
(K
) = -RAK*PTI*RAK