Skip to content

AFNI/NIfTI Server

Sections
Personal tools
You are here: Home » AFNI » Documentation

Doxygen Source Code Documentation


Main Page   Alphabetical List   Data Structures   File List   Data Fields   Globals   Search  

cdf_03.c

Go to the documentation of this file.
00001 #include "cdflib.h"
00002 double apser(double *a,double *b,double *x,double *eps)
00003 /*
00004 -----------------------------------------------------------------------
00005      APSER YIELDS THE INCOMPLETE BETA RATIO I(SUB(1-X))(B,A) FOR
00006      A .LE. MIN(EPS,EPS*B), B*X .LE. 1, AND X .LE. 0.5. USED WHEN
00007      A IS VERY SMALL. USE ONLY IF ABOVE INEQUALITIES ARE SATISFIED.
00008 -----------------------------------------------------------------------
00009 */
00010 {
00011 static double g = .577215664901533e0;
00012 static double apser,aj,bx,c,j,s,t,tol;
00013 /*
00014      ..
00015      .. Executable Statements ..
00016 */
00017     bx = *b**x;
00018     t = *x-bx;
00019     if(*b**eps > 2.e-2) goto S10;
00020     c = log(*x)+psi(b)+g+t;
00021     goto S20;
00022 S10:
00023     c = log(bx)+g+t;
00024 S20:
00025     tol = 5.0e0**eps*fabs(c);
00026     j = 1.0e0;
00027     s = 0.0e0;
00028 S30:
00029     j += 1.0e0;
00030     t *= (*x-bx/j);
00031     aj = t/j;
00032     s += aj;
00033     if(fabs(aj) > tol) goto S30;
00034     apser = -(*a*(c+s));
00035     return apser;
00036 } /* END */
 

Powered by Plone

This site conforms to the following standards: