From 11bb9df704d1750afa353a5f3d4589e598cea038 Mon Sep 17 00:00:00 2001 From: "Trevor K. Karn" Date: Fri, 5 Aug 2022 19:09:59 -0500 Subject: [PATCH] Add rothe_diagram, n_reduced_words, and Stanley symmetric function --- src/sage/combinat/permutation.py | 48 ++++++-------------------------- 1 file changed, 8 insertions(+), 40 deletions(-) diff --git a/src/sage/combinat/permutation.py b/src/sage/combinat/permutation.py index 48b188aacc7..3424a75545e 100644 --- a/src/sage/combinat/permutation.py +++ b/src/sage/combinat/permutation.py @@ -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 =================== """ @@ -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() @@ -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 # @@ -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 ################################################################