The TELEMAC-MASCARET system  trunk
bief_gammp.f
Go to the documentation of this file.
1 ! ************************************
2  DOUBLE PRECISION FUNCTION bief_gammp
3 ! ************************************
4 !
5  &(a,x)
6 !
7 !***********************************************************************
8 ! BIEF V6P3 07/03/2013
9 !***********************************************************************
10 !
11 !brief Incomplete Gamma function (until all compilers have it),
12 !+ P(a,x) from 'Numerical Recipes' Chapter 6.2, and Tideway model
13 !+ This function is only valid for X.GE.0 or A.GT.0. Negative
14 !+ X or A.LE.0 cannot occur when called from ERF or ERFC.
15 !
16 !history D J Evans-Roberts (HRW)
17 !+ 23/11/1993
18 !+ V6P3
19 !+ First version sent by Michiel Knaapen (HRW) on 07/03/2013.
20 !
21 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
22 !| A |-->| PARAMETER
23 !| X |-->| OPERAND
24 !~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
25 !
26 ! USE BIEF
27 !
29  IMPLICIT NONE
30 !
31 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
32 !
33  DOUBLE PRECISION, INTENT(IN) :: X,A
34 !
35 !+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+
36 !
37  DOUBLE PRECISION GAMMCF,GLN
38 !
39 !-----------------------------------------------------------------------
40 !
41  IF(x.LT.a+1.d0) THEN
42 ! Use the series representation
43  CALL bief_gser(bief_gammp,a,x,gln)
44  ELSE
45 ! Use the continued fraction representation and take its complement
46  CALL bief_gcf(gammcf,a,x,gln)
47  bief_gammp = 1.d0 - gammcf
48  ENDIF
49 !
50 !-----------------------------------------------------------------------
51 !
52  RETURN
53  END
subroutine bief_gser(GAMSER, A, X, GLN)
Definition: bief_gser.f:7
double precision function bief_gammp(A, X)
Definition: bief_gammp.f:7
subroutine bief_gcf(GAMMCF, A, X, GLN)
Definition: bief_gcf.f:7