First time here? Check out the FAQ!

Ask Your Question
1

How to list weak compositions?

asked 0 years ago

Comb4 gravatar image

I would like to know if there's a way to list weak compositions in SageMath Similar to: list(Compositions(2, length=2)) The result is: [[1, 1]] I would like to have: [[1, 1],[2, 0],[0, 2]]

Preview: (hide)

1 Answer

Sort by » oldest newest most voted
1

answered 0 years ago

Max Alekseyev gravatar image

IntegerVectors do that. E.g. IntegerVectors(2,2).list() give [[2, 0], [1, 1], [0, 2]] as requested.

Preview: (hide)
link

Comments

It would be nice to have a "See also: IntegerVectors" in the documentation for Compositions.

slelievre gravatar imageslelievre ( 0 years ago )

I see such "See also" there. Don't you?

Max Alekseyev gravatar imageMax Alekseyev ( 0 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

Stats

Asked: 0 years ago

Seen: 175 times

Last updated: Jun 02