Class FallingFactorial
java.lang.Object
de.tilman_neumann.jml.combinatorics.FallingFactorial
public class FallingFactorial
extends java.lang.Object
Implementations of the falling factorial (n)_k = (n-k+1)*...*n.
In combinatorics this can be interpreted as the number of variations of (n-k) and k indistinguishable objects of two different kinds.
Note that the coefficients of the expanded polynomial are (signed) Stirling numbers of the first kind.
E.g. (n)_5 = (n-4)*(n-3)*(n-2)*(n-1)*n = 24n - 50n^2 + 35n^3 - 10n^4 + n^5 = s(5,1)n + s(5,2)n^2 + s(5,3)n^3 + s(5,4)n^4 + s(5,5)n^5
-
Constructor Summary
Constructors Constructor Description FallingFactorial()
-
Method Summary
Modifier and Type Method Description static java.math.BigInteger
fallingFactorial(int n, int k)
Computes the falling factorial.static void
main(java.lang.String[] args)
TestMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Constructor Details
-
FallingFactorial
public FallingFactorial()
-
-
Method Details
-
fallingFactorial
public static java.math.BigInteger fallingFactorial(int n, int k) throws java.lang.IllegalArgumentExceptionComputes the falling factorial.- Parameters:
n
-k
-- Returns:
- falling factorial (n)_k
- Throws:
java.lang.IllegalArgumentException
- if k<0
-
main
public static void main(java.lang.String[] args)Test- Parameters:
args
- ignored
-