How does one output the combinations (with repeated elements) in Maple? I tried:
with(combinat):
choose([a, b, c], 2)
$$[[a, b], [a, c], [b, c]]$$
These are all combinations without repeated elements. How does one get [a,a], [b,b] and [c,c] in the output list.
The documentation for
choose(n, m)mentions:This suggests this algorithm takes duplicate values correctly into consideration, you just need to mention those duplicates in the list explicitly. So something like this works just fine:
While it would be nice to have this supported as an additional parameter, you can just write such function by yourself. Such as for example:
This will return combinations of members of $n$ length $m$ (to use original notation) with maximal of $k$ repetitions, so