|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object net.sourceforge.domian.test.combinatorics.Combinatorics
public final class Combinatorics
This class contains methods for performing basic combinatoric operations such as calculating numbers of permutations and combinations.
Constructor Summary | |
---|---|
Combinatorics()
|
Method Summary | |
---|---|
static java.math.BigInteger |
C(int m,
int n)
Calculates the number of combinations (math:"n over m") of n elements chosen from a list of m elements. |
static void |
check(int m,
int n)
Checks that 0 <= n <= m. |
static java.math.BigInteger |
factorial(int n)
Calculates the factorial (math: !) |
static java.math.BigInteger |
P(int n)
Calculates the number of possible orderings of n elements where each element can only appear once (permutations), chosen from list of m elements (m set equal to n). |
static java.math.BigInteger |
P(int m,
int n)
Calculates the number of possible orderings of n elements where each element can only appear once (permutations), chosen from list of m elements. |
static java.math.BigInteger |
S(int m,
int n)
Calculates the number of possible orderings of n elements, chosen from list of m elements. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public Combinatorics()
Method Detail |
---|
public static void check(int m, int n)
public static java.math.BigInteger factorial(int n)
n
- the ... damn, what was the name of this mathematical entity again?
public static java.math.BigInteger S(int m, int n)
Med "ordnet" menes det at rekkefølgen som elementene er ordnet etter tas hensyn til.S(m,n) = m^n
Med "med tilbakelegging" menes det at elementene kan forekomme mer enn en gang.
m
- the number of elements to use within each number sequence.n
- the length of the number sequence list.
public static java.math.BigInteger P(int n)
Med "ordnet" menes det at rekkefølgen som elementene er ordnet etter tas hensyn til.
Med "uten tilbakelegging" menes det at ingen elementer kan forekomme mer enn en gang.
S(n,n) = n!/(n-n)! = n!/1 = n!
n
- the length of the permutation list.
public static java.math.BigInteger P(int m, int n)
Med "ordnet" menes det at rekkefølgen som elementene er ordnet etter tas hensyn til.S(m,n) = n * (n-1) * ... * (n-m+1) = n!/(n-m)!
Med "uten tilbakelegging" menes det at ingen elementer kan forekomme mer enn en gang.
m
- the number of elements to use within each permutation.n
- the length of the permutation list.
public static java.math.BigInteger C(int m, int n)
Med "uordnet" menes det at rekkefølgen som elementene er ordnet etter er uinteressant.C(m,n) = n!/(m!*(n-m)!) = S(n,m)/m!
Med "uten tilbakelegging" menes det at ingen elementer kan forekomme mer enn en gang.
m
- the number of elements to use within each combination.n
- length of the combination list.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |