1
$\begingroup$

I want to get more generating function for this : http://www.findstat.org/StatisticsDatabase/St000683 What is the quickest way to do this in SAGE and obtain $F_n$ for $n \geq 7$ as in the link? (when clicking " click to show generating function ") Maybe thats also a good opportunity to ask, wheter there exist good introductions to SAGE specialising in algebra and/or combinatorics.

$\endgroup$

1 Answer 1

1
$\begingroup$

This question is based on a MO question https://mathoverflow.net/questions/259038.

That link you provided contains code for $F_n$ in general. As the page describes, the following code computes the number of points below a given Dyck path $D$ such that the diagonal to the north-east hits the path between two down steps, and the diagonal to the north-west hits the path between two up steps:

def statistic(D):
    H = D.heights()
    left_bad_points = [(i+1, H[i+1]) for i in range(len(D)-1) if D[i] == D[i+1] == 1]
    right_bad_points = [(i+1, H[i+1]) for i in range(len(D)-1) if D[i] == D[i+1] == 0]
    result = 0
    for i,h in enumerate(D.heights()):
        for j in range(h-2,-1,-2):
            if (any((i-a + j-b) == 0 for (a,b) in left_bad_points) and
                any((i-a - j+b) == 0 for (a,b) in right_bad_points)):
                result += 1
    return result

so you can then simply compute the following values as

sage: q = var("q")
sage: sum( q^statistic(D) for D in DyckWords(6) )
q^15 + 2*q^10 + 2*q^9 + 2*q^8 + 7*q^7 + 5*q^6 + 6*q^5 + 16*q^4 + 24*q^3 + 22*q^2 + 28*q + 17
sage: sum( q^statistic(D) for D in DyckWords(7) )
q^21 + 2*q^15 + 2*q^14 + 2*q^13 + 2*q^12 + 9*q^11 + 5*q^10 + 8*q^9 + 7*q^8 + 24*q^7 + 37*q^6 + 37*q^5 + 40*q^4 + 80*q^3 + 69*q^2 + 67*q + 37
sage: sum( q^statistic(D) for D in DyckWords(8) )
q^28 + 2*q^21 + 2*q^20 + 2*q^19 + 2*q^18 + 2*q^17 + 11*q^16 + 5*q^15 + 8*q^14 + 9*q^13 + 11*q^12 + 29*q^11 + 48*q^10 + 48*q^9 + 59*q^8 + 70*q^7 + 123*q^6 + 163*q^5 + 171*q^4 + 214*q^3 + 205*q^2 + 164*q + 81
sage: sum( q^statistic(D) for D in DyckWords(9) )
q^36 + 2*q^28 + 2*q^27 + 2*q^26 + 2*q^25 + 2*q^24 + 2*q^23 + 13*q^22 + 5*q^21 + 8*q^20 + 9*q^19 + 13*q^18 + 11*q^17 + 38*q^16 + 55*q^15 + 54*q^14 + 70*q^13 + 91*q^12 + 92*q^11 + 182*q^10 + 197*q^9 + 316*q^8 + 355*q^7 + 421*q^6 + 508*q^5 + 641*q^4 + 632*q^3 + 554*q^2 + 405*q + 179
sage: sum( q^statistic(D) for D in DyckWords(10) )
q^45 + 2*q^36 + 2*q^35 + 2*q^34 + 2*q^33 + 2*q^32 + 2*q^31 + 2*q^30 + 15*q^29 + 5*q^28 + 8*q^27 + 9*q^26 + 13*q^25 + 13*q^24 + 16*q^23 + 41*q^22 + 67*q^21 + 57*q^20 + 70*q^19 + 104*q^18 + 121*q^17 + 119*q^16 + 227*q^15 + 254*q^14 + 333*q^13 + 519*q^12 + 596*q^11 + 704*q^10 + 822*q^9 + 1105*q^8 + 1476*q^7 + 1663*q^6 + 1683*q^5 + 1965*q^4 + 1912*q^3 + 1475*q^2 + 990*q + 399
$\endgroup$
3
  • $\begingroup$ Code is fairly hard to parse in this form. Might be advisable to explain how it all works, as well. $\endgroup$
    – The Count
    Jan 23, 2017 at 15:13
  • $\begingroup$ Well, I took this code from findstat.org/St000683 where also a definition is given. I don't know how the code works (though this seems pretty clear from the description in the link), but only provided the answer to the question of how to get further values. $\endgroup$
    – Christian
    Jan 23, 2017 at 15:16
  • $\begingroup$ Copies over the definition of this statistic on Dyck paths and a link to the original MathOverflow question. $\endgroup$
    – Christian
    Jan 23, 2017 at 15:20

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .