ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 31 Jul 2015 10:09:41 +0200Some combinatorial lists related to partitions.https://ask.sagemath.org/question/28725/some-combinatorial-lists-related-to-partitions/I want to generate the lists on the right hand side of the arrow.
P (partitions) --> D (no name?)
[1, 1, 1, 1, 1, 1, 1] --> [0, 0, 0, 0, 0, 0, 1]
[2, 2, 2, 1] --> [0, 0, 1, 1]
[2, 2, 1, 1, 1] --> [0, 1, 0, 0, 1]
[2, 1, 1, 1, 1, 1] --> [1, 0, 0, 0, 0, 1]
[3, 3, 1] --> [0, 2, 1]
[3, 2, 2] --> [1, 0, 2]
[3, 2, 1, 1] --> [1, 1, 0, 1]
[3, 1, 1, 1, 1] --> [2, 0, 0, 0, 1]
[4, 3] --> [1, 3]
[4, 2, 1] --> [2, 1, 1]
[4, 1, 1, 1] --> [3, 0, 0, 1]
[5, 2] --> [3, 2]
[5, 1, 1] --> [4, 0, 1]
[6, 1] --> [5, 1]
[7] --> [7]
Assume 1-based lists. They have the properties:
P[1] = sum(D)
sum(P) = sum(i*t for (i,t) in enumerate(D))
My questions: is there a method in Sage which returns these
lists? If not, what is the best method to generate them given
the other methods of Sage? What is the name of these lists
if they have one?Thu, 30 Jul 2015 22:05:49 +0200https://ask.sagemath.org/question/28725/some-combinatorial-lists-related-to-partitions/Answer by tmonteil for <p>I want to generate the lists on the right hand side of the arrow. </p>
<pre><code>P (partitions) --> D (no name?)
[1, 1, 1, 1, 1, 1, 1] --> [0, 0, 0, 0, 0, 0, 1]
[2, 2, 2, 1] --> [0, 0, 1, 1]
[2, 2, 1, 1, 1] --> [0, 1, 0, 0, 1]
[2, 1, 1, 1, 1, 1] --> [1, 0, 0, 0, 0, 1]
[3, 3, 1] --> [0, 2, 1]
[3, 2, 2] --> [1, 0, 2]
[3, 2, 1, 1] --> [1, 1, 0, 1]
[3, 1, 1, 1, 1] --> [2, 0, 0, 0, 1]
[4, 3] --> [1, 3]
[4, 2, 1] --> [2, 1, 1]
[4, 1, 1, 1] --> [3, 0, 0, 1]
[5, 2] --> [3, 2]
[5, 1, 1] --> [4, 0, 1]
[6, 1] --> [5, 1]
[7] --> [7]
</code></pre>
<p>Assume 1-based lists. They have the properties: </p>
<pre><code> P[1] = sum(D)
sum(P) = sum(i*t for (i,t) in enumerate(D))
</code></pre>
<p>My questions: is there a method in Sage which returns these
lists? If not, what is the best method to generate them given
the other methods of Sage? What is the name of these lists
if they have one?</p>
https://ask.sagemath.org/question/28725/some-combinatorial-lists-related-to-partitions/?answer=28728#post-id-28728I am not familiar with partitions, so i do not know if this has a name. However, if i understand correctly, P is a kind of discrete integral of D, so D is a kind of discrete derivative, that is defined by first differences. So, you can do something like:
sage: for p in Partitions(7):
....: print p, [p[i]-p[i+1] for i in range(len(p)-1)] + [p[-1]]
....:
[7] [7]
[6, 1] [5, 1]
[5, 2] [3, 2]
[5, 1, 1] [4, 0, 1]
[4, 3] [1, 3]
[4, 2, 1] [2, 1, 1]
[4, 1, 1, 1] [3, 0, 0, 1]
[3, 3, 1] [0, 2, 1]
[3, 2, 2] [1, 0, 2]
[3, 2, 1, 1] [1, 1, 0, 1]
[3, 1, 1, 1, 1] [2, 0, 0, 0, 1]
[2, 2, 2, 1] [0, 0, 1, 1]
[2, 2, 1, 1, 1] [0, 1, 0, 0, 1]
[2, 1, 1, 1, 1, 1] [1, 0, 0, 0, 0, 1]
[1, 1, 1, 1, 1, 1, 1] [0, 0, 0, 0, 0, 0, 1]
Thu, 30 Jul 2015 23:09:17 +0200https://ask.sagemath.org/question/28725/some-combinatorial-lists-related-to-partitions/?answer=28728#post-id-28728Comment by Peter Luschny for <p>I am not familiar with partitions, so i do not know if this has a name. However, if i understand correctly, P is a kind of discrete integral of D, so D is a kind of discrete derivative, that is defined by first differences. So, you can do something like:</p>
<pre><code>sage: for p in Partitions(7):
....: print p, [p[i]-p[i+1] for i in range(len(p)-1)] + [p[-1]]
....:
[7] [7]
[6, 1] [5, 1]
[5, 2] [3, 2]
[5, 1, 1] [4, 0, 1]
[4, 3] [1, 3]
[4, 2, 1] [2, 1, 1]
[4, 1, 1, 1] [3, 0, 0, 1]
[3, 3, 1] [0, 2, 1]
[3, 2, 2] [1, 0, 2]
[3, 2, 1, 1] [1, 1, 0, 1]
[3, 1, 1, 1, 1] [2, 0, 0, 0, 1]
[2, 2, 2, 1] [0, 0, 1, 1]
[2, 2, 1, 1, 1] [0, 1, 0, 0, 1]
[2, 1, 1, 1, 1, 1] [1, 0, 0, 0, 0, 1]
[1, 1, 1, 1, 1, 1, 1] [0, 0, 0, 0, 0, 0, 1]
</code></pre>
https://ask.sagemath.org/question/28725/some-combinatorial-lists-related-to-partitions/?comment=28729#post-id-28729Yes, this is also the way I generated the list. So I probably did not miss a standard procedure (sage.combinat is big as a blue whale). I think that also bijectivity is ensured. And "discrete derivative of a partition" sounds interesting :)Thu, 30 Jul 2015 23:35:34 +0200https://ask.sagemath.org/question/28725/some-combinatorial-lists-related-to-partitions/?comment=28729#post-id-28729Comment by tmonteil for <p>I am not familiar with partitions, so i do not know if this has a name. However, if i understand correctly, P is a kind of discrete integral of D, so D is a kind of discrete derivative, that is defined by first differences. So, you can do something like:</p>
<pre><code>sage: for p in Partitions(7):
....: print p, [p[i]-p[i+1] for i in range(len(p)-1)] + [p[-1]]
....:
[7] [7]
[6, 1] [5, 1]
[5, 2] [3, 2]
[5, 1, 1] [4, 0, 1]
[4, 3] [1, 3]
[4, 2, 1] [2, 1, 1]
[4, 1, 1, 1] [3, 0, 0, 1]
[3, 3, 1] [0, 2, 1]
[3, 2, 2] [1, 0, 2]
[3, 2, 1, 1] [1, 1, 0, 1]
[3, 1, 1, 1, 1] [2, 0, 0, 0, 1]
[2, 2, 2, 1] [0, 0, 1, 1]
[2, 2, 1, 1, 1] [0, 1, 0, 0, 1]
[2, 1, 1, 1, 1, 1] [1, 0, 0, 0, 0, 1]
[1, 1, 1, 1, 1, 1, 1] [0, 0, 0, 0, 0, 0, 1]
</code></pre>
https://ask.sagemath.org/question/28725/some-combinatorial-lists-related-to-partitions/?comment=28738#post-id-28738If you want to know the name, perhaps could you ask on the sage-combinat mailing list.Fri, 31 Jul 2015 10:09:41 +0200https://ask.sagemath.org/question/28725/some-combinatorial-lists-related-to-partitions/?comment=28738#post-id-28738