Exemplo n.º 1
0
double  gammaq (double a, double x)
{
  if (x < a + 1.0)
    return 1.0 - gammser (a, x);
  else
    return gammcf (a, x);
}
Exemplo n.º 2
0
double gammq(double a, double x) {

    double gser,gcf,gln;

    if (x<0.0) errormsg("gammq(): Invalid x-value.");
    if (a<=0.0) errormsg("gammq(): Invalid a-value.");
    if (x<(a+1.0)) {
        /* Use series representation */
        if (!gammser(&gser,a,x,&gln))
            errormsg("gammq(): Error returned from gammser().");
        return 1.0-gser;
    }
    else {
        /* Use the continued fraction representation */
        if (!gammcf(&gcf,a,x,&gln))
            errormsg("gammq() Error returned from gammcf().");
        return gcf;
    }
}