You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@commons.apache.org by "Gilles Sadowski (Jira)" <ji...@apache.org> on 2022/11/02 11:19:00 UTC

[jira] [Commented] (MATH-1652) comments about the formula of binomialCoefficient wrong

    [ https://issues.apache.org/jira/browse/MATH-1652?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17627622#comment-17627622 ] 

Gilles Sadowski commented on MATH-1652:
---------------------------------------

See second formula [here|https://en.wikipedia.org/wiki/Binomial_coefficient].

Using the MathJax syntax, a readability improvement would be
{noformat}
(n choose k) = \( \frac{n!}{k! (n-k)!} \)
{noformat}

Note that this functionality has been ported to [Commons Numbers|https://commons.apache.org/numbers] (and removed from the development branch of Commons Math).
Hence, potential changes should be discussed in the corresponding [JIRA project|https://issues.apache.org/jira/projects/NUMBERS/issues].

> comments about the formula of binomialCoefficient wrong
> -------------------------------------------------------
>
>                 Key: MATH-1652
>                 URL: https://issues.apache.org/jira/browse/MATH-1652
>             Project: Commons Math
>          Issue Type: Improvement
>            Reporter: nimo mayr
>            Priority: Minor
>
> The class
> {code:java}
> org.apache.commons.math3.util.CombinatoricsUtils{code}
> within the method 
> {code:java}
> public static long binomialCoefficient(final int n, final int k){code}
> contains the following comments:
> {code:java}
> // We use the formula
> // (n choose k) = n! / (n-k)! / k!
> // (n choose k) == ((n-k+1)...*n) / (1...*k)
> // which could be written
> // (n choose k) == (n-1 choose k-1) * n / k
> {code}
> I think, the second line
> {code:java}
> (n choose k) = n! / (n-k)! / k!{code}
> must be written to
> {code:java}
> (n choose k) = n! / (n-k)! * k!{code}



--
This message was sent by Atlassian Jira
(v8.20.10#820010)