"Fossies" - the Fresh Open Source Software Archive

Member "scipy-1.3.0/scipy/special/cdflib/apser.f" (25 Oct 2018, 1213 Bytes) of package /linux/misc/scipy-1.3.0.tar.xz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) Fortran 77 source code syntax highlighting (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file. For more information about "apser.f" see the Fossies "Dox" file reference documentation.

    1       DOUBLE PRECISION FUNCTION apser(a,b,x,eps)
    2 C-----------------------------------------------------------------------
    3 C     APSER YIELDS THE INCOMPLETE BETA RATIO I(SUB(1-X))(B,A) FOR
    4 C     A .LE. MIN(EPS,EPS*B), B*X .LE. 1, AND X .LE. 0.5. USED WHEN
    5 C     A IS VERY SMALL. USE ONLY IF ABOVE INEQUALITIES ARE SATISFIED.
    6 C-----------------------------------------------------------------------
    7 C     .. Scalar Arguments ..
    8       DOUBLE PRECISION a,b,eps,x
    9 C     ..
   10 C     .. Local Scalars ..
   11       DOUBLE PRECISION aj,bx,c,g,j,s,t,tol
   12 C     ..
   13 C     .. External Functions ..
   14       DOUBLE PRECISION psi
   15       EXTERNAL psi
   16 C     ..
   17 C     .. Intrinsic Functions ..
   18       INTRINSIC abs,dlog
   19 C     ..
   20 C     .. Data statements ..
   21 C--------------------
   22       DATA g/.577215664901533D0/
   23 C     ..
   24 C     .. Executable Statements ..
   25 C--------------------
   26       bx = b*x
   27       t = x - bx
   28       IF (b*eps.GT.2.D-2) GO TO 10
   29       c = dlog(x) + psi(b) + g + t
   30       GO TO 20
   31 
   32    10 c = dlog(bx) + g + t
   33 C
   34    20 tol = 5.0D0*eps*abs(c)
   35       j = 1.0D0
   36       s = 0.0D0
   37    30 j = j + 1.0D0
   38       t = t* (x-bx/j)
   39       aj = t/j
   40       s = s + aj
   41       IF (abs(aj).GT.tol) GO TO 30
   42 C
   43       apser = -a* (c+s)
   44       RETURN
   45 
   46       END