00001 SUBROUTINE CASYI(Z, FNU, KODE, N, Y, NZ, RL, TOL, ELIM, ALIM)
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012 COMPLEX AK1, CK, CONE, CS1, CS2, CZ, CZERO, DK, EZ, P1, RZ, S2,
00013 * Y, Z
00014 REAL AA, ACZ, AEZ, AK, ALIM, ARG, ARM, ATOL, AZ, BB, BK, DFNU,
00015 * DNU2, ELIM, FDN, FNU, PI, RL, RTPI, RTR1, S, SGN, SQK, TOL, X,
00016 * YY, R1MACH
00017 INTEGER I, IB, IL, INU, J, JL, K, KODE, KODED, M, N, NN, NZ
00018 DIMENSION Y(N)
00019 DATA PI, RTPI /3.14159265358979324E0 , 0.159154943091895336E0 /
00020 DATA CZERO, CONE / (0.0E0,0.0E0), (1.0E0,0.0E0) /
00021
00022 NZ = 0
00023 AZ = CABS(Z)
00024 X = REAL(Z)
00025 ARM = 1.0E+3*R1MACH(1)
00026 RTR1 = SQRT(ARM)
00027 IL = MIN0(2,N)
00028 DFNU = FNU + FLOAT(N-IL)
00029
00030
00031
00032 AK1 = CMPLX(RTPI,0.0E0)/Z
00033 AK1 = CSQRT(AK1)
00034 CZ = Z
00035 IF (KODE.EQ.2) CZ = Z - CMPLX(X,0.0E0)
00036 ACZ = REAL(CZ)
00037 IF (ABS(ACZ).GT.ELIM) GO TO 80
00038 DNU2 = DFNU + DFNU
00039 KODED = 1
00040 IF ((ABS(ACZ).GT.ALIM) .AND. (N.GT.2)) GO TO 10
00041 KODED = 0
00042 AK1 = AK1*CEXP(CZ)
00043 10 CONTINUE
00044 FDN = 0.0E0
00045 IF (DNU2.GT.RTR1) FDN = DNU2*DNU2
00046 EZ = Z*CMPLX(8.0E0,0.0E0)
00047
00048
00049
00050
00051
00052 AEZ = 8.0E0*AZ
00053 S = TOL/AEZ
00054 JL = INT(RL+RL) + 2
00055 YY = AIMAG(Z)
00056 P1 = CZERO
00057 IF (YY.EQ.0.0E0) GO TO 20
00058
00059
00060
00061
00062 INU = INT(FNU)
00063 ARG = (FNU-FLOAT(INU))*PI
00064 INU = INU + N - IL
00065 AK = -SIN(ARG)
00066 BK = COS(ARG)
00067 IF (YY.LT.0.0E0) BK = -BK
00068 P1 = CMPLX(AK,BK)
00069 IF (MOD(INU,2).EQ.1) P1 = -P1
00070 20 CONTINUE
00071 DO 50 K=1,IL
00072 SQK = FDN - 1.0E0
00073 ATOL = S*ABS(SQK)
00074 SGN = 1.0E0
00075 CS1 = CONE
00076 CS2 = CONE
00077 CK = CONE
00078 AK = 0.0E0
00079 AA = 1.0E0
00080 BB = AEZ
00081 DK = EZ
00082 DO 30 J=1,JL
00083 CK = CK*CMPLX(SQK,0.0E0)/DK
00084 CS2 = CS2 + CK
00085 SGN = -SGN
00086 CS1 = CS1 + CK*CMPLX(SGN,0.0E0)
00087 DK = DK + EZ
00088 AA = AA*ABS(SQK)/BB
00089 BB = BB + AEZ
00090 AK = AK + 8.0E0
00091 SQK = SQK - AK
00092 IF (AA.LE.ATOL) GO TO 40
00093 30 CONTINUE
00094 GO TO 90
00095 40 CONTINUE
00096 S2 = CS1
00097 IF (X+X.LT.ELIM) S2 = S2 + P1*CS2*CEXP(-Z-Z)
00098 FDN = FDN + 8.0E0*DFNU + 4.0E0
00099 P1 = -P1
00100 M = N - IL + K
00101 Y(M) = S2*AK1
00102 50 CONTINUE
00103 IF (N.LE.2) RETURN
00104 NN = N
00105 K = NN - 2
00106 AK = FLOAT(K)
00107 RZ = (CONE+CONE)/Z
00108 IB = 3
00109 DO 60 I=IB,NN
00110 Y(K) = CMPLX(AK+FNU,0.0E0)*RZ*Y(K+1) + Y(K+2)
00111 AK = AK - 1.0E0
00112 K = K - 1
00113 60 CONTINUE
00114 IF (KODED.EQ.0) RETURN
00115 CK = CEXP(CZ)
00116 DO 70 I=1,NN
00117 Y(I) = Y(I)*CK
00118 70 CONTINUE
00119 RETURN
00120 80 CONTINUE
00121 NZ = -1
00122 RETURN
00123 90 CONTINUE
00124 NZ=-2
00125 RETURN
00126 END