Example usage for org.apache.commons.math.util MathUtils factorialLog

List of usage examples for org.apache.commons.math.util MathUtils factorialLog

Introduction

In this page you can find the example usage for org.apache.commons.math.util MathUtils factorialLog.

Prototype

public static double factorialLog(final int n) 

Source Link

Document

Returns the natural logarithm of n!.

Usage

From source file:com.cloudera.science.mgps.NFunction.java

public double eval(int n, double e) {
    double x = -n * Math.log(1 + beta / e);
    double y = -alpha * Math.log(1 + e / beta);
    double z = Gamma.logGamma(alpha + n);
    double d = Gamma.logGamma(alpha) + MathUtils.factorialLog(n);
    return Math.exp(x + y + z - d);
}