Processing math: 100%
Ask Your Question
1

Multipartitions of a multiset in Sage

asked 4 years ago

GA3165 gravatar image

Let L = [0,1,1,2,2,2,2,]. I want to generate all the multi-partitions of L in which each part can have repeated entries and the parts themselves can repeat in the partition.

For example, [[0],[1,2],[1,2],[2,2]] is one such partition of L.

Kindly help me with this. Thank you.

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 4 years ago

rburing gravatar image

Generate partitions of list(range(len(L))) and apply kL[k] to each element in each part?

Preview: (hide)
link

Comments

@rburing. Thank you. It works. Cute idea.

GA3165 gravatar imageGA3165 ( 4 years ago )

@GA3165 -- I turned @rburing's comment into an answer.

You can accept it to mark the question as solved.

slelievre gravatar imageslelievre ( 4 years ago )

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 4 years ago

Seen: 320 times

Last updated: Oct 07 '20