-
-
Notifications
You must be signed in to change notification settings - Fork 34.5k
bpo-35431: Add a function computing binomial numbers to the math module #11018
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0651138
5665470
7a1d05b
ff7084b
4a1d3bd
bbf79c6
87f71ac
dba9385
eb8860c
5169915
4b5b1d3
bd731e3
ecb234e
a1e6496
d1e4964
2a5b01e
5b1532c
9c0a3d0
9f50476
bf49e8a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -218,6 +218,22 @@ Number-theoretic and representation functions | |||||
| :meth:`x.__trunc__() <object.__trunc__>`. | ||||||
|
|
||||||
|
|
||||||
| .. function:: comb(n, k) | ||||||
|
|
||||||
| Return the binomial coefficient indexed by the pair of integers n >= k >= 0. | ||||||
|
|
||||||
| It is the coefficient of kth term in polynomial expansion of the expression | ||||||
| (1 + x)^n. It is also known as the number of ways to choose an unordered | ||||||
| subset of k elements from a fixed set of n elements, usually called | ||||||
| *n choose k*. | ||||||
|
|
||||||
| Raises :exc:`TypeError` if argument(s) are non-integer, :exc:`ValueError` | ||||||
| if argument(s) are negative or k > n, and :exc:`OverflowError` if k and (n-k) | ||||||
| are too large (beyond `LLONG_MAX`). | ||||||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. @FR4NKESTI3N Does that seem like reasonable wording? |
||||||
|
|
||||||
| .. versionadded:: 3.8 | ||||||
|
|
||||||
|
|
||||||
| Note that :func:`frexp` and :func:`modf` have a different call/return pattern | ||||||
| than their C equivalents: they take a single argument and return a pair of | ||||||
| values, rather than returning their second return value through an 'output | ||||||
|
|
||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| Implement :func:`math.comb` that returns binomial coefficient, that is the | ||
| coefficient of kth term in expansion of polynomial (1 + x)^n. | ||
| Patch by Keller Fuchs and Yash Aggarwal. |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Other parts of this file use double asterisks (**) for exponentiation, which is less likely to be confused with other meanings such as the XOR operator.