1 SUBROUTINE ZSERI
(ZR
, ZI
, FNU
, KODE
, N
, YR
, YI
, NZ
, TOL
, ELIM
,
3 C***BEGIN PROLOGUE ZSERI
4 C***REFER TO ZBESI,ZBESK
6 C ZSERI COMPUTES THE I BESSEL FUNCTION FOR REAL(Z).GE.0.0 BY
7 C MEANS OF THE POWER SERIES FOR LARGE CABS(Z) IN THE
8 C REGION CABS(Z).LE.2*SQRT(FNU+1). NZ=0 IS A NORMAL RETURN.
9 C NZ.GT.0 MEANS THAT THE LAST NZ COMPONENTS WERE SET TO ZERO
10 C DUE TO UNDERFLOW. NZ.LT.0 MEANS UNDERFLOW OCCURRED, BUT THE
11 C CONDITION CABS(Z).LE.2*SQRT(FNU+1) WAS VIOLATED AND THE
12 C COMPUTATION MUST BE COMPLETED IN ANOTHER ROUTINE WITH N=N-ABS(NZ).
14 C***ROUTINES CALLED DGAMLN,D1MACH,ZUCHK,AZABS,ZDIV,AZLOG,ZMLT
15 C***END PROLOGUE ZSERI
16 C COMPLEX AK1,CK,COEF,CONE,CRSC,CSCL,CZ,CZERO,HZ,RZ,S1,S2,Y,Z
17 DOUBLE PRECISION AA
, ACZ
, AK
, AK1I
, AK1R
, ALIM
, ARM
, ASCLE
, ATOL
,
18 * AZ
, CKI
, CKR
, COEFI
, COEFR
, CONEI
, CONER
, CRSCR
, CZI
, CZR
, DFNU
,
19 * ELIM
, FNU
, FNUP
, HZI
, HZR
, RAZ
, RS
, RTR1
, RZI
, RZR
, S
, SS
, STI
,
20 * STR
, S1I
, S1R
, S2I
, S2R
, TOL
, YI
, YR
, WI
, WR
, ZEROI
, ZEROR
, ZI
,
21 * ZR
, DGAMLN
, D1MACH
, AZABS
22 INTEGER I
, IB
, IDUM
, IFLAG
, IL
, K
, KODE
, L
, M
, N
, NN
, NZ
, NW
23 DIMENSION YR
(N
), YI
(N
), WR
(2), WI
(2)
24 DATA ZEROR
,ZEROI
,CONER
,CONEI
/ 0.0D0
, 0.0D0
, 1.0D0
, 0.0D0
/
28 IF (AZ
.EQ
.0.0D0
) GO TO 160
29 ARM
= 1.0D
+3*D1MACH
(1)
33 IF (AZ
.LT
.ARM
) GO TO 150
38 IF (AZ
.LE
.RTR1
) GO TO 10
39 CALL ZMLT
(HZR
, HZI
, HZR
, HZI
, CZR
, CZI
)
43 CALL AZLOG
(HZR
, HZI
, CKR
, CKI
, IDUM
)
45 DFNU
= FNU
+ DBLE
(FLOAT
(NN
-1))
47 C-----------------------------------------------------------------------
49 C-----------------------------------------------------------------------
52 AK
= DGAMLN
(FNUP
,IDUM
)
54 IF (KODE
.EQ
.2) AK1R
= AK1R
- ZR
55 IF (AK1R
.GT
.(-ELIM
)) GO TO 40
60 IF (ACZ
.GT
.DFNU
) GO TO 190
65 IF (AK1R
.GT
.(-ALIM
)) GO TO 50
72 IF (IFLAG
.EQ
.1) AA
= AA*SS
78 DFNU
= FNU
+ DBLE
(FLOAT
(NN
-I
))
82 IF (ACZ
.LT
.TOL*FNUP
) GO TO 70
90 STR
= AK1R*CZR
- AK1I*CZI
91 STI
= AK1R*CZI
+ AK1I*CZR
99 IF (AA
.GT
.ATOL
) GO TO 60
101 S2R
= S1R*COEFR
- S1I*COEFI
102 S2I
= S1R*COEFI
+ S1I*COEFR
105 IF (IFLAG
.EQ
.0) GO TO 80
106 CALL ZUCHK
(S2R
, S2I
, NW
, ASCLE
, TOL
)
107 IF (NW
.NE
.0) GO TO 30
112 IF (I
.EQ
.IL
) GO TO 90
113 CALL ZDIV
(COEFR
, COEFI
, HZR
, HZI
, STR
, STI
)
125 IF (IFLAG
.EQ
.1) GO TO 120
129 YR
(K
) = (AK
+FNU
)*(RZR*YR
(K
+1)-RZI*YI
(K
+1)) + YR
(K
+2)
130 YI
(K
) = (AK
+FNU
)*(RZR*YI
(K
+1)+RZI*YR
(K
+1)) + YI
(K
+2)
135 C-----------------------------------------------------------------------
136 C RECUR BACKWARD WITH SCALED VALUES
137 C-----------------------------------------------------------------------
139 C-----------------------------------------------------------------------
140 C EXP(-ALIM)=EXP(-ELIM)/TOL=APPROX. ONE PRECISION ABOVE THE
141 C UNDERFLOW LIMIT = ASCLE = D1MACH(1)*SS*1.0D+3
142 C-----------------------------------------------------------------------
150 S2R
= S1R
+ (AK
+FNU
)*(RZR*CKR
-RZI*CKI
)
151 S2I
= S1I
+ (AK
+FNU
)*(RZR*CKI
+RZI*CKR
)
160 IF (AZABS
(CKR
,CKI
).GT
.ASCLE
) GO TO 140
169 IF (FNU
.EQ
.0.0D0
) NZ
= NZ
- 1
173 IF (FNU
.NE
.0.0D0
) GO TO 170
183 C-----------------------------------------------------------------------
184 C RETURN WITH NZ.LT.0 IF CABS(Z*Z/4).GT.FNU+N-NZ-1 COMPLETE
185 C THE CALCULATION IN CBINU WITH N=N-IABS(NZ)
186 C-----------------------------------------------------------------------