Re: [sage-devel] Re: Counting integer compositions with restrictions

2019-02-22 Thread TB
On 21/02/2019 9:59, Jori Mäntysalo (TAU) wrote: On Tue, 19 Feb 2019, TB wrote: There is the cardinality method of IntegerVectors. Note that the default for min_part is 0. So this could be used for...? I do not know the area. I was just playing with numbers (original question was "In how many

Re: [sage-devel] Re: Counting integer compositions with restrictions

2019-02-21 Thread Travis Scrimshaw
One example where enumeration of these (with say a fixed sum) is useful is for computing ordered set partitions by breaking the problem up into sets of fixed sizes. Best, Travis On Thursday, February 21, 2019 at 5:59:56 PM UTC+10, Jori Mäntysalo (TAU) wrote: > > On Tue, 19 Feb 2019, TB wrote:

Re: [sage-devel] Re: Counting integer compositions with restrictions

2019-02-21 Thread TAU
On Tue, 19 Feb 2019, TB wrote: > There is the cardinality method of IntegerVectors. Note that the default for > min_part is 0. So this could be used for...? I do not know the area. I was just playing with numbers (original question was "In how many ways you can arrange a queue of 9 men and 7 w

Re: [sage-devel] Re: Counting integer compositions with restrictions

2019-02-19 Thread TB
There is the cardinality method of IntegerVectors. Note that the default for min_part is 0. It is implemented in src/sage/combinat/integer_vector.py without brute force enumeration under some constraints. Looking at it now, I think there is a bug at line 1331: It will never enter the if clause

[sage-devel] Re: Counting integer compositions with restrictions

2019-02-19 Thread 'Martin R' via sage-devel
I am guessing that it should be sufficiently fast to compute the cardinality using the generating series. That is, for compositions with parts in a set S this would be 1/(1-sum_{s in S} x^s) with special cases S = {a,...,b} and S = {a,...} Martin Am Dienstag, 19. Februar 2019 22:03:43 UTC+1

[sage-devel] Re: Counting integer compositions with restrictions

2019-02-19 Thread 'Martin R' via sage-devel
I do think that P = Partitions(15, min_length=10, max_length=10); P.cardinality() also uses brute force. (at least P.cardinality?? says so). Would be great, though! Martin Am Dienstag, 19. Februar 2019 21:43:36 UTC+1 schrieb Jori Mäntysalo (TAU): > > Is there a fast way to compute for example