Things on this page are fragmentary and immature notes/thoughts of the author. Please read with your own judgement!
%%classpath add mvn
org.apache.commons commons-math3 3.6.1Loading...
Loading...
import org.apache.commons.math3.util.CombinatoricsUtils._import org.apache.commons.math3.util.CombinatoricsUtils._
binomialCoefficient¶
binomialCoefficient(5, 3)10binomialCoefficientDouble(5, 3)10.0binomialCoefficientLog(5, 3)2.302585092994046checkBinomial(5, 3)combinationsIterator¶
Notice that this methods returns an iterator of the type java.util.Iterator[Array[Int]], which is not a Scala Iterator! For combinations/permutations iterator, it is suggested that you use Seq.combinations and/or Seq.permutations.
val it = combinationsIterator(5, 3)org.apache.commons.math3.util.Combinations$LexicographicIterator@1ab48026Factorial¶
factorial(10)3628800factorial(100)org.apache.commons.math3.exception.MathArithmeticException: arithmetic exception
at org.apache.commons.math3.util.CombinatoricsUtils.factorial(CombinatoricsUtils.java:281)
... 46 elidedfactorialDouble(100)9.332621544395286E157factorialDouble(20)2.43290200817664E18factorialLog(100)363.7393755555636Stirling¶
stirlingS2(10, 3)9330