public class SpecialMath extends Object
Constructor and Description |
---|
SpecialMath() |
Modifier and Type | Method and Description |
---|---|
static double |
bernoulli(int n)
Computes an approximation to the n'th Bernoulli number
Bn.
|
static double |
beta(double z,
double w)
Computes the Beta function B(z,w)
|
static double |
betaIncReg(double x,
double a,
double b)
Computes the regularized incomplete beta function, Ix(a, b).
|
static double |
digamma(double x)
Computes the value of the digamma function, Ψ(x), which is the
derivative of
lnGamma(double) . |
static double |
erf(double x) |
static double |
erfc(double x) |
static double |
gamma(double z)
The gamma function is a generalization of the factorial function.
|
static double |
gammaIncLow(double a,
double z)
Computes the lower incomplete gamma function, γ(a,z).
|
static double |
gammaIncUp(double a,
double z)
Computes the incomplete gamma function, Γ(a,z).
|
static double |
gammaP(double a,
double z)
Returns the regularized gamma function P(a,z) = γ(a,z)/Γ(a).
|
static double |
gammaPSeries(double a,
double z) |
static double |
gammaQ(double a,
double z)
Computes the regularized gamma function Q(a,z) = Γ(a,z)/Γ(a).
|
static double |
invBetaIncReg(double p,
double a,
double b)
Computes the inverse of the incomplete beta function,
Ip-1(a,b), such that
Ix(a, b) = p. |
static double |
invErf(double x) |
static double |
invErfc(double x) |
static double |
invGammaP(double p,
double a)
Finds the value x such that
P(a,x) = p. |
static double |
invXlnX(double y) |
static double |
lnBeta(double z,
double w) |
static double |
lnGamma(double z)
Computes the natural logarithm of
gamma(double) . |
static double |
reLnBn(int n)
Computes the real part of the natural logarithm of the Bernoulli numbers.
|
static double |
zeta(double x)
Computes the Riemann zeta function ζ(x) for some value of x
This method may return: Double.NaN for x = 1 (would be complex infinity)
NOTE: This method is not yet complete in terms of accuracy. |
public static double invXlnX(double y)
public static double gamma(double z)
Double.NaN
returned if z = 0 or z = Double.NEGATIVE_INFINITY
z
- any real valuepublic static double lnGamma(double z)
gamma(double)
.
This method is more numerically stable than taking the log of the result of Γ(z).
Double.POSITIVE_INFINITY
returned if z ≤ 0Double.NaN
returned if z = Double.NEGATIVE_INFINITY
z
- any real number valuepublic static double digamma(double x)
lnGamma(double)
. Double.NaN
for zero and negative integer values (would be complex infinity)x
- the value to compute the digamma function atpublic static double zeta(double x)
Double.NaN
for x = 1 (would be complex infinity)x
- a real valued inputpublic static double reLnBn(int n)
Double.NEGATIVE_INFINITY
and for any value less than 0 will
return Double.NaN
.
n
- the integer Bernoulli value to obtain an approximation ofpublic static double bernoulli(int n)
reLnBn(int)
should
be used instead when possible.n
- the bernoulli number to computepublic static double erf(double x)
public static double invErf(double x)
public static double erfc(double x)
public static double invErfc(double x)
public static double beta(double z, double w)
z
- w
- public static double lnBeta(double z, double w)
public static double betaIncReg(double x, double a, double b)
x
- any value in the range [0, 1]a
- any value ≥ 0b
- any value ≥ 0public static double invBetaIncReg(double p, double a, double b)
Ix(a, b)
= p.
The returned value, x, will always be in the range [0,1].
The input p, must also be in the range [0,1].p
- any value in the range [0,1]a
- any value ≥ 0b
- any value ≥ 0Ix(a, b)
will return p.public static double gammaQ(double a, double z)
Double.NaN
for a<0, though real values of Q(a,z) do exista
- any value ≥ 0z
- any value > 0public static double gammaPSeries(double a, double z)
public static double gammaP(double a, double z)
Double.NaN
for a<0, though real values of P(a,z) do exista
- any value ≥ 0z
- any value > 0public static double invGammaP(double p, double a)
P(a,x)
= p.a
- any real valuep
- and value in the range [0, 1]public static double gammaIncUp(double a, double z)
Double.NaN
for z ≤ 0a
- any value (-∞, ∞)z
- any value > 0public static double gammaIncLow(double a, double z)
Double.NaN
for z ≤ 0a
- any value (-∞, ∞)z
- any value > 0Copyright © 2017. All rights reserved.