Skip to content

Instantly share code, notes, and snippets.

@hrgnz
Last active February 10, 2025 02:51
Show Gist options
  • Save hrgnz/14dc9c56f68f7bf2a2be1ac98bdedd40 to your computer and use it in GitHub Desktop.
Save hrgnz/14dc9c56f68f7bf2a2be1ac98bdedd40 to your computer and use it in GitHub Desktop.
リストの分割 != リストの分割
abc390dで使用。集合をいくつかの部分集合に分割する。
Needs["Combinatorica`"]
res = SetPartitions@lst;
```mathematica
In[]:= Clear["Global`*"]
n = 6;
Needs["Combinatorica`"]
comb = SetPartitions@Range@n;
Length@comb == BellB@n
Out[]= True
```
How can I obtain all partitions of a list in Mathematica?
https://stackoverflow.com/questions/8304892/how-can-i-obtain-all-partitions-of-a-list-in-mathematica
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment