public class Num
extends java.lang.Object
| Modifier and Type | Field and Description |
|---|---|
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.
|
| Modifier and Type | Method and Description |
|---|---|
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 |
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 |
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, evaluated in a numerically stable way.
|
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 |
lnFactorial(int 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 |
log1p(double x)
Deprecated.
|
static double |
log2(double x)
Returns log2(x).
|
static double |
multMod(double a,
double s,
double c,
double m)
Deprecated.
|
static int |
multMod(int a,
int s,
int c,
int m)
Deprecated.
|
static long |
multMod(long a,
long s,
long c,
long m)
Deprecated.
|
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.
|
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
public static int gcd(int x,
int y)
x - integery - integerpublic static long gcd(long x,
long y)
x - integery - integerpublic static double combination(int n,
int s)
n - total number of objectss - number of chosen objects on a combinationpublic static double factorial(int n)
n - the integer for which the factorial must be computedpublic static double lnFactorial(int n)
n - the integer for which the log-factorial has to be computedpublic static double[][] calcMatStirling(int m,
int n)
m - number of rows of the allocated matrixn - number of columns of the allocated matrixpublic static double log2(double x)
x - the value for which the logarithm must be computed@Deprecated public static double log1p(double x)
x - the argument of the functionpublic static double lnGamma(double x)
x - the value for which the lnGamma function must be computedpublic 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 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 dimensionspublic static double bernoulliPoly(int n,
double x)
public static double evalCheby(double[] a,
int n,
double x)
+ ∑j=1najTj(x).
a - coefficients of the polynomialsn - largest degree of polynomialsx - the parameter of the Tj functionspublic static double evalChebyStar(double[] a,
int n,
double x)
a - coefficients of the polynomialsn - largest degree of polynomialsx - the parameter of the Tj* functionspublic static double besselK025(double x)
x - value at which the function is calculatedpublic static double erf(double x)
x - value at which the function is calculatedpublic static double erfc(double x)
x - value at which the function is calculated@Deprecated
public static int multMod(int a,
int s,
int c,
int m)
ArithmeticMod.multModM(a, s, c, m). Returns
(as + c)mod m.
Restriction: assumes that
a, c, s < m.a - first term of the products - second term of the productc - shift factorm - the used modulo@Deprecated
public static long multMod(long a,
long s,
long c,
long m)
ArithmeticMod.multModM(a, s, c, m).
Returns
(as + c)mod m. Restriction: assumes that
a, c, s < m.a - first term of the products - second term of the productc - shift factorm - the used modulo@Deprecated
public static double multMod(double a,
double s,
double c,
double m)
ArithmeticMod.multModM(a, s, c, m). Returns
(as + c)mod m.
Restriction: assumes that a, s, c are < m and
a, s, c, m are < 235.a - first term of the products - second term of the productc - shift factorm - the used moduloTo submit a bug or ask questions, send an e-mail to Pierre L'Ecuyer.