|
SSJ V. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object umontreal.iro.lecuyer.util.Num
public class Num
This class provides a few constants and some methods to compute numerical quantities such as factorials, combinations, gamma functions, and so on.
Field Summary | |
---|---|
static int |
DBL_DIG
Number of decimal digits of precision in a double. |
static double |
DBL_EPSILON
Difference between 1.0 and the smallest double greater than 1.0. |
static int |
DBL_MAX_10_EXP
Largest int x such that 10x is representable (approximately) as a double. |
static int |
DBL_MAX_EXP
Largest int x such that 2x-1 is representable (approximately) as a double. |
static double |
DBL_MIN
Smallest normalized positive floating-point double. |
static int |
DBL_MIN_EXP
Smallest int x such that 2x-1 is representable (approximately) as a normalised double. |
static double |
EBASE
The constant e. |
static double |
EULER
The Euler-Mascheroni constant. |
static double |
ILN2
The values of 1/ln 2. |
static double |
IRAC2
The value of 1/(2)1/2. |
static double |
LN_DBL_MIN
Natural logarithm of DBL_MIN. |
static double |
LN2
The values of ln 2. |
static double |
MAXINTDOUBLE
Largest integer n0 = 253 such that any integer n <= n0 is represented exactly as a double. |
static double |
MAXTWOEXP
Powers of 2 up to MAXTWOEXP are stored exactly in the array TWOEXP. |
static double |
RAC2
The value of (2)1/2. |
static double[] |
TEN_NEG_POW
Contains the precomputed negative powers of 10. |
static double[] |
TWOEXP
Contains the precomputed positive powers of 2. |
Method Summary | |
---|---|
static double |
bernoulliPoly(int n,
double x)
Evaluates the Bernoulli polynomial Bn(x) of degree n at x. |
static double |
besselK025(double x)
Returns the value of K1/4(x), where Ka is the modified Bessel's function of the second kind. |
static double[][] |
calcMatStirling(int m,
int n)
Computes and returns the Stirling numbers of the second kind |
static double |
combination(int n,
int s)
Returns the number of different combinations of s objects amongst n. |
static double |
digamma(double x)
Returns the value of the logarithmic derivative of the Gamma function ψ(x) = Γ'(x)/Γ(x). |
static double |
erf(double x)
Returns the value of erf(x), the error function. |
static double |
erfc(double x)
Returns the value of erfc(x), the complementary error function. |
static double |
erfcInv(double u)
Returns the value of erfc -1(u), the inverse of the complementary error function. |
static double |
erfInv(double u)
Returns the value of erf -1(u), the inverse of the error function. |
static double |
evalCheby(double[] a,
int n,
double x)
Evaluates a series of Chebyshev polynomials Tj at x over the basic interval [- 1, 1]. |
static double |
evalChebyStar(double[] a,
int n,
double x)
Evaluates a series of shifted Chebyshev polynomials Tj* at x over the basic interval [0, 1]. |
static double |
expBesselK1(double x,
double y)
Returns the value of exK1(y), where K1 is the modified Bessel function of the second kind of order 1. |
static double |
factoPow(int n)
Returns the value of factorial(n)/nn. |
static double |
factorial(int n)
Returns the value of factorial n. |
static double |
gammaRatioHalf(double x)
Returns the value of the ratio Γ(x + 1/2)/Γ(x) of two gamma functions. |
static int |
gcd(int x,
int y)
Returns the greatest common divisor (gcd) of x and y. |
static long |
gcd(long x,
long y)
Returns the greatest common divisor (gcd) of x and y. |
static double |
harmonic(long n)
Computes the n-th harmonic number Hn = ∑j=1n1/j. |
static double |
harmonic2(long n)
. |
static double |
lnBeta(double lam,
double nu)
Computes the natural logarithm of the Beta function B(λ, ν). |
static double |
lnCombination(int n,
int s)
Returns the natural logarithm ofnumber of different combinations of s objects amongst n. |
static double |
lnFactorial(int n)
Returns the value of the natural logarithm of factorial n. |
static double |
lnFactorial(long n)
Returns the value of the natural logarithm of factorial n. |
static double |
lnGamma(double x)
Returns the natural logarithm of the gamma function Γ(x) evaluated at x. |
static double |
log2(double x)
Returns log2(x). |
static double |
sumKahan(double[] A,
int n)
Implementation of the Kahan summation algorithm. |
static double |
tetragamma(double x)
Returns the value of the tetragamma function d2ψ(x)/d2x, the second derivative of the digamma function, evaluated at x. |
static double |
trigamma(double x)
Returns the value of the trigamma function dψ(x)/dx, the derivative of the digamma function, evaluated at x. |
static double |
volumeSphere(double p,
int t)
Returns the volume V of a sphere of radius 1 in t dimensions using the norm Lp. |
Methods inherited from class java.lang.Object |
---|
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final double DBL_EPSILON
public static final int DBL_MAX_EXP
public static final int DBL_MIN_EXP
public static final int DBL_MAX_10_EXP
public static final double DBL_MIN
public static final double LN_DBL_MIN
public static final int DBL_DIG
public static final double EBASE
public static final double EULER
public static final double RAC2
public static final double IRAC2
public static final double LN2
public static final double ILN2
public static final double MAXINTDOUBLE
public static final double MAXTWOEXP
public static final double[] TWOEXP
public static final double[] TEN_NEG_POW
Method Detail |
---|
public static int gcd(int x, int y)
x
- integery
- integer
public static long gcd(long x, long y)
x
- integery
- integer
public static double combination(int n, int s)
n
- total number of objectss
- number of chosen objects on a combination
public static double lnCombination(int n, int s)
n
- total number of objectss
- number of chosen objects on a combination
public static double factorial(int n)
n
- the integer for which the factorial must be computed
public static double lnFactorial(int n)
n
- argument of the log-factorial
public static double lnFactorial(long n)
n
- argument of the log-factorial
public static double factoPow(int n)
n
- integer
public static double[][] calcMatStirling(int m, int n)
m
- number of rows of the allocated matrixn
- number of columns of the allocated matrix
public static double log2(double x)
x
- the value for which the logarithm must be computed
public static double lnGamma(double x)
x
- the value for which the lnGamma function must be computed
public static double lnBeta(double lam, double nu)
public static double digamma(double x)
public static double trigamma(double x)
public static double tetragamma(double x)
public static double gammaRatioHalf(double x)
public static double sumKahan(double[] A, int n)
public static double harmonic(long n)
public static double harmonic2(long n)
public static double volumeSphere(double p, int t)
p
- index of the used normt
- number of dimensions
public static double bernoulliPoly(int n, double x)
B0(x) | = | 1 | |
B2(x) | = | x2 - x + 1/6 | |
B4(x) | = | x4 -2x3 + x2 - 1/30 | |
B6(x) | = | x6 -3x5 +5x4/2 - x2/2 + 1/42 | |
B8(x) | = | x8 -4x7 +14x6/3 - 7x4/3 + 2x2/3 - 1/30. |
public static double evalCheby(double[] a, int n, double x)
a
- coefficients of the polynomialsn
- largest degree of polynomialsx
- the parameter of the Tj functions
public static double evalChebyStar(double[] a, int n, double x)
a
- coefficients of the polynomialsn
- largest degree of polynomialsx
- the parameter of the Tj* functions
public static double besselK025(double x)
x
- value at which the function is calculated
public static double expBesselK1(double x, double y)
public static double erf(double x)
x
- value at which the function is calculated
public static double erfc(double x)
x
- value at which the function is calculated
public static double erfInv(double u)
u
- value at which the function is calculated
public static double erfcInv(double u)
u
- value at which the function is calculated
|
SSJ V. 2.6.2. |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |