zbuni.f

Go to the documentation of this file.
00001       SUBROUTINE ZBUNI(ZR, ZI, FNU, KODE, N, YR, YI, NZ, NUI, NLAST,
00002      * FNUL, TOL, ELIM, ALIM)
00003 C***BEGIN PROLOGUE  ZBUNI
00004 C***REFER TO  ZBESI,ZBESK
00005 C
00006 C     ZBUNI COMPUTES THE I BESSEL FUNCTION FOR LARGE CABS(Z).GT.
00007 C     FNUL AND FNU+N-1.LT.FNUL. THE ORDER IS INCREASED FROM
00008 C     FNU+N-1 GREATER THAN FNUL BY ADDING NUI AND COMPUTING
00009 C     ACCORDING TO THE UNIFORM ASYMPTOTIC EXPANSION FOR I(FNU,Z)
00010 C     ON IFORM=1 AND THE EXPANSION FOR J(FNU,Z) ON IFORM=2
00011 C
00012 C***ROUTINES CALLED  ZUNI1,ZUNI2,XZABS,D1MACH
00013 C***END PROLOGUE  ZBUNI
00014 C     COMPLEX CSCL,CSCR,CY,RZ,ST,S1,S2,Y,Z
00015       DOUBLE PRECISION ALIM, AX, AY, CSCLR, CSCRR, CYI, CYR, DFNU,
00016      * ELIM, FNU, FNUI, FNUL, GNU, RAZ, RZI, RZR, STI, STR, S1I, S1R,
00017      * S2I, S2R, TOL, YI, YR, ZI, ZR, XZABS, ASCLE, BRY, C1R, C1I, C1M,
00018      * D1MACH
00019       INTEGER I, IFLAG, IFORM, K, KODE, N, NL, NLAST, NUI, NW, NZ
00020       DIMENSION YR(N), YI(N), CYR(2), CYI(2), BRY(3)
00021       NZ = 0
00022       AX = DABS(ZR)*1.7321D0
00023       AY = DABS(ZI)
00024       IFORM = 1
00025       IF (AY.GT.AX) IFORM = 2
00026       IF (NUI.EQ.0) GO TO 60
00027       FNUI = DBLE(FLOAT(NUI))
00028       DFNU = FNU + DBLE(FLOAT(N-1))
00029       GNU = DFNU + FNUI
00030       IF (IFORM.EQ.2) GO TO 10
00031 C-----------------------------------------------------------------------
00032 C     ASYMPTOTIC EXPANSION FOR I(FNU,Z) FOR LARGE FNU APPLIED IN
00033 C     -PI/3.LE.ARG(Z).LE.PI/3
00034 C-----------------------------------------------------------------------
00035       CALL ZUNI1(ZR, ZI, GNU, KODE, 2, CYR, CYI, NW, NLAST, FNUL, TOL,
00036      * ELIM, ALIM)
00037       GO TO 20
00038    10 CONTINUE
00039 C-----------------------------------------------------------------------
00040 C     ASYMPTOTIC EXPANSION FOR J(FNU,Z*EXP(M*HPI)) FOR LARGE FNU
00041 C     APPLIED IN PI/3.LT.ABS(ARG(Z)).LE.PI/2 WHERE M=+I OR -I
00042 C     AND HPI=PI/2
00043 C-----------------------------------------------------------------------
00044       CALL ZUNI2(ZR, ZI, GNU, KODE, 2, CYR, CYI, NW, NLAST, FNUL, TOL,
00045      * ELIM, ALIM)
00046    20 CONTINUE
00047       IF (NW.LT.0) GO TO 50
00048       IF (NW.NE.0) GO TO 90
00049       STR = XZABS(CYR(1),CYI(1))
00050 C----------------------------------------------------------------------
00051 C     SCALE BACKWARD RECURRENCE, BRY(3) IS DEFINED BUT NEVER USED
00052 C----------------------------------------------------------------------
00053       BRY(1)=1.0D+3*D1MACH(1)/TOL
00054       BRY(2) = 1.0D0/BRY(1)
00055       BRY(3) = BRY(2)
00056       IFLAG = 2
00057       ASCLE = BRY(2)
00058       CSCLR = 1.0D0
00059       IF (STR.GT.BRY(1)) GO TO 21
00060       IFLAG = 1
00061       ASCLE = BRY(1)
00062       CSCLR = 1.0D0/TOL
00063       GO TO 25
00064    21 CONTINUE
00065       IF (STR.LT.BRY(2)) GO TO 25
00066       IFLAG = 3
00067       ASCLE=BRY(3)
00068       CSCLR = TOL
00069    25 CONTINUE
00070       CSCRR = 1.0D0/CSCLR
00071       S1R = CYR(2)*CSCLR
00072       S1I = CYI(2)*CSCLR
00073       S2R = CYR(1)*CSCLR
00074       S2I = CYI(1)*CSCLR
00075       RAZ = 1.0D0/XZABS(ZR,ZI)
00076       STR = ZR*RAZ
00077       STI = -ZI*RAZ
00078       RZR = (STR+STR)*RAZ
00079       RZI = (STI+STI)*RAZ
00080       DO 30 I=1,NUI
00081         STR = S2R
00082         STI = S2I
00083         S2R = (DFNU+FNUI)*(RZR*STR-RZI*STI) + S1R
00084         S2I = (DFNU+FNUI)*(RZR*STI+RZI*STR) + S1I
00085         S1R = STR
00086         S1I = STI
00087         FNUI = FNUI - 1.0D0
00088         IF (IFLAG.GE.3) GO TO 30
00089         STR = S2R*CSCRR
00090         STI = S2I*CSCRR
00091         C1R = DABS(STR)
00092         C1I = DABS(STI)
00093         C1M = DMAX1(C1R,C1I)
00094         IF (C1M.LE.ASCLE) GO TO 30
00095         IFLAG = IFLAG+1
00096         ASCLE = BRY(IFLAG)
00097         S1R = S1R*CSCRR
00098         S1I = S1I*CSCRR
00099         S2R = STR
00100         S2I = STI
00101         CSCLR = CSCLR*TOL
00102         CSCRR = 1.0D0/CSCLR
00103         S1R = S1R*CSCLR
00104         S1I = S1I*CSCLR
00105         S2R = S2R*CSCLR
00106         S2I = S2I*CSCLR
00107    30 CONTINUE
00108       YR(N) = S2R*CSCRR
00109       YI(N) = S2I*CSCRR
00110       IF (N.EQ.1) RETURN
00111       NL = N - 1
00112       FNUI = DBLE(FLOAT(NL))
00113       K = NL
00114       DO 40 I=1,NL
00115         STR = S2R
00116         STI = S2I
00117         S2R = (FNU+FNUI)*(RZR*STR-RZI*STI) + S1R
00118         S2I = (FNU+FNUI)*(RZR*STI+RZI*STR) + S1I
00119         S1R = STR
00120         S1I = STI
00121         STR = S2R*CSCRR
00122         STI = S2I*CSCRR
00123         YR(K) = STR
00124         YI(K) = STI
00125         FNUI = FNUI - 1.0D0
00126         K = K - 1
00127         IF (IFLAG.GE.3) GO TO 40
00128         C1R = DABS(STR)
00129         C1I = DABS(STI)
00130         C1M = DMAX1(C1R,C1I)
00131         IF (C1M.LE.ASCLE) GO TO 40
00132         IFLAG = IFLAG+1
00133         ASCLE = BRY(IFLAG)
00134         S1R = S1R*CSCRR
00135         S1I = S1I*CSCRR
00136         S2R = STR
00137         S2I = STI
00138         CSCLR = CSCLR*TOL
00139         CSCRR = 1.0D0/CSCLR
00140         S1R = S1R*CSCLR
00141         S1I = S1I*CSCLR
00142         S2R = S2R*CSCLR
00143         S2I = S2I*CSCLR
00144    40 CONTINUE
00145       RETURN
00146    50 CONTINUE
00147       NZ = -1
00148       IF(NW.EQ.(-2)) NZ=-2
00149       RETURN
00150    60 CONTINUE
00151       IF (IFORM.EQ.2) GO TO 70
00152 C-----------------------------------------------------------------------
00153 C     ASYMPTOTIC EXPANSION FOR I(FNU,Z) FOR LARGE FNU APPLIED IN
00154 C     -PI/3.LE.ARG(Z).LE.PI/3
00155 C-----------------------------------------------------------------------
00156       CALL ZUNI1(ZR, ZI, FNU, KODE, N, YR, YI, NW, NLAST, FNUL, TOL,
00157      * ELIM, ALIM)
00158       GO TO 80
00159    70 CONTINUE
00160 C-----------------------------------------------------------------------
00161 C     ASYMPTOTIC EXPANSION FOR J(FNU,Z*EXP(M*HPI)) FOR LARGE FNU
00162 C     APPLIED IN PI/3.LT.ABS(ARG(Z)).LE.PI/2 WHERE M=+I OR -I
00163 C     AND HPI=PI/2
00164 C-----------------------------------------------------------------------
00165       CALL ZUNI2(ZR, ZI, FNU, KODE, N, YR, YI, NW, NLAST, FNUL, TOL,
00166      * ELIM, ALIM)
00167    80 CONTINUE
00168       IF (NW.LT.0) GO TO 50
00169       NZ = NW
00170       RETURN
00171    90 CONTINUE
00172       NLAST = N
00173       RETURN
00174       END
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines