diff options
author | Raymond Hettinger <rhettinger@users.noreply.github.com> | 2019-06-04 08:23:06 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-06-04 08:23:06 (GMT) |
commit | 963eb0f4738456455b9bef7eb531b46805415208 (patch) | |
tree | bd083ca435e4fe0f67410d06db5cf98674865a73 /Doc/library/math.rst | |
parent | 0fd2c300c2a85b3b227a907b2a39ef79fa86d850 (diff) | |
download | cpython-963eb0f4738456455b9bef7eb531b46805415208.zip cpython-963eb0f4738456455b9bef7eb531b46805415208.tar.gz cpython-963eb0f4738456455b9bef7eb531b46805415208.tar.bz2 |
bpo-35431: Drop the k <= n requirement (GH-13798)
Diffstat (limited to 'Doc/library/math.rst')
-rw-r--r-- | Doc/library/math.rst | 20 |
1 files changed, 12 insertions, 8 deletions
diff --git a/Doc/library/math.rst b/Doc/library/math.rst index c5a77f1..4a15789 100644 --- a/Doc/library/math.rst +++ b/Doc/library/math.rst @@ -41,12 +41,15 @@ Number-theoretic and representation functions Return the number of ways to choose *k* items from *n* items without repetition and without order. - Also called the binomial coefficient. It is mathematically equal to the expression - ``n! / (k! (n - k)!)``. It is equivalent to the coefficient of the *k*-th term in the - polynomial expansion of the expression ``(1 + x) ** n``. + Evaluates to ``n! / (k! * (n - k)!)`` when ``k <= n`` and evaluates + to zero when ``k > n``. - Raises :exc:`TypeError` if the arguments not integers. - Raises :exc:`ValueError` if the arguments are negative or if *k* > *n*. + Also called the binomial coefficient because it is equivalent + to the coefficient of k-th term in polynomial expansion of the + expression ``(1 + x) ** n``. + + Raises :exc:`TypeError` if either of the arguments not integers. + Raises :exc:`ValueError` if either of the arguments are negative. .. versionadded:: 3.8 @@ -212,10 +215,11 @@ Number-theoretic and representation functions Return the number of ways to choose *k* items from *n* items without repetition and with order. - It is mathematically equal to the expression ``n! / (n - k)!``. + Evaluates to ``n! / (n - k)!`` when ``k <= n`` and evaluates + to zero when ``k > n``. - Raises :exc:`TypeError` if the arguments not integers. - Raises :exc:`ValueError` if the arguments are negative or if *k* > *n*. + Raises :exc:`TypeError` if either of the arguments not integers. + Raises :exc:`ValueError` if either of the arguments are negative. .. versionadded:: 3.8 |