Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
Add rothe_diagram, n_reduced_words, and Stanley symmetric function
Browse files Browse the repository at this point in the history
  • Loading branch information
trevorkarn committed Sep 6, 2022
1 parent 170c657 commit 11bb9df
Showing 1 changed file with 8 additions and 40 deletions.
48 changes: 8 additions & 40 deletions src/sage/combinat/permutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,9 @@
:meth:`Permutation.stanley_symmetric_function`.
- Amrutha P, Shriya M, Divya Aggarwal (2022-08-16): Added Multimajor Index.
- Trevor K. Karn (2022-08-05): Add :meth:`Permutation.n_reduced_words` and
:meth:`Permutation.stanley_symmetric_function`.
Classes and methods
===================
"""
Expand Down Expand Up @@ -2998,31 +3001,14 @@ def reduced_word_lexmin(self):
def rothe_diagram(self):
r"""
Return the Rothe diagram of ``self``.
EXAMPLES::
sage: p = Permutation([4,2,1,3])
sage: D = p.rothe_diagram(); D
[(0, 0), (0, 1), (0, 2), (1, 0)]
sage: D.pp()
O O O .
O . . .
. . . .
. . . .
"""
from sage.combinat.diagram import RotheDiagram
return RotheDiagram(self)

def number_of_reduced_words(self):
def n_reduced_words(self):
r"""
Return the number of reduced words of ``self`` without explicitly
computing them all.
EXAMPLES::
sage: p = Permutation([6,4,2,5,1,8,3,7])
sage: len(p.reduced_words()) == p.number_of_reduced_words()
True
"""
Tx = self.rothe_diagram().peelable_tableaux()

Expand All @@ -3031,22 +3017,13 @@ def number_of_reduced_words(self):
def stanley_symmetric_function(self):
r"""
Return the Stanley symmetric function associated to ``self``.
EXAMPLES::
sage: p = Permutation([4,5,2,3,1])
sage: p.stanley_symmetric_function()
56*m[1, 1, 1, 1, 1, 1, 1, 1] + 30*m[2, 1, 1, 1, 1, 1, 1]
+ 16*m[2, 2, 1, 1, 1, 1] + 9*m[2, 2, 2, 1, 1] + 6*m[2, 2, 2, 2]
+ 10*m[3, 1, 1, 1, 1, 1] + 5*m[3, 2, 1, 1, 1] + 3*m[3, 2, 2, 1]
+ m[3, 3, 1, 1] + m[3, 3, 2] + 2*m[4, 1, 1, 1, 1] + m[4, 2, 1, 1]
+ m[4, 2, 2]
"""

from sage.combinat.sf.sf import SymmetricFunctions
from sage.rings.rational_field import QQ
from sage.rings.rational_field import RationalField as QQ

s = SymmetricFunctions(QQ).s()
m = SymmetricFunctions(QQ).m()
return m(sum(s[T.shape()] for T in self.rothe_diagram().peelable_tableaux()))
return sum(s[T.shape()] for T in self.rothe_diagram().peelable_tableaux())

################
# Fixed Points #
Expand Down Expand Up @@ -5299,17 +5276,8 @@ def shifted_shuffle(self, other):
def _tableau_contribution(T):
r"""
Get the number of SYT of shape(``T``).
EXAMPLES::
sage: T = Tableau([[1,1,1],[2]])
sage: from sage.combinat.permutation import _tableau_contribution
sage: _tableau_contribution(T)
3
"""
from sage.combinat.tableau import StandardTableaux
return(StandardTableaux(T.shape()).cardinality())

################################################################
# Parent classes
################################################################
Expand Down

0 comments on commit 11bb9df

Please sign in to comment.