ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Thu, 13 Aug 2020 13:20:42 -0500Lusztig's a-function for the symmetric group via Sagehttps://ask.sagemath.org/question/52988/lusztigs-a-function-for-the-symmetric-group-via-sage/Given a Weyl group $W$, Lusztig's $a$-function from W to the natural numbers is defined as a function constant on two-sided cells and $a(w)=l(w)-2 d(w)$ when $w$ is an involution, where $l(w)$ is the length function and $d(w)$ is the degree of the Kazhdan-Lusztig polynomial $P_{1,w}$. Since every two-sided cell contains an involution the function a is defined on all of W. See for example before conjecture 15 in https://msp.org/pjm/2007/232-2/pjm-v232-n2-p06-s.pdf for this definition.
My question is how to obtain the $a$-function for the symmetric group as a Weyl group via Sage.
A more explicit formula in this case is given as follows:
Let $x$ be a permutation corresponding to the pair of tableaux $(P(x),Q(x))$
by the Robinson-Schensted correspondence and
$\operatorname{shape}(Q(x)')=( \lambda_1,...,\lambda_k)$
where $Q(x)'$ is the transposed tableau.
Then $a(x)=\sum\limits_{i=1}^{k}{\binom{\lambda_i}{2}}$, see for example
exercise 10 on page 198 in the book by Björner and Brenti "Combinatorics of Coxeter Groups".
The values of the function can be seen for example for the symmetric group
on 3 symbols on top of page 323 of https://msp.org/pjm/2007/232-2/pjm-v232-n2-p06-s.pdf .klaaaThu, 13 Aug 2020 13:20:42 -0500https://ask.sagemath.org/question/52988/Convert between different ways of expressing permutationshttps://ask.sagemath.org/question/51663/convert-between-different-ways-of-expressing-permutations/ Suppose I have two permutations x and y, given in one line notation (e.g. x=[2,1,4,3] and y=[3,2,1,4]). How would I go about computing e.g. the Kazhdan-Lusztig polynomial P<sub>x,y</sub>(q) in sage? The KL polynomial requires as input representing symmetric group elements as products of simple reflections and I do not know how to (using a computer) convert between these different ways of expressing a permutation. How does one do this in sage?Peter MSun, 31 May 2020 17:56:29 -0500https://ask.sagemath.org/question/51663/How to find the longest word in a subgroup of the symmetric group using Sage?https://ask.sagemath.org/question/50708/how-to-find-the-longest-word-in-a-subgroup-of-the-symmetric-group-using-sage/ Let $S_n$ be the symmetric group over $\\{1,2,\ldots,n\\}$. Let $J$ be a subset of $\\{1,\ldots, n-1\\}$ and let $W_J$ be the subgroup of $S_n$ generated by $s_j, j\in J \subset \\{1, \ldots, n-1\\}$, where $s_j$'s are simple reflections. How to find the longest word in $W_J$ in Sage? The following is some codes.
W = SymmetricGroup(8)
[s1,s2,s3,s4,s5,s6,s7] = W.simple_reflections()
Thank you very much.lijr07Sun, 12 Apr 2020 15:25:40 -0500https://ask.sagemath.org/question/50708/symmetric group: get back conjugacy class from its generatorshttps://ask.sagemath.org/question/49641/symmetric-group-get-back-conjugacy-class-from-its-generators/The function below returns a list `r` of elements of the symmetric group that leave a certain polynomial `f` fixed.
I know (by the properties of `f` that I'm not specifiying here) that the list of `g`'s that leave it fixed generate one of the 11 conjugacy subclasses of S(4).
What is the best way to output from my code below a number between 1 and 11 that corresponds to such subclass?
R = PolynomialRing(QQ, 4, ["q1","q2","q3","q4"])
q1,q2,q3,q4 = R.gens()
f = 1 + q1 +q2 # in general, it is a polynomial with unit coefficients in the ring R
G = SymmetricGroup(4)
cl = G.conjugacy_classes_subgroups()
r = []
for g in G:
if (f * g) == f: r.append(g)
return rrue82Wed, 22 Jan 2020 04:16:56 -0600https://ask.sagemath.org/question/49641/Determining if two subgroups of a symmetric group are conjugatehttps://ask.sagemath.org/question/44357/determining-if-two-subgroups-of-a-symmetric-group-are-conjugate/If I have two particular subgroups of a symmetric group, is there any built-in way in Sage to determine if the groups are conjugate to one another? I tried creating a `ConjugacyClass` for each and then comparing them, but this gives an error:
S = SymmetricGroup(3)
gen1 = Permutation('(1,2,3)')
gen2 = Permutation('(1,3,2)')
gen3 = Permutation('(1,2)')
gen4 = Permutation('(1,3)')
G1 = PermutationGroup([gen1, gen3])
G2 = PermutationGroup([gen2, gen4])
ConjugacyClass(S, G1) == ConjugacyClass(S, G2)
When executing the very last line I get the error
TypeError: For implementing multiplication, provide the method '_mul_' for (1,2) resp. Permutation Group with generators [(1,2), (1,2,3)]
cjohnsonTue, 20 Nov 2018 13:06:56 -0600https://ask.sagemath.org/question/44357/Overloading the binary operation of symmetric groups to reverse the orderhttps://ask.sagemath.org/question/44637/overloading-the-binary-operation-of-symmetric-groups-to-reverse-the-order/ I believe the Sage implementation of symmetric groups uses GAP which composes permutations in the opposite order to what I am used to.
E.g. if (1,2) denotes the permutations switching 1 and 2, and (2,3) switches 2 and 3, then I would say
(1,2) * (2,3) = (1,2,3),
because I would first evaluate (2,3) and then (1,2) (the order in which one evaluates functions). Sage on the other hand produces
(1,2) * (2,3) = (1,3,2).
About a year ago, a friend helped me overload the definition of the binary operation to have the composition of permutations evaluated in the order I am used to. The code that worked was
class NewSymmetricGroupElement(sage.groups.perm_gps.permgroup_element.SymmetricGroupElement):
def _mul_(self, other):
"""Calling the original class method with order inverted"""
return sage.groups.perm_gps.permgroup_element.SymmetricGroupElement._mul_(other, self)
class NewSymmetricGroup(SymmetricGroup):
def _element_class(self):
return NewSymmetricGroupElement
I recently updated to Sage 8.4 and the code no longer works. Here is what happens, after executing the code above, I run:
NS3=NewSymmetricGroup(3); NS3
> Symmetric group of order 3! as a permutation group
a=NS3((1,2)); b=NS3((2,3));
a*b = (1,3,2) # I would expect (1,2,3)
Can anyone spot what I am doing wrong?GonnemanTue, 11 Dec 2018 09:49:40 -0600https://ask.sagemath.org/question/44637/About SymmetricGroupRepresentation()https://ask.sagemath.org/question/42614/about-symmetricgrouprepresentation/I am a new student in SAGE. I read the following discussion:
`evaluation of character of symmetric group`
and then also read the manual.
However, I am still confused about some fundamental problem:
(I cannot find these function in "Sage Reference Manual: Groups, Release 8.2". Are both new functions?).
1. About
SymmetricGroupRepresentation(partition, implementation='specht', ring=None, cache_matrices=True)
I am confused about "partition". Suppose for $S_3$, and partition $=[2,1]$. What does it mean? (It seems $[1,2]$ is not valid)
2. About
spc = SymmetricGroupRepresentation([2,1], 'specht')
spc.representation_matrix(Permutation([1,2,3]))
When I use
spc.representation_matrix(Permutation([1,2]))
error pops out. However, as far as I know, $(1,2)$ is a valid permutation, which represent the matrix representation: $$\begin{bmatrix}0 & 1 & 0 \\\ 1 & 0 & 0 \\\ 0 & 0 & 1\end{bmatrix}$$
However, if I use 'orthogonal' instead of 'specht', the answer becomes
$$\begin{bmatrix}1 & 0 \\\ 0 & 1\end{bmatrix}$$
But I test another permutation: $[1,2,3]$, the answer is the same. However, $[1,2]$ and $[1,2,3]$ are in the different conjugacy classes; they should not have the same character.
I cannot find "Permutation" in "Sage Reference Manual: Group". Where can I find this function?sleeve chenSat, 16 Jun 2018 17:15:58 -0500https://ask.sagemath.org/question/42614/Order of symmetric group irrepshttps://ask.sagemath.org/question/35299/order-of-symmetric-group-irreps/ This is a key detail for me, but I can't find any information about it in the Sage or GAP documentation: if I use
SymmetricGroup(5).character_table()
I get a 7x7 matrix, with rows indexed by conjugacy classes and columns indexed by irreps. Both of these things can be indexed, for instance, by Young diagrams of size 5.
How are the rows and columns ordered? Is it safe to assume that they will be ordered in reverse-lexicographic order on the Young diagrams, i.e.
5 ; 4,1 ; 3,2 ; 3,1,1 ; 2,2,1 ; 2,1,1,1 ; 1,1,1,1,1
This seems to be the case in the examples I've checked but I want to be sure that this is guaranteed by the code and not a coincidence in small examples.xanderfloodFri, 28 Oct 2016 18:52:33 -0500https://ask.sagemath.org/question/35299/Groupring element in pretty_printhttps://ask.sagemath.org/question/35136/groupring-element-in-pretty_print/ I have the following code:
G37=GroupAlgebra(SymmetricGroup(3),GF(7))
M37=MatrixSpace(G37,2,2)
S3=SymmetricGroup(3).list()
@interact
def _(a11=input_grid(1,6, default = [1,2,0,0,0,0], label='$a_{11}$'),a12=input_grid(1,6, default = [0,1,2,2,3,3], label='$a_{12}$'),a21=input_grid(1,6, default = [0,3,4,2,3,4], label='$a_{21}$'),a22=input_grid(1,6, default = [0,1,1,0,0,0], label='$a_{22}$')):
A11=sum([G37(a11[0][k])*G37(S3[k]) for k in [0..5]])
A12=sum([G37(a12[0][k])*G37(S3[k]) for k in [0..5]])
A21=sum([G37(a21[0][k])*G37(S3[k]) for k in [0..5]])
A22=sum([G37(a22[0][k])*G37(S3[k]) for k in [0..5]])
pretty_print(html('$A=%s$'%latex(M37([A11,A12,A21,A22]))))
The first element $A_{11}$ appears as $+2(1,2)$ instead of $()+2(1,2).$ Is it possible to protect the groupring element $()$ somehow? Thanks for the answers in advance.castorWed, 12 Oct 2016 10:40:53 -0500https://ask.sagemath.org/question/35136/evaluation of character of symmetric group.https://ask.sagemath.org/question/33776/evaluation-of-character-of-symmetric-group/I am writing a code in sage where I am using character of Symmetric group. I want to evaluate the character of symmetric group on certain conjugacy classes. While I know the command for defining character as below.\\
G = SymmetricGroup(3)\\
rho = SymmetricGroupRepresentation([1,1,1])\\
chi = rho.to_character();
I want to find chi([2,1]) that is to evaluate chi on the conjugacy class of type (2,1).
Any help please ? AnupamsageMon, 13 Jun 2016 19:37:37 -0500https://ask.sagemath.org/question/33776/How to create a subalgebra generated by certain elementshttps://ask.sagemath.org/question/28716/how-to-create-a-subalgebra-generated-by-certain-elements/I'm working in the group algebra of the symmetric group and I would like to be able to create the subalgebra generated by the Jucys-Murphy elements: X_i = (1 i) + (2 i) + ... + (i-1 i) for i = 1, ... ,n.
I can't seem to find a simple way to create a subalgebra generated by elements of an algebra. Any suggestions? I'm happy to give more context, but I'm pretty new to Sage so at the moment I'm not sure how to elaborate more.egdelmasMon, 27 Jul 2015 16:24:43 -0500https://ask.sagemath.org/question/28716/Iterator for conjugacy classes of Snhttps://ask.sagemath.org/question/7794/iterator-for-conjugacy-classes-of-sn/Hello,
I would like to iterate through elements of a conjugacy classes of the symmetric group Sn. In other words, I'm looking for an algorithm which given an integer partition p = [p1,...,pk] of n provides an iterator over permutations with cycle decomposition whose length of cycles is exactly given by p.
There is one way which uses GAP, but as I have to iterate through conjugacy classes of S(12) and it is infinitely slow inside Sage. On the other hand, there is a useful efficient way to iterate through all permutations of Sn : there exists a "Gray code" for which two consecutive permutations differ by a swap (ie exchange of images between two elements). Such a method is implemented in cython in sage.combinat.permutation_cython (thanks Tom Boothby!).
- Do there exist algorithms for iteration through conjugacy classes of the symmetric group which is as close as possible as a Gray code ?
- Does there exist a better algorithm if we consider partitions of given length (the number k above) ? In other words, not iterating through conjugacy classes but through permutations with fixed number of cycles in their cycle decomposition.
- Is there something yet implemented in softwares included in Sage ?
Thanks,
VincentvdelecroixTue, 07 Dec 2010 09:48:05 -0600https://ask.sagemath.org/question/7794/How to use SymmetricGroup() to input an element in Snhttps://ask.sagemath.org/question/23453/how-to-use-symmetricgroup-to-input-an-element-in-sn/ I want to input an element of `Sn` with `SymmetricGroup()`,for example, I know
`SymmetricGroup(5)((1,2,3))`is the element `(1,2,3)`in `S5`,however, I do not know how to input something like `(1,2)(3,4)` using `SymmetricGroup()`ruidongshuai@gmail.comThu, 17 Jul 2014 06:44:24 -0500https://ask.sagemath.org/question/23453/Check that P3*P6=P4https://ask.sagemath.org/question/9063/check-that-p3p6p4/Here's elements of Symmetric group of 6th order: S3:
![The book says](http://farm8.staticflickr.com/7098/7358188294_242a16d3d7_z.jpg "The book says")
I want to check that P3*P6=P4.
G = SymmetricGroup(3)
BookNumbers = [1, 4, 2, 3, 6, 5]
P = [0]
for i in BookNumbers:
P.append(sorted(G.list())[i-1])
print (P[3] * P[6]).list(), P[4].list()
print (P[3] * P[6]) == P[4]
it gives:
[3, 2, 1] [2, 1, 3]
False
so they are the same actually. But how do I make sage say `True`?.bk322Tue, 12 Jun 2012 07:18:09 -0500https://ask.sagemath.org/question/9063/S3's elementshttps://ask.sagemath.org/question/9056/s3s-elements/Here's elements of Symmetric group of 6th order: S3:
![The book says](http://farm8.staticflickr.com/7098/7358188294_242a16d3d7_z.jpg "The book says")
I want to get the same in Sage. So I do:
sage: G = SymmetricGroup(3)
sage: G.list()
[(), (2,3), (1,2), (1,2,3), (1,3,2), (1,3)]
Now I can't find (1,3,2) element in the book. As far as I understand:
P1 -> ()
P2 -> (1,2,3)
P3 -> (2,3)
P4 -> (1,2)
P5 -> (1,3)
P6 -> ??? also (1,2,3) ???
So my question is to set the correct map from sage to my book...bk322Sun, 10 Jun 2012 06:41:13 -0500https://ask.sagemath.org/question/9056/