Partition of a set.
2 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
rohini more
am 30 Mär. 2021
Kommentiert: rohini more
am 6 Apr. 2021
consider a partition of X=
with
where
denotes the union of disjoint sets.
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/567224/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/567229/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/567234/image.png)
Remark that
,
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/567239/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/567244/image.png)
![](https://www.mathworks.com/matlabcentral/answers/uploaded_files/567249/image.png)
I would like to implement the matlab code for above partition.
Please help me .
Thanks in advance.
3 Kommentare
Akzeptierte Antwort
Bruno Luong
am 30 Mär. 2021
Bearbeitet: Bruno Luong
am 30 Mär. 2021
>> N=5; L=3;
>> h=allVL1(L,N-L)+1;
>> H=arrayfun(@(r) mat2cell(1:N,1,h(r,:)),(1:size(h,1))','unif',false);
>> DispPartObj(H) % FEX in my other answer
The 6 partition(s) are:
{1} {2} {3 4 5}
{1} {2 3} {4 5}
{1} {2 3 4} {5}
{1 2} {3} {4 5}
{1 2} {3 4} {5}
{1 2 3} {4} {5}
2 Kommentare
Weitere Antworten (1)
Bruno Luong
am 30 Mär. 2021
Bearbeitet: Bruno Luong
am 30 Mär. 2021
>> N=5; L=3;
>> DispPartObj(SetPartition(N,L))
The 25 partition(s) are:
{1 2 3} {4} {5}
{1 2 4} {3} {5}
{1 2} {3 4} {5}
{1 3 4} {2} {5}
{1 3} {2 4} {5}
{1 4} {2 3} {5}
{1} {2 3 4} {5}
{1 2 5} {3} {4}
{1 2} {3 5} {4}
{1 2} {3} {4 5}
{1 3 5} {2} {4}
{1 3} {2 5} {4}
{1 3} {2} {4 5}
{1 5} {2 3} {4}
{1} {2 3 5} {4}
{1} {2 3} {4 5}
{1 4 5} {2} {3}
{1 4} {2 5} {3}
{1 4} {2} {3 5}
{1 5} {2 4} {3}
{1} {2 4 5} {3}
{1} {2 4} {3 5}
{1 5} {2} {3 4}
{1} {2 5} {3 4}
{1} {2} {3 4 5}
Siehe auch
Kategorien
Mehr zu Logical finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!