Thank you for helping me. I created the function:

sage: def is_king_tableau(t,no_of_rows):
....:     for i in range(no_of_rows):
....:         if t[0][0] != 1:
....:             return False
....:         elif t[i][0] <= 2*i:
....:             return False
....:         else:
....:             i=i+1
....:     return True


I have tidied up your function and written some simple functions to show 
how it is used.
I hope this will encourage you to learn more about Python, make further 
improvements and write your own functions.

The last three lines are not a function but use the iterator to show the 
motivation for the definition of a King tableau.

def is_king_tableau(t):
    """A function which tests if a semistandard tableau is a King 
tableau."""
    if t[0][0] != 1:
        return False    
    for i, row in enumerate(t):
        if row[0] <= 2*i:
            return False
    return True

def no_of_king_tableaux(p):
    """A function which finds the number of King tableaux of given shape."""
    return len([t for t in SemistandardTableaux(p) if is_king_tableau(t)])

def king_tableaux(p):
    """An iterator for the set of King tableaux of given shape."""
    for t in SemistandardTableaux(p):
        if is_king_tableau(t):
            yield t

for t in king_tableaux([2,2]):
    t.to_Gelfand_Tsetlin_pattern().pp()
    print "\n"

-- 
You received this message because you are subscribed to the Google Groups 
"sage-combinat-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-combinat-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-combinat-devel/9bda4593-6717-4b51-a5a4-1aa2bfc00e0c%40googlegroups.com.

Reply via email to