object Combinatorics extends Error
The Combinatorics
object provides several common combinatorics functions,
such as factorial permutations, combinations, gamma and beta functions.
- Alphabetic
- By Inheritance
- Combinatorics
- Error
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
betaF(a: Double, b: Double): Double
Compute the beta function 'B(a, b)' for the following two cases: (1) when 'a' or 'b' are integers and (2) when 'a' or 'b' are integers + 1/2.
Compute the beta function 'B(a, b)' for the following two cases: (1) when 'a' or 'b' are integers and (2) when 'a' or 'b' are integers + 1/2.
- a
the first parameter, a real number satisfying (1) or (2)
- b
the second parameter, a real number satisfying (1) or (2)
- See also
http://mathworld.wolfram.com/BetaFunction.html
-
def
choose(n: Int, k: Int, l: Int): Long
Compute trinomial coefficients: 'n' choose '(k, l'), combinations of 'n' things, '(k, l)' at a time, using Pascal's Tetrahedron.
Compute trinomial coefficients: 'n' choose '(k, l'), combinations of 'n' things, '(k, l)' at a time, using Pascal's Tetrahedron. Ex: Given 'n' balls, counts ways in which 'k' are chosen for group 1 and 'l' are chosen for group 2.
- n
the total number of items
- k
the of items to choose
- l
the of items to choose (requires 0 <= k + l <= n)
- See also
http://people.sju.edu/~pklingsb/bintrin.pdf
-
def
choose(n: Int, k: Int): Long
Compute binomial coefficients: 'n' choose 'k', combinations of 'n' things, 'k' at a time, using Pascal's Triangle.
Compute binomial coefficients: 'n' choose 'k', combinations of 'n' things, 'k' at a time, using Pascal's Triangle.
- n
the total number of items
- k
the of items to choose (requires k <= n)
- See also
http://www.mathsisfun.com/pascals-triangle.html
-
def
chose(n: Int, k: Int): Long
Compute 'n' choose 'k' (combinations of 'n' things, 'k' at a time).
Compute 'n' choose 'k' (combinations of 'n' things, 'k' at a time). A more efficient implementation is given below.
- n
the total number of items
- k
the of items to choose (requires k <= n)
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
fac(k: Int): Double
Compute 'k' factorial 'k!' using three techniques (requires 'k <= 170').
Compute 'k' factorial 'k!' using three techniques (requires 'k <= 170').
- k
the nonnegative integer-valued argument to the factorial function
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
flaw(method: String, message: String): Unit
Show the flaw by printing the error message.
Show the flaw by printing the error message.
- method
the method where the error occurred
- message
the error message
- Definition Classes
- Error
-
def
gammaF(a: Double): Double
Compute the gamma function 'gamma (a)' using the Lanczos Approximation.
Compute the gamma function 'gamma (a)' using the Lanczos Approximation.
- a
the parameter, a real number
- See also
http://en.wikipedia.org/wiki/Lanczos_approximation
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
-
def
hyp2f1(a: Double, b: Double, c: Double, z: Double): Double
Compute the Gauss Hypergeometric function '2F1(a, b, c; z)' using a power series expansion.
Compute the Gauss Hypergeometric function '2F1(a, b, c; z)' using a power series expansion.
- a
the first parameter, a real/complex number
- b
the second parameter, a real/complex number
- c
the third parameter, a real/complex number, may not be a negative integer
- z
the variable, a real/complex number s.t. |z| < 1
- See also
people.maths.ox.ac.uk/porterm/research/pearson_final.pdf
en.wikipedia.org/wiki/Hypergeometric_function For faster or more robust algorithms,
http://dx.doi.org/10.1016/j.cpc.2007.11.007
-
def
iBetaF(z: Double, a: Double, b: Double): Double
Compute the incomplete beta function 'B(z; a, b)', a generalization of the beta function 'z = 1'.
Compute the incomplete beta function 'B(z; a, b)', a generalization of the beta function 'z = 1'.
- z
the variable, a real/complex number s.t. 0 <= |z| <= 1
- a
the first parameter, a real/complex number > 0
- b
the second parameter, a real/complex number > 0
- See also
http://mathworld.wolfram.com/IncompleteBetaFunction.html
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
val
lfac: Array[Long]
Table of all factorial numbers that can be represented as a long (64-bit) integer
-
def
logfac(k: Int): Double
Compute the natural log factorial 'ln (k!)' so 'k! = exp (logfac (k))'.
Compute the natural log factorial 'ln (k!)' so 'k! = exp (logfac (k))'. The formula is a log transformation of Ramanujan's Factorial Approximation.
- k
the value to take the log factorial of
-
def
mfac(k: Int): Long
For small 'k', compute 'k' factorial by iterative multiplication.
For small 'k', compute 'k' factorial by iterative multiplication.
k! = k * (k-1) * ... * 2 * 1- k
the nonnegative integer-valued argument to the factorial function
-
def
mortici(k: Int): Double
Compute 'k!' using Mortici's Factorial Approximation (more accurate than Stirling's 2nd Order Factorial Approximation).
Compute 'k!' using Mortici's Factorial Approximation (more accurate than Stirling's 2nd Order Factorial Approximation).
- k
the nonnegative integer-valued argument to the factorial function
- See also
http://but.unitbv.ro/BU2010/Series%20III/BULETIN%20III%20PDF/Mathematics/Mortici.pdf
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
-
val
pascalTet: Array[Array[Array[Int]]]
Initial part of Pascal's Tetrahedron, precomputed to speed calculations (Trinomial Coefficients)
Initial part of Pascal's Tetrahedron, precomputed to speed calculations (Trinomial Coefficients)
- See also
https://sites.google.com/site/pascalloids/pascal-s-pyramid-3-var
-
val
pascalTri: Array[Array[Int]]
Initial part of Pascal's Triangle, precomputed to speed calculations (Binomial Coefficients)
-
def
perm(n: Int, k: Int): Long
Compute permutations of 'k' items selected from 'n' total items.
Compute permutations of 'k' items selected from 'n' total items.
- n
the total number of items
- k
the of items selected
-
def
rBetaC(z: Double, a: Double, b: Double): Double
Compute the complement of the regularized (incomplete) beta function '1.0 - I(z; a, b) = I(1.0 - z; b, a)'.
Compute the complement of the regularized (incomplete) beta function '1.0 - I(z; a, b) = I(1.0 - z; b, a)'.
- z
the variable, a real/complex number s.t. 0 <= |z| <= 1
- a
the first parameter, a real/complex number > 0
- b
the second parameter, a real/complex number > 0
-
def
rBetaF(z: Double, a: Double, b: Double): Double
Compute the regularized (incomplete) beta function 'I(z; a, b)'.
Compute the regularized (incomplete) beta function 'I(z; a, b)'.
- z
the variable, a real/complex number s.t. 0 <= |z| <= 1
- a
the first parameter, a real/complex number > 0
- b
the second parameter, a real/complex number > 0
- See also
http://mathworld.wolfram.com/RegularizedBetaFunction.html
-
def
ramanujan(k: Int): Double
Compute 'k!' using Ramanujan's Factorial Approximation (more accurate than Mortici's Factorial Approximation).
Compute 'k!' using Ramanujan's Factorial Approximation (more accurate than Mortici's Factorial Approximation).
- k
the nonnegative integer-valued argument to the factorial function
- See also
http://files.ele-math.com/articles/jmi-05-53.pdf
-
def
rfac(k: Int, x: Double = 1.0): Double
Compute the 'k'th degree rising factorial of 'x'.
Compute the 'k'th degree rising factorial of 'x'. When 'x = 1', this is the regular factorial function 'k!'. Also known as Pochhammer's symbol. Caveat: only works when 'k' is a nonnegative integer
- k
the number of factors in the product
- x
the base number to start the product
-
def
stirling(k: Int): Double
Compute 'k!' using Stirling's 2-nd Order Factorial Approximation.
Compute 'k!' using Stirling's 2-nd Order Factorial Approximation.
- k
the nonnegative integer-valued argument to the factorial function
- See also
http://en.wikipedia.org/wiki/Stirling%27s_approximation
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )