Binomial
The binomial coefficient , the number of k-element subsets of an n-element set.
Binomial coefficientMathWorldBinomialCoefficientWikidataQ209875Encyclopedia of MathematicsBinomial_coefficientsBritannicatopic/binomial-coefficientDLMF26.31.2.iFungrimBinomial✓Fungrim entryOEISA073354Wolfram LanguageBinomial!Binomial(n, k)the binomial coefficient .enumeratio_binomial(n, k)SymPybinomial(n, k)mpmathbinomial(n, k)Oscarbinomial(ZZ(n), ZZ(k))Juliabinomial(ZZ(n), ZZ(k))Rustbinomial(n, k)Typed signatures
| Type | Package | Applies |
|---|---|---|
(complex | infinity, complex | infinity) -> number | analyticreplaces compute-engine | always |
(complex | infinity, complex | infinity) -> number | compute-engine | always |
(complex | infinity, complex | infinity) -> number | number-theoryreplaces analytic | always |
Details
- The general definition runs through the Gamma function: .
- Symmetric in its arguments: .
- Pascal's rule builds each row from the last: .
- Row sums give .
- compute-engine evaluates only integer n and k: k outside gives 0 for nonnegative n, while a negative n switches to the generalized falling-factorial formula rather than the Gamma form.
- A Gaussian or otherwise complex n and/or k also evaluates, through the same Gamma-function identity: exact for an integer k, numeric otherwise.
Plot
Examples
16 more kept as data, checked against the oraclesScope #
Half-integer arguments evaluate exactly through the Gamma function: here , so the answer is just
live ↗Applications #
Properties #
Possible issues #
About
| Examples | 56 |
|---|---|
| Checked against | Wolfram Language 55 agree1 differSageMath 51 agree3 differSymPy 49 agree5 differ2 unevaluatedmpmath 41 agree1 differmathlib4 16 agree19 errorOscar 26 agree2 differ8 errorJulia 27 agree3 differ12 errorRust 17 agree13 differ10 error |
| Crosswalk | WikipediaMathWorldWikidataEncyclopedia of MathematicsBritannicaDLMF ×2FungrimFungrim entry ×23OEISWolfram LanguageSageMathSymPympmathOscarJuliaRust |
Implementation
wolframpackages/oracle/src/mappings.tsWolfram's (and compute-engine's) Binomial extends to negative n and k via the reflection identities in its docs (e.g. Binomial[5,-2] = 0, Binomial[-7,2] = 28, Binomial[-5,-7] = 15); the crates behind sage/oscar/julia/rust bottom out at unsigned or non-negative-only integer types and diverge there — a convention gap, not a bug on either side. Verified against wolframscript.
sympypackages/oracle/src/mappings.tsWolfram's (and compute-engine's) Binomial extends to negative n and k via the reflection identities in its docs (e.g. Binomial[5,-2] = 0, Binomial[-7,2] = 28, Binomial[-5,-7] = 15); the crates behind sage/oscar/julia/rust bottom out at unsigned or non-negative-only integer types and diverge there — a convention gap, not a bug on either side. Verified against wolframscript.
sagepackages/oracle/src/mappings.tsSage's binomial needs m or x-m an integer; enumeratio_binomial falls back to the Gamma ratio otherwise (run.ts) and answers a complex infinity at a pole of Gamma(x+1), as ours does. A negative n with an integer k agrees (binomial(-5, 2) = 15); two negative integers give 0 where Wolfram and compute-engine take the limit (Binomial[-2,-2] = 1), a convention gap, not a bug on either side.
oscarpackages/oracle/src/mappings.tsWolfram's (and compute-engine's) Binomial extends to negative n and k via the reflection identities in its docs (e.g. Binomial[5,-2] = 0, Binomial[-7,2] = 28, Binomial[-5,-7] = 15); the crates behind sage/oscar/julia/rust bottom out at unsigned or non-negative-only integer types and diverge there — a convention gap, not a bug on either side. Verified against wolframscript.
juliapackages/oracle/src/mappings.tsWolfram's (and compute-engine's) Binomial extends to negative n and k via the reflection identities in its docs (e.g. Binomial[5,-2] = 0, Binomial[-7,2] = 28, Binomial[-5,-7] = 15); the crates behind sage/oscar/julia/rust bottom out at unsigned or non-negative-only integer types and diverge there — a convention gap, not a bug on either side. Verified against wolframscript.
mathlib4packages/oracle/src/mappings.tsWolfram's (and compute-engine's) Binomial extends to negative n and k via the reflection identities in its docs (e.g. Binomial[5,-2] = 0, Binomial[-7,2] = 28, Binomial[-5,-7] = 15); the crates behind sage/oscar/julia/rust bottom out at unsigned or non-negative-only integer types and diverge there — a convention gap, not a bug on either side. Verified against wolframscript.
rustpackages/oracle/src/mappings.tsWolfram's (and compute-engine's) Binomial extends to negative n and k via the reflection identities in its docs (e.g. Binomial[5,-2] = 0, Binomial[-7,2] = 28, Binomial[-5,-7] = 15); the crates behind sage/oscar/julia/rust bottom out at unsigned or non-negative-only integer types and diverge there — a convention gap, not a bug on either side. Verified against wolframscript.
mpmathpackages/oracle/src/mappings.ts See also: Factorial, Multinomial, Pochhammer