https://github.com/m-j-w/multinomialseries.jl
Compute multinomial coefficients and natively iterate over multinomial expansions in Julia.
https://github.com/m-j-w/multinomialseries.jl
Last synced: 2 months ago
JSON representation
Compute multinomial coefficients and natively iterate over multinomial expansions in Julia.
- Host: GitHub
- URL: https://github.com/m-j-w/multinomialseries.jl
- Owner: m-j-w
- License: other
- Created: 2021-01-31T17:46:35.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2021-02-03T14:41:54.000Z (over 4 years ago)
- Last Synced: 2025-02-22T06:35:10.942Z (3 months ago)
- Language: Julia
- Homepage:
- Size: 7.81 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# MultinomialSeries
Iterate over multinomial series expansions and compute corresponding
multinomial coefficients.Status: In development, ready for public testing and comments.
## Motivation
Computing a power series or differentiation with respect to several variables
in a convenient iteration scheme. Thus, an iterator is provided performing
the expansion
and computing the multinomial coefficients

The above equations are taken from the page [Multinomial Theorem (Wikipedia)](https://en.wikipedia.org/wiki/Multinomial_theorem)
giving further explanation and applications.## Methods
eachmultinomial(m,n)
Create an iterator over all expanded elements of the multinomial series.
Returns a tuple of the requested dimension `m`. The iterator type
`MultinomialIterator` provides length and element type information, see
`Base.length`, `Base.eltype`, `Base.IteratorSize` and `Base.IteratorEltype`.multinomial(k)
Compute the multinomial coefficient from a tuple k of integers, in the same
way as the elements of the iterator `eachmultinomial` provides.### Example
```julia
for k in eachmultinomial(3,3)
@show k, multinomial(k)
end# printed output
(k, multinomial(k)) = ((3, 0, 0), 1)
(k, multinomial(k)) = ((2, 1, 0), 3)
(k, multinomial(k)) = ((2, 0, 1), 3)
(k, multinomial(k)) = ((1, 2, 0), 3)
(k, multinomial(k)) = ((1, 1, 1), 6)
(k, multinomial(k)) = ((1, 0, 2), 3)
(k, multinomial(k)) = ((0, 3, 0), 1)
(k, multinomial(k)) = ((0, 2, 1), 3)
(k, multinomial(k)) = ((0, 1, 2), 3)
(k, multinomial(k)) = ((0, 0, 3), 1)
```## References
1. [Multinomial Theorem, Wikipedia](https://en.wikipedia.org/wiki/Multinomial_theorem)
2. [Multinomial Series, Wolfram MathWorld](https://mathworld.wolfram.com/MultinomialSeries.html)
3. [Multinomial, Wolfram Mathematica Reference](https://reference.wolfram.com/language/ref/Multinomial.html)
4. [SymPy 'multinomial_coefficients'](https://docs.sympy.org/latest/modules/ntheory.html?sympy.ntheory.multinomial.multinomial_coefficients_iterator#sympy.ntheory.multinomial.multinomial_coefficients)
and [SymPy 'multinomial_coefficients_iterator', SymPy Manual, Chapter Number Theory](https://docs.sympy.org/latest/modules/ntheory.html?sympy.ntheory.multinomial.multinomial_coefficients_iterator#sympy.ntheory.multinomial.multinomial_coefficients_iterator)## Contributions
Comments, feature requests and other contributions most welcome via the
[Github issue tracker or pull requests](https://github.com/m-j-w/MultinomialSeries.jl).