Ask Your Question
1

How to find all combinations in multinomial case

asked 2021-08-30 11:52:00 +0100

Sanu gravatar image

We can find all combinations in Sagemath using

C = Combinations(range(10),4)

Now instead of binomial, I want multinomial case. So out of 10 possible places, I want to find all combinations (4,3,3). How can we do this in Sagemath?

edit retag flag offensive close merge delete

Comments

Can you give an example of what you want?

Max Alekseyev gravatar imageMax Alekseyev ( 2021-08-30 17:51:42 +0100 )edit

We have 10 places {1,2,3,..,10}. We have to choose 4 places like {2,4,6,7}. Remaining 6 positions, we need to partition with two sets each having 3 numbers like {1,5,10} and {3,8,9}. I want to enumerate all such options.

Sanu gravatar imageSanu ( 2021-08-30 18:50:30 +0100 )edit

1 Answer

Sort by ยป oldest newest most voted
3

answered 2021-08-30 20:25:17 +0100

Max Alekseyev gravatar image

SetPartitions(range(10), [4,3,3]) will do the job.

edit flag offensive delete link more

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: 2021-08-30 11:52:00 +0100

Seen: 314 times

Last updated: Aug 30 '21