Macaulay2 » Documentation
Packages » TensorComplexes :: multiSubsets
next | previous | forward | backward | up | index | toc

multiSubsets -- produce all subsets of a given size, allowing repetitions

Synopsis

Description

multiSubsets(L,n) yields all multisets of cardinality $n$ with element from $L$. multiSubsets(m,n) yields all multisets of cardinality $n$ with elements in the list $\{0,\dots,m-1\}$.

i1 : L={a,b,c}

o1 = {a, b, c}

o1 : List
i2 : multiSubsets(L,2)

o2 = {{a, a}, {a, b}, {b, b}, {a, c}, {b, c}, {c, c}}

o2 : List
i3 : multiSubsets(3,2)

o3 = {{0, 0}, {0, 1}, {1, 1}, {0, 2}, {1, 2}, {2, 2}}

o3 : List

See also

Ways to use multiSubsets :

For the programmer

The object multiSubsets is a method function.