|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math3.special.Beta
public class Beta
This is a utility class that provides computation methods related to the Beta family of functions.
Implementation of logBeta(double, double)
is based on the
algorithms described in
Field Summary | |
---|---|
private static double |
DEFAULT_EPSILON
Maximum allowed numerical error. |
private static double[] |
DELTA
The coefficients of the series expansion of the Δ function. |
private static double |
HALF_LOG_TWO_PI
The constant value of ½log 2π. |
Constructor Summary | |
---|---|
private |
Beta()
Default constructor. |
Method Summary | |
---|---|
private static double |
deltaMinusDeltaSum(double a,
double b)
Returns the value of Δ(b) - Δ(a + b), with 0 ≤ a ≤ b and b ≥ 10. |
static double |
logBeta(double p,
double q)
Returns the value of log B(p, q) for 0 ≤ x ≤ 1 and p, q > 0. |
static double |
logBeta(double a,
double b,
double epsilon,
int maxIterations)
Deprecated. as of version 3.1, this method is deprecated as the computation of the beta function is no longer iterative; it will be removed in version 4.0. Current implementation of this method internally calls logBeta(double, double) . |
private static double |
logGammaMinusLogGammaSum(double a,
double b)
Returns the value of log[Γ(b) / Γ(a + b)] for a ≥ 0 and b ≥ 10. |
private static double |
logGammaSum(double a,
double b)
Returns the value of log Γ(a + b) for 1 ≤ a, b ≤ 2. |
static double |
regularizedBeta(double x,
double a,
double b)
Returns the regularized beta function I(x, a, b). |
static double |
regularizedBeta(double x,
double a,
double b,
double epsilon)
Returns the regularized beta function I(x, a, b). |
static double |
regularizedBeta(double x,
double a,
double b,
double epsilon,
int maxIterations)
Returns the regularized beta function I(x, a, b). |
static double |
regularizedBeta(double x,
double a,
double b,
int maxIterations)
Returns the regularized beta function I(x, a, b). |
private static double |
sumDeltaMinusDeltaSum(double p,
double q)
Returns the value of Δ(p) + Δ(q) - Δ(p + q), with p, q ≥ 10. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
private static final double DEFAULT_EPSILON
private static final double HALF_LOG_TWO_PI
private static final double[] DELTA
The coefficients of the series expansion of the Δ function. This function is defined as follows
see equation (23) in Didonato and Morris (1992). The series expansion, which applies for x ≥ 10, reads
14 ==== 1 \ 2 n Δ(x) = --- > d (10 / x) x / n ==== n = 0
Constructor Detail |
---|
private Beta()
Method Detail |
---|
public static double regularizedBeta(double x, double a, double b)
x
- Value.a
- Parameter a
.b
- Parameter b
.
MaxCountExceededException
- if the algorithm fails to converge.public static double regularizedBeta(double x, double a, double b, double epsilon)
x
- Value.a
- Parameter a
.b
- Parameter b
.epsilon
- When the absolute value of the nth item in the
series is less than epsilon the approximation ceases to calculate
further elements in the series.
MaxCountExceededException
- if the algorithm fails to converge.public static double regularizedBeta(double x, double a, double b, int maxIterations)
x
- the value.a
- Parameter a
.b
- Parameter b
.maxIterations
- Maximum number of "iterations" to complete.
MaxCountExceededException
- if the algorithm fails to converge.public static double regularizedBeta(double x, double a, double b, double epsilon, int maxIterations)
x
- the value.a
- Parameter a
.b
- Parameter b
.epsilon
- When the absolute value of the nth item in the
series is less than epsilon the approximation ceases to calculate
further elements in the series.maxIterations
- Maximum number of "iterations" to complete.
MaxCountExceededException
- if the algorithm fails to converge.@Deprecated public static double logBeta(double a, double b, double epsilon, int maxIterations)
logBeta(double, double)
.
a
- Parameter a
.b
- Parameter b
.epsilon
- This parameter is ignored.maxIterations
- This parameter is ignored.
private static double logGammaSum(double a, double b) throws OutOfRangeException
DGSMLN
. In BetaTest#testLogGammaSum()
,
this private method is accessed through reflection.
a
- First argument.b
- Second argument.
log(Gamma(a + b))
.
OutOfRangeException
- if a
or b
is lower than
1.0
or greater than 2.0
.private static double logGammaMinusLogGammaSum(double a, double b) throws NumberIsTooSmallException
DLGDIV
. In
BetaTest#testLogGammaMinusLogGammaSum()
, this private method is
accessed through reflection.
a
- First argument.b
- Second argument.
log(Gamma(b) / Gamma(a + b))
.
NumberIsTooSmallException
- if a < 0.0
or b < 10.0
.private static double deltaMinusDeltaSum(double a, double b) throws OutOfRangeException, NumberIsTooSmallException
a
- First argument.b
- Second argument.
Delta(b) - Delta(a + b)
OutOfRangeException
- if a < 0
or a > b
NumberIsTooSmallException
- if b < 10
private static double sumDeltaMinusDeltaSum(double p, double q)
DBCORR
. In
BetaTest#testSumDeltaMinusDeltaSum()
, this private method is
accessed through reflection.
p
- First argument.q
- Second argument.
Delta(p) + Delta(q) - Delta(p + q)
.
NumberIsTooSmallException
- if p < 10.0
or q < 10.0
.public static double logBeta(double p, double q)
DBETLN
.
p
- First argument.q
- Second argument.
log(Beta(p, q))
, NaN
if
p <= 0
or q <= 0
.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |