code: public static double Incomplete(double a, double x) {
          double ans, ax, c, r;
  
          if (x <= 0 || a <= 0) return 0.0;
  
          if (x > 1.0 && x > a) return 1.0 - ComplementedIncomplete(a, x);
  
          ax = a * Math.log(x) - x - Log(a);
          if (ax < -Constants.LogMax) return (0.0);
  
          ax = Math.exp(ax);
  
          r = a;
          c = 1.0;
          ans = 1.0;
  
          do {
              r += 1.0;
              c *= x / r;
              ans += c;
          } while (c / ans > Constants.DoubleEpsilon);
  
          return (ans * ax / a);
      }
docs: Incomplete gamma function.
  
  @param a Value.
  @param x Value.
  @return Result.