1

Is there some function recently added to Mathematica that facilitates forming all partitions of a n-element set into k subsets?

In other words, something that easily gives the same thing as what Combinatorica`KSetPartitions does?

I'm aware of the defined function KSetP at Partition a set into $k$ non-empty subsets, but that has quite a bit of code.

My query here is asking for something at a higher level than the aforementioned function KSetP that is made possible by some built-in function either that was recently added to Mathematica or was previously available but was not exploited in KSetP.

murray
  • 11,888
  • 2
  • 26
  • 50
  • How big is your n likely to be? For small n there may be something simpler, but I would guess that since there are $2^n$ subsets, it quickly becomes tricky to keep the computational costs down. – aardvark2012 Oct 31 '17 at 22:52
  • @JasonB.: I referenced that; but please look at the framing of my question again. – murray Nov 01 '17 at 00:28
  • @aardvark2012: I want something that works for general n. The issue is whether some built-in function, especially one added recently, can take care of a lot more of the work at a lower level, hence no need to do the detailed coding shown for kSetP. – murray Nov 01 '17 at 00:30
  • 2
    @murray - I don't see the distinction really. Is there a built in function to do this? I can't find it if there is. You say the KSetP function has quite a bit of code, but it's definition is only 11 lines. – Jason B. Nov 01 '17 at 03:12
  • There are more answers here, one of which may be "at a higher level". – KennyColnago Nov 01 '17 at 16:34

0 Answers0