dlbeta.f

Go to the documentation of this file.
00001 *DECK DLBETA
00002       DOUBLE PRECISION FUNCTION DLBETA (A, B)
00003 C***BEGIN PROLOGUE  DLBETA
00004 C***PURPOSE  Compute the natural logarithm of the complete Beta
00005 C            function.
00006 C***LIBRARY   SLATEC (FNLIB)
00007 C***CATEGORY  C7B
00008 C***TYPE      DOUBLE PRECISION (ALBETA-S, DLBETA-D, CLBETA-C)
00009 C***KEYWORDS  FNLIB, LOGARITHM OF THE COMPLETE BETA FUNCTION,
00010 C             SPECIAL FUNCTIONS
00011 C***AUTHOR  Fullerton, W., (LANL)
00012 C***DESCRIPTION
00013 C
00014 C DLBETA(A,B) calculates the double precision natural logarithm of
00015 C the complete beta function for double precision arguments
00016 C A and B.
00017 C
00018 C***REFERENCES  (NONE)
00019 C***ROUTINES CALLED  D9LGMC, DGAMMA, DLNGAM, DLNREL, XERMSG
00020 C***REVISION HISTORY  (YYMMDD)
00021 C   770701  DATE WRITTEN
00022 C   890531  Changed all specific intrinsics to generic.  (WRB)
00023 C   890531  REVISION DATE from Version 3.2
00024 C   891214  Prologue converted to Version 4.0 format.  (BAB)
00025 C   900315  CALLs to XERROR changed to CALLs to XERMSG.  (THJ)
00026 C   900727  Added EXTERNAL statement.  (WRB)
00027 C***END PROLOGUE  DLBETA
00028       DOUBLE PRECISION A, B, P, Q, CORR, SQ2PIL, D9LGMC, DGAMMA, DLNGAM,
00029      1  DLNREL
00030       EXTERNAL DGAMMA
00031       SAVE SQ2PIL
00032       DATA SQ2PIL / 0.9189385332 0467274178 0329736405 62 D0 /
00033 C***FIRST EXECUTABLE STATEMENT  DLBETA
00034       P = MIN (A, B)
00035       Q = MAX (A, B)
00036 C
00037       IF (P .LE. 0.D0) CALL XERMSG ('SLATEC', 'DLBETA',
00038      +   'BOTH ARGUMENTS MUST BE GT ZERO', 1, 2)
00039 C
00040       IF (P.GE.10.D0) GO TO 30
00041       IF (Q.GE.10.D0) GO TO 20
00042 C
00043 C P AND Q ARE SMALL.
00044 C
00045       DLBETA = LOG (DGAMMA(P) * (DGAMMA(Q)/DGAMMA(P+Q)) )
00046       RETURN
00047 C
00048 C P IS SMALL, BUT Q IS BIG.
00049 C
00050  20   CORR = D9LGMC(Q) - D9LGMC(P+Q)
00051       DLBETA = DLNGAM(P) + CORR + P - P*LOG(P+Q)
00052      1  + (Q-0.5D0)*DLNREL(-P/(P+Q))
00053       RETURN
00054 C
00055 C P AND Q ARE BIG.
00056 C
00057  30   CORR = D9LGMC(P) + D9LGMC(Q) - D9LGMC(P+Q)
00058       DLBETA = -0.5D0*LOG(Q) + SQ2PIL + CORR + (P-0.5D0)*LOG(P/(P+Q))
00059      1  + Q*DLNREL(-P/(P+Q))
00060       RETURN
00061 C
00062       END
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Defines