zasyi.f

Go to the documentation of this file.
00001       SUBROUTINE ZASYI(ZR, ZI, FNU, KODE, N, YR, YI, NZ, RL, TOL, ELIM,
00002      * ALIM)
00003 C***BEGIN PROLOGUE  ZASYI
00004 C***REFER TO  ZBESI,ZBESK
00005 C
00006 C     ZASYI COMPUTES THE I BESSEL FUNCTION FOR REAL(Z).GE.0.0 BY
00007 C     MEANS OF THE ASYMPTOTIC EXPANSION FOR LARGE CABS(Z) IN THE
00008 C     REGION CABS(Z).GT.MAX(RL,FNU*FNU/2). NZ=0 IS A NORMAL RETURN.
00009 C     NZ.LT.0 INDICATES AN OVERFLOW ON KODE=1.
00010 C
00011 C***ROUTINES CALLED  D1MACH,XZABS,ZDIV,XZEXP,ZMLT,XZSQRT
00012 C***END PROLOGUE  ZASYI
00013 C     COMPLEX AK1,CK,CONE,CS1,CS2,CZ,CZERO,DK,EZ,P1,RZ,S2,Y,Z
00014       DOUBLE PRECISION AA, AEZ, AK, AK1I, AK1R, ALIM, ARG, ARM, ATOL,
00015      * AZ, BB, BK, CKI, CKR, CONEI, CONER, CS1I, CS1R, CS2I, CS2R, CZI,
00016      * CZR, DFNU, DKI, DKR, DNU2, ELIM, EZI, EZR, FDN, FNU, PI, P1I,
00017      * P1R, RAZ, RL, RTPI, RTR1, RZI, RZR, S, SGN, SQK, STI, STR, S2I,
00018      * S2R, TOL, TZI, TZR, YI, YR, ZEROI, ZEROR, ZI, ZR, D1MACH, XZABS
00019       INTEGER I, IB, IL, INU, J, JL, K, KODE, KODED, M, N, NN, NZ
00020       DIMENSION YR(N), YI(N)
00021       DATA PI, RTPI  /3.14159265358979324D0 , 0.159154943091895336D0 /
00022       DATA ZEROR,ZEROI,CONER,CONEI / 0.0D0, 0.0D0, 1.0D0, 0.0D0 /
00023 C
00024       NZ = 0
00025       AZ = XZABS(ZR,ZI)
00026       ARM = 1.0D+3*D1MACH(1)
00027       RTR1 = DSQRT(ARM)
00028       IL = MIN0(2,N)
00029       DFNU = FNU + DBLE(FLOAT(N-IL))
00030 C-----------------------------------------------------------------------
00031 C     OVERFLOW TEST
00032 C-----------------------------------------------------------------------
00033       RAZ = 1.0D0/AZ
00034       STR = ZR*RAZ
00035       STI = -ZI*RAZ
00036       AK1R = RTPI*STR*RAZ
00037       AK1I = RTPI*STI*RAZ
00038       CALL XZSQRT(AK1R, AK1I, AK1R, AK1I)
00039       CZR = ZR
00040       CZI = ZI
00041       IF (KODE.NE.2) GO TO 10
00042       CZR = ZEROR
00043       CZI = ZI
00044    10 CONTINUE
00045       IF (DABS(CZR).GT.ELIM) GO TO 100
00046       DNU2 = DFNU + DFNU
00047       KODED = 1
00048       IF ((DABS(CZR).GT.ALIM) .AND. (N.GT.2)) GO TO 20
00049       KODED = 0
00050       CALL XZEXP(CZR, CZI, STR, STI)
00051       CALL ZMLT(AK1R, AK1I, STR, STI, AK1R, AK1I)
00052    20 CONTINUE
00053       FDN = 0.0D0
00054       IF (DNU2.GT.RTR1) FDN = DNU2*DNU2
00055       EZR = ZR*8.0D0
00056       EZI = ZI*8.0D0
00057 C-----------------------------------------------------------------------
00058 C     WHEN Z IS IMAGINARY, THE ERROR TEST MUST BE MADE RELATIVE TO THE
00059 C     FIRST RECIPROCAL POWER SINCE THIS IS THE LEADING TERM OF THE
00060 C     EXPANSION FOR THE IMAGINARY PART.
00061 C-----------------------------------------------------------------------
00062       AEZ = 8.0D0*AZ
00063       S = TOL/AEZ
00064       JL = INT(SNGL(RL+RL)) + 2
00065       P1R = ZEROR
00066       P1I = ZEROI
00067       IF (ZI.EQ.0.0D0) GO TO 30
00068 C-----------------------------------------------------------------------
00069 C     CALCULATE EXP(PI*(0.5+FNU+N-IL)*I) TO MINIMIZE LOSSES OF
00070 C     SIGNIFICANCE WHEN FNU OR N IS LARGE
00071 C-----------------------------------------------------------------------
00072       INU = INT(SNGL(FNU))
00073       ARG = (FNU-DBLE(FLOAT(INU)))*PI
00074       INU = INU + N - IL
00075       AK = -DSIN(ARG)
00076       BK = DCOS(ARG)
00077       IF (ZI.LT.0.0D0) BK = -BK
00078       P1R = AK
00079       P1I = BK
00080       IF (MOD(INU,2).EQ.0) GO TO 30
00081       P1R = -P1R
00082       P1I = -P1I
00083    30 CONTINUE
00084       DO 70 K=1,IL
00085         SQK = FDN - 1.0D0
00086         ATOL = S*DABS(SQK)
00087         SGN = 1.0D0
00088         CS1R = CONER
00089         CS1I = CONEI
00090         CS2R = CONER
00091         CS2I = CONEI
00092         CKR = CONER
00093         CKI = CONEI
00094         AK = 0.0D0
00095         AA = 1.0D0
00096         BB = AEZ
00097         DKR = EZR
00098         DKI = EZI
00099         DO 40 J=1,JL
00100           CALL ZDIV(CKR, CKI, DKR, DKI, STR, STI)
00101           CKR = STR*SQK
00102           CKI = STI*SQK
00103           CS2R = CS2R + CKR
00104           CS2I = CS2I + CKI
00105           SGN = -SGN
00106           CS1R = CS1R + CKR*SGN
00107           CS1I = CS1I + CKI*SGN
00108           DKR = DKR + EZR
00109           DKI = DKI + EZI
00110           AA = AA*DABS(SQK)/BB
00111           BB = BB + AEZ
00112           AK = AK + 8.0D0
00113           SQK = SQK - AK
00114           IF (AA.LE.ATOL) GO TO 50
00115    40   CONTINUE
00116         GO TO 110
00117    50   CONTINUE
00118         S2R = CS1R
00119         S2I = CS1I
00120         IF (ZR+ZR.GE.ELIM) GO TO 60
00121         TZR = ZR + ZR
00122         TZI = ZI + ZI
00123         CALL XZEXP(-TZR, -TZI, STR, STI)
00124         CALL ZMLT(STR, STI, P1R, P1I, STR, STI)
00125         CALL ZMLT(STR, STI, CS2R, CS2I, STR, STI)
00126         S2R = S2R + STR
00127         S2I = S2I + STI
00128    60   CONTINUE
00129         FDN = FDN + 8.0D0*DFNU + 4.0D0
00130         P1R = -P1R
00131         P1I = -P1I
00132         M = N - IL + K
00133         YR(M) = S2R*AK1R - S2I*AK1I
00134         YI(M) = S2R*AK1I + S2I*AK1R
00135    70 CONTINUE
00136       IF (N.LE.2) RETURN
00137       NN = N
00138       K = NN - 2
00139       AK = DBLE(FLOAT(K))
00140       STR = ZR*RAZ
00141       STI = -ZI*RAZ
00142       RZR = (STR+STR)*RAZ
00143       RZI = (STI+STI)*RAZ
00144       IB = 3
00145       DO 80 I=IB,NN
00146         YR(K) = (AK+FNU)*(RZR*YR(K+1)-RZI*YI(K+1)) + YR(K+2)
00147         YI(K) = (AK+FNU)*(RZR*YI(K+1)+RZI*YR(K+1)) + YI(K+2)
00148         AK = AK - 1.0D0
00149         K = K - 1
00150    80 CONTINUE
00151       IF (KODED.EQ.0) RETURN
00152       CALL XZEXP(CZR, CZI, CKR, CKI)
00153       DO 90 I=1,NN
00154         STR = YR(I)*CKR - YI(I)*CKI
00155         YI(I) = YR(I)*CKI + YI(I)*CKR
00156         YR(I) = STR
00157    90 CONTINUE
00158       RETURN
00159   100 CONTINUE
00160       NZ = -1
00161       RETURN
00162   110 CONTINUE
00163       NZ=-2
00164       RETURN
00165       END
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines