|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectjstats.Statistic
Statistic is the base class of the jstats package, providing a number of static methods useful for collections of data.
| Field Summary | |
static java.util.Locale |
locale
|
static int |
STIRLING_THRESHOLD
Numbers greater than this will have factorials computed using Stirling's Approximation |
| Constructor Summary | |
Statistic()
|
|
| Method Summary | |
static double |
combination(double n,
double r)
Combination function: nCr = n! |
static double |
factorial(double n)
Performs factorial (n!) |
static double |
permutation(double n,
double r)
Permutation function: nPr = n! |
static double |
StirlingApproximation(double n)
Stirling's Approximation for a factorial: For large values of n, n! |
static double |
summation(double[] values)
Sum of all the values in an array. |
static double |
summation(long[] values)
Sum of all the values in an array. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final int STIRLING_THRESHOLD
public static java.util.Locale locale
| Constructor Detail |
public Statistic()
| Method Detail |
public static double factorial(double n)
throws StatisticException
Performs factorial (n!) function. Uses Stirling's Approximation for n > 50.
Note that n, while a double, must be an integer value; any fractional component of n is discarded before the factorial is computed; i.e., the factorial of 6.8 will be computed as a factorial of 6 (factorial(6.8) == 6!).
n - number to factor
StatisticException - for n < 0public static double StirlingApproximation(double n)
n - number to factor
public static double permutation(double n,
double r)
throws StatisticException
Permutation function:
nPr = n!/(n-r)!
Note that n and r, while doubles, must actually be integer values and are calculated as such; any fractional component is discarded
n - number of items from which to selectr - number of items in selection
StatisticException - if n < r or r < 0 or n < 0
public static double combination(double n,
double r)
throws StatisticException
Combination function:
nCr = n!/(n-r)!r!
Note that n and r, while doubles, must actually be integer values and are calculated as such; any fractional component is discarded
n - number of items from which to selectr - length of combination sequence
StatisticException - if n < r or n < 0 or r < 0
public static double summation(double[] values)
throws StatisticException
values - an array of doubles.
StatisticException - for an empty array
public static double summation(long[] values)
throws StatisticException
values - an array of longs.
StatisticException - for an empty array
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||