List of utility methods to do Gamma
double | gammaFunction(double in) Returns gamma value for a double in. if (in == 1.0) { return 1.0; if (in == 0.5) { return Math.sqrt(Math.PI); return (in - 1) * gammaFunction(in - 1); |
double | gammaFwd(double lc) gamma Fwd return (lc > 0.0031308) ? (1.055 * Math.pow(lc, 1 / 2.4) - 0.055) : (lc * 12.92);
|
double | gammaln(double x) from numerical recipes in c (p. double ser = 1.00000000090015; double y = x; double tmp = x + 5.5; tmp -= (x + 0.5) * Math.log(tmp); for (int j = 0; j < 5; j++) { ser += COFGAMMALN[j] / ++y; return -tmp + Math.log(ser * 2.5066282751072975 / x); ... |
double | gammaOfArgOn2Plus1(int d) Computes gamma(d/2 + 1) See http://en.wikipedia.org/wiki/Gamma_function for description of the analytical result for d odd. if (d % 2 == 0) { return factorialAsDouble(d / 2); } else { return Math.sqrt(Math.PI) * (double) doubleFactorialAsDouble(d) / (double) Math.pow(2, ((double) (d + 1)) / 2.0); |
double | gammaOfArgOn2Plus1IncludeDivisor(int d, double divisor) Computes gamma(d/2 + 1)/divisor See http://en.wikipedia.org/wiki/Gamma_function for description of the analytical result for d odd. if (d % 2 == 0) { return factorialAsDoubleIncludeDivisor(d / 2, divisor); } else { return doubleFactorialAsDoublewithDivisor(d, divisor * Math.pow(2, ((double) (d + 1)) / 2.0) / Math.sqrt(Math.PI)); |
double | gammaPdf(double x, double a) gamma Pdf if (x <= 0.0) { return 0.0; } else { return Math.exp(Math.log(x) * (a - 1) - x - lngamma(a)); |
double | gammaRand(double a) Gamma random generator. double e, x, u0, u1, u2, v, w, c, c1, c2, c3, c4, c5; boolean done; e = Math.exp(1.0); if (a < 1.0) { done = false; c = (a + e) / e; do { u0 = uniformRand(); ... |