|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.commons.math.util.MathUtils
Some useful additions to the built-in functions in Math
.
Method Summary | |
static long |
binomialCoefficient(int n,
int k)
Returns an exact representation of the Binomial Coefficient, " n choose k ",
the number of k -element subsets that can be selected from
an n -element set. |
static double |
binomialCoefficientDouble(int n,
int k)
Returns a double representation of the
Binomial Coefficient, "n choose k ",
the number of k -element subsets that can be selected from
an n -element set. |
static double |
binomialCoefficientLog(int n,
int k)
Returns the natural log of the
Binomial Coefficient, "n choose k ",
the number of k -element subsets that can be selected from
an n -element set. |
static double |
cosh(double x)
|
static long |
factorial(int n)
Returns n!. |
static double |
factorialDouble(int n)
Returns n!. |
static double |
factorialLog(int n)
Returns the natural logarithm of n!. |
static byte |
sign(byte x)
For a byte value x, this method returns (byte)(+1) if x >= 0 and (byte)(-1) if x < 0. |
static double |
sign(double x)
For a double precision value x, this method returns +1.0 if x >= 0 and -1.0 if x < 0. |
static float |
sign(float x)
For a float value x, this method returns +1.0F if x >= 0 and -1.0F if x < 0. |
static int |
sign(int x)
For an int value x, this method returns +1 if x >= 0 and -1 if x < 0. |
static long |
sign(long x)
For a long value x, this method returns +1L if x >= 0 and -1L if x < 0. |
static short |
sign(short x)
For a short value x, this method returns (short)(+1) if x >= 0 and (short)(-1) if x < 0. |
static double |
sinh(double x)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Method Detail |
public static double sign(double x)
x
- the value, a double
public static float sign(float x)
x
- the value, a float
public static byte sign(byte x)
x
- the value, a byte
public static short sign(short x)
x
- the value, a short
public static int sign(int x)
x
- the value, an int
public static long sign(long x)
x
- the value, a long
public static long binomialCoefficient(int n, int k)
n choose k
",
the number of k
-element subsets that can be selected from
an n
-element set.
Preconditions:
0 < k <= n
(otherwise
0 < k <= n
(otherwise
IllegalArgumentException
is thrown)long
. The
largest value of n
for which all coefficients are
< Long.MAX_VALUE
is 66. If the computed value
long
. The
largest value of n
for which all coefficients are
< Long.MAX_VALUE
is 66. If the computed value
exceeds Long.MAX_VALUE
an ArithMeticException
is thrown.
n
- the size of the setk
- the size of the subsets to be counted
n choose k
public static double binomialCoefficientDouble(int n, int k)
double
representation of the
Binomial Coefficient, "n choose k
",
the number of k
-element subsets that can be selected from
an n
-element set.
Preconditions:
0 < k <= n
(otherwise
IllegalArgumentException
is thrown)double
.
The largest value of n
for which all coefficients are
< Double.MAX_VALUE is 1029. If the computed value exceeds
Double.MAX_VALUE, Double.POSITIVE_INFINITY is returned
n
- the size of the setk
- the size of the subsets to be counted
n choose k
public static double binomialCoefficientLog(int n, int k)
log
of the
Binomial Coefficient, "n choose k
",
the number of k
-element subsets that can be selected from
an n
-element set.
Preconditions:
0 < k <= n
(otherwise
IllegalArgumentException
is thrown)
n
- the size of the setk
- the size of the subsets to be counted
n choose k
public static long factorial(int n)
n
Factorial, the product of the numbers 1,...,n
.
Preconditions:
n > 0
(otherwise
IllegalArgumentException
is thrown)long
. The
largest value of n
for which n!
< Long.MAX_VALUE is 20. If the computed value
exceeds Long.MAX_VALUE
an ArithMeticException
is thrown.
n
- argument
n!
public static double factorialDouble(int n)
n
Factorial, the product of the numbers 1,...,n
as a
double
.
Preconditions:
n > 0
(otherwise
IllegalArgumentException
is thrown)double
. The
largest value of n
for which n!
< Double.MAX_VALUE is 170. If the computed value exceeds
Double.MAX_VALUE, Double.POSITIVE_INFINITY is returned
n
- argument
n!
public static double factorialLog(int n)
Preconditions:
n > 0
(otherwise
IllegalArgumentException
is thrown)
n
- argument
n!
public static double cosh(double x)
public static double sinh(double x)
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |