1.2.3-SNAPSHOT permalink Arrow_down_16x16

choose

incanter.core

  • (choose n k)

Returns number of k-combinations (each of size k) from a set S with
n elements (size n), which is the binomial coefficient (also known
as the 'choose function') [wikipedia]
choose = n!/(k!(n - k)!)

Equivalent to R's choose function.

Examples:
(choose 25 6) ; => 2,598,960

References:
http://incanter.org/docs/parallelcolt/api/cern/jet/math/tdouble/DoubleArithmetic.html
http://en.wikipedia.org/wiki/Combination

0 Examples top

Log in to add / edit an example.

See Also top

Log in to add a see also.

Plus_12x12 Minus_12x12 Source incanter/core.clj:604 top

(defn choose
"
  Returns number of k-combinations (each of size k) from a set S with
  n elements (size n), which is the binomial coefficient (also known
  as the 'choose function') [wikipedia]
        choose = n!/(k!(n - k)!)

  Equivalent to R's choose function.

  Examples:
    (choose 25 6) ; => 2,598,960

  References:
    http://incanter.org/docs/parallelcolt/api/cern/jet/math/tdouble/DoubleArithmetic.html
    http://en.wikipedia.org/wiki/Combination

"
  ([n k] (DoubleArithmetic/binomial (double n) (long k))))
Vars in incanter.core/choose: defn double long
Used in 0 other vars

Comments top

No comments for choose. Log in to add a comment.