Go to the documentation of this file.00001
00002 DOUBLE PRECISION FUNCTION D9GMIT (A, X, ALGAP1, SGNGAM, ALX)
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028 DOUBLE PRECISION A, X, ALGAP1, SGNGAM, ALX, AE, AEPS, ALGS, ALG2,
00029 1 BOT, EPS, FK, S, SGNG2, T, TE, D1MACH, DLNGAM
00030 LOGICAL FIRST
00031 SAVE EPS, BOT, FIRST
00032 DATA FIRST /.TRUE./
00033
00034 IF (FIRST) THEN
00035 EPS = 0.5D0*D1MACH(3)
00036 BOT = LOG (D1MACH(1))
00037 ENDIF
00038 FIRST = .FALSE.
00039
00040 IF (X .LE. 0.D0) CALL XERMSG ('SLATEC', 'D9GMIT',
00041 + 'X SHOULD BE GT 0', 1, 2)
00042
00043 MA = A + 0.5D0
00044 IF (A.LT.0.D0) MA = A - 0.5D0
00045 AEPS = A - MA
00046
00047 AE = A
00048 IF (A.LT.(-0.5D0)) AE = AEPS
00049
00050 T = 1.D0
00051 TE = AE
00052 S = T
00053 DO 20 K=1,200
00054 FK = K
00055 TE = -X*TE/FK
00056 T = TE/(AE+FK)
00057 S = S + T
00058 IF (ABS(T).LT.EPS*ABS(S)) GO TO 30
00059 20 CONTINUE
00060 CALL XERMSG ('SLATEC', 'D9GMIT',
00061 + 'NO CONVERGENCE IN 200 TERMS OF TAYLOR-S SERIES', 2, 2)
00062
00063 30 IF (A.GE.(-0.5D0)) ALGS = -ALGAP1 + LOG(S)
00064 IF (A.GE.(-0.5D0)) GO TO 60
00065
00066 ALGS = -DLNGAM(1.D0+AEPS) + LOG(S)
00067 S = 1.0D0
00068 M = -MA - 1
00069 IF (M.EQ.0) GO TO 50
00070 T = 1.0D0
00071 DO 40 K=1,M
00072 T = X*T/(AEPS-(M+1-K))
00073 S = S + T
00074 IF (ABS(T).LT.EPS*ABS(S)) GO TO 50
00075 40 CONTINUE
00076
00077 50 D9GMIT = 0.0D0
00078 ALGS = -MA*LOG(X) + ALGS
00079 IF (S.EQ.0.D0 .OR. AEPS.EQ.0.D0) GO TO 60
00080
00081 SGNG2 = SGNGAM * SIGN (1.0D0, S)
00082 ALG2 = -X - ALGAP1 + LOG(ABS(S))
00083
00084 IF (ALG2.GT.BOT) D9GMIT = SGNG2 * EXP(ALG2)
00085 IF (ALGS.GT.BOT) D9GMIT = D9GMIT + EXP(ALGS)
00086 RETURN
00087
00088 60 D9GMIT = EXP (ALGS)
00089 RETURN
00090
00091 END