Package org.apache.commons.numbers.gamma
Class LogBeta
- java.lang.Object
-
- org.apache.commons.numbers.gamma.LogBeta
-
public final class LogBeta extends java.lang.Object
Computes \( log_e B(p, q) \).This class is immutable.
-
-
Field Summary
Fields Modifier and Type Field Description private static double[]
DELTA
The coefficients of the series expansion of the \( \Delta \) function.private static double
HALF_LOG_TWO_PI
The constant value of ½log 2π.private static double
TEN
The threshold value of 10 where the series expansion of the \( \Delta \) function applies.private static double
THOUSAND
The threshold value of 1000 for algorithm switch.private static double
TWO
The threshold value of 2 for algorithm switch.
-
Constructor Summary
Constructors Modifier Constructor Description private
LogBeta()
Private constructor.
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description private static double
deltaMinusDeltaSum(double a, double b)
Returns the value of \( \Delta(b) - \Delta(a + b) \), with \( 0 \leq a \leq b \) and \( b \geq 10 \).private static double
logGammaMinusLogGammaSum(double a, double b)
Returns the value of \( \log ( \Gamma(b) / \Gamma(a + b) ) \) for \( a \geq 0 \) and \( b \geq 10 \).private static double
sumDeltaMinusDeltaSum(double p, double q)
Returns the value of \( \Delta(p) + \Delta(q) - \Delta(p + q) \), with \( p, q \geq 10 \).static double
value(double p, double q)
Returns the value of \( \log B(p, q) \) for \( 0 \leq x \leq 1 \) and \( p, q > 0 \).
-
-
-
Field Detail
-
TEN
private static final double TEN
The threshold value of 10 where the series expansion of the \( \Delta \) function applies.- See Also:
- Constant Field Values
-
TWO
private static final double TWO
The threshold value of 2 for algorithm switch.- See Also:
- Constant Field Values
-
THOUSAND
private static final double THOUSAND
The threshold value of 1000 for algorithm switch.- See Also:
- Constant Field Values
-
HALF_LOG_TWO_PI
private static final double HALF_LOG_TWO_PI
The constant value of ½log 2π.- See Also:
- Constant Field Values
-
DELTA
private static final double[] DELTA
The coefficients of the series expansion of the \( \Delta \) function. This function is defined as follows: \[ \Delta(x) = \log \Gamma(x) - (x - \frac{1}{2}) \log a + a - \frac{1}{2} \log 2\pi, \]See equation (23) in Didonato and Morris (1992). The series expansion, which applies for \( x \geq 10 \), reads
\[ \Delta(x) = \frac{1}{x} \sum_{n = 0}^{14} d_n (\frac{10}{x})^{2 n} \]
-
-
Method Detail
-
deltaMinusDeltaSum
private static double deltaMinusDeltaSum(double a, double b)
Returns the value of \( \Delta(b) - \Delta(a + b) \), with \( 0 \leq a \leq b \) and \( b \geq 10 \). Based on equations (26), (27) and (28) in Didonato and Morris (1992).- Parameters:
a
- First argument.b
- Second argument.- Returns:
- the value of \( \Delta(b) - \Delta(a + b) \)
- Throws:
java.lang.IllegalArgumentException
- ifa < 0
ora > b
java.lang.IllegalArgumentException
- ifb < 10
-
sumDeltaMinusDeltaSum
private static double sumDeltaMinusDeltaSum(double p, double q)
Returns the value of \( \Delta(p) + \Delta(q) - \Delta(p + q) \), with \( p, q \geq 10 \). Based on the NSWC Library of Mathematics Subroutines implementation,DBCORR
.- Parameters:
p
- First argument.q
- Second argument.- Returns:
- the value of \( \Delta(p) + \Delta(q) - \Delta(p + q) \).
- Throws:
java.lang.IllegalArgumentException
- ifp < 10
orq < 10
.
-
value
public static double value(double p, double q)
Returns the value of \( \log B(p, q) \) for \( 0 \leq x \leq 1 \) and \( p, q > 0 \). Based on the NSWC Library of Mathematics Subroutines implementation,DBETLN
.- Parameters:
p
- First argument.q
- Second argument.- Returns:
- the value of \( \log B(p, q) \), or
NaN
ifp <= 0
orq <= 0
.
-
logGammaMinusLogGammaSum
private static double logGammaMinusLogGammaSum(double a, double b)
Returns the value of \( \log ( \Gamma(b) / \Gamma(a + b) ) \) for \( a \geq 0 \) and \( b \geq 10 \). Based on the NSWC Library of Mathematics Subroutines implementation,DLGDIV
.- Parameters:
a
- First argument.b
- Second argument.- Returns:
- the value of \( \log(\Gamma(b) / \Gamma(a + b) \).
- Throws:
java.lang.IllegalArgumentException
- ifa < 0
orb < 10
.
-
-