Thank you Bruce!! Indeed the function looks tidier. 
The third function gives me this message: "<generator object king_tableaux 
at 0x6ffea35729a8>". The 'p' is supposed to mean the partition right?

Once again thank you for your help. I really appreciate it!

-Soheli

On Sunday, March 8, 2020 at 5:26:41 AM UTC-4, Bruce wrote:
>
> 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/b8bcad0c-2683-4378-b93c-83be180877dd%40googlegroups.com.

Reply via email to