chiGser function

double chiGser(
  1. double x,
  2. double a
)

The chi Gser function

Implementation

double chiGser(double x, double a) {
  // Good for X<A+1.
  var t9 = 1 / a;
  var g = t9;
  var i = 1.0;
  while (t9 > g * .00001) {
    t9 = t9 * x / (a + i);
    g = g + t9;
    i = i + 1;
  }
  return g * exp(a * log(x) - x - lngamma(a));
}