2022-01-27 06:33:05 +0100 commented answer Find the longest word in a symmetric group which satisfies a certain property. @Max, thank you very much for your nice answer! 2022-01-27 06:31:54 +0100 commented answer Find the longest word in a symmetric group which satisfies a certain property. @Max, thank you very much! 2022-01-26 08:54:30 +0100 received badge ● Nice Answer (source) 2022-01-26 08:49:33 +0100 received badge ● Self-Learner (source) 2022-01-26 08:49:33 +0100 received badge ● Teacher (source) 2022-01-25 09:14:06 +0100 edited answer Find the longest word in a symmetric group which satisfies a certain property. I modified Max Alekseyev's answer. The result of the following codes agree with the result of the function LongestPerm i 2022-01-25 09:11:54 +0100 commented answer Find the longest word in a symmetric group which satisfies a certain property. @Max, I checked some more examples and found that some of the results given by your codes do not agree with the function 2022-01-25 09:10:03 +0100 answered a question Find the longest word in a symmetric group which satisfies a certain property. I modified Max Alekseyev's answer. The result of the following codes agree with the result of the function LongestPerm i 2022-01-24 21:55:40 +0100 received badge ● Commentator 2022-01-24 21:55:40 +0100 commented answer Find the longest word in a symmetric group which satisfies a certain property. @Max, thank you very much! 2022-01-24 21:55:19 +0100 marked best answer Find the longest word in a symmetric group which satisfies a certain property. Let $A, B$ be two list of equal length $k$, where $A$ is weakly increasing. For example, $A=[1, 1, 2, 3, 3, 4]$, $B=[12, 9, 10, 15, 15, 14]$. Define $m_{A,B}$ to be the multiset of pairs $[ A_i, B_i ]$, $i \in k$, (this is a multi-set of pairs of integers, not a list of pairs, so the order of pairs in $m_{A,B}$ does not matter). By a result in symmetric group, there is a unique element with maximal length (length of the reduced word) in the symmetric group $S_k$ ($k$ is the length of $A$) such that $m_{A,w(sorted(B))} = m_{A,B}$, where $sorted(B)$ is to sorted B such that it is weakly increasing, and the action of $w=s_{i_1} \cdots s_{i_m}$ on a list $L$ is defined by: $s_j(L)$ means exchanging the jth and j+1th elements of $L$, and for $w,w' \in S_k$, $w w'(L) = w(w'(L))$. There is a method to compute the longest word $w$ by checking all elements in $S_k$. But it takes a long time when $k$ is large. The following function works fine and returns correct result. def LongestPerm(A,Bsorted,B): k = len(A) S = set([(A[i],B[i]) for i in range(k)]) W = WeylGroup('A'+str(k-1), prefix = 's') winner = W.one() for w in W: wstr = w.inverse().to_permutation_string() if set([(A[int(wstr[i])-1],Bsorted[i]) for i in range(k)]) == S: if w.length()>winner.length(): winner = w return winner In the example that A=[1, 1, 2, 3, 3, 4] B=[12, 9, 10, 15, 15, 14] we have w=s4*s5*s4*s2*s1 Is there some method to compute $w$ faster (without checking all elements of $S_k$)? Thank you very much. 2022-01-24 09:53:25 +0100 edited question Find the longest word in a symmetric group which satisfies a certain property. Find the longest word in a symmetric group which satisfies a certain property. Let $A, B$ be two list of equal length $k 2022-01-24 09:52:25 +0100 edited question Find the longest word in a symmetric group which satisfies a certain property. Find the longest word in a symmetric group which satisfies a certain property. Let$A, B$be two list of equal length$k 2022-01-24 09:39:24 +0100 edited question Find the longest word in a symmetric group which satisfies a certain property. Find the longest word in a symmetric group which satisfies a certain property. Let $A, B$ be two list of equal length $k 2022-01-24 09:39:00 +0100 edited question Find the longest word in a symmetric group which satisfies a certain property. Find the longest word in a symmetric group which satisfies a certain property. Let$A, B$be two list of equal length$k 2022-01-24 09:37:01 +0100 edited question Find the longest word in a symmetric group which satisfies a certain property. Find the longest word in a symmetric group which satisfies a certain property. Let $A, B$ be two list of equal length $k 2022-01-24 09:36:13 +0100 edited question Find the longest word in a symmetric group which satisfies a certain property. Find the longest word in a symmetric group which satisfies a certain property. Let$A, B$be two list of equal length, w 2022-01-24 09:35:15 +0100 asked a question Find the longest word in a symmetric group which satisfies a certain property. Find the longest word in a symmetric group which satisfies a certain property. Let$A, B$be two list of equal length, w 2022-01-24 09:35:14 +0100 asked a question Find the longest word in a symmetric group which satisfies a certain property. Find the longest word in a symmetric group which satisfies a certain property. Let$A, B$be two list of equal length, w 2022-01-24 08:21:56 +0100 commented answer How to find a permutation which sends a given list to another given list in SageMath? @Max, thank you very much! 2022-01-24 08:21:41 +0100 commented answer How to find a permutation which sends a given list to another given list in SageMath? @John, thank you very much! 2022-01-23 20:14:34 +0100 edited question How to find a permutation which sends a given list to another given list in SageMath? How to find a permutation which sends a given list to another given list in SageMath? Given two list L1, L2, say L1=[1 2022-01-23 19:06:08 +0100 commented question How to find a permutation which sends a given list to another given list in SageMath? @John,$L1$and$L2$are lists. There could be repetition of elements in$L1$,$L2$. The numbers of occurrences of each 2022-01-23 19:04:59 +0100 commented question How to find a permutation which sends a given list to another given list in SageMath? @John,$L1$and$L2$are lists. There could be repetition of elements in$L1$,$L2$. The numbers of occurrences of each 2022-01-23 19:04:10 +0100 commented question How to find a permutation which sends a given list to another given list in SageMath? @John,$L1$and$L2$are lists (the order of the elements could not be changed). There could be repetition of elements i 2022-01-23 19:02:19 +0100 commented question How to find a permutation which sends a given list to another given list in SageMath? @John, the result of$w$is not unique. There is at least one$w$. I only need one$w$such that$w(L1)=L2$. The only me 2022-01-23 18:59:24 +0100 commented question How to find a permutation which sends a given list to another given list in SageMath? @John, thank you very much for your comments. I have edited the post. 2022-01-23 18:58:26 +0100 edited question How to find a permutation which sends a given list to another given list in SageMath? How to find a permutation which sends a given list to another given list in SageMath? Given two list L1, L2, say L1=[1 2022-01-23 15:22:57 +0100 edited question How to find a permutation which sends a given list to another given list in SageMath? How to find a permutation which sends a given list to another given list in SageMath? Given two list L1, L2, say L1=[1 2022-01-23 15:21:30 +0100 edited question How to find a permutation which sends a given list to another given list in SageMath? How to find a permutation which sends a given list to another given list in SageMath? Given two list L1, L2, say L1=[1 2022-01-23 15:20:33 +0100 edited question How to find a permutation which sends a given list to another given list in SageMath? How to find a permutation which sends a given list to another given list in SageMath? Given two list L1, L2, say L1=[1 2022-01-23 15:17:09 +0100 asked a question How to find a permutation which sends a given list to another given list in SageMath? How to find a permutation which sends a given list to another given list in SageMath? Given two list L1, L2, say L1=[1 2022-01-23 15:17:07 +0100 asked a question How to find a permutation which sends a given list to another given list in SageMath? How to find a permutation which sends a given list to another given list in SageMath? Given two list L1, L2, say L1=[1 2022-01-23 15:07:15 +0100 marked best answer A question about definition of a polynomial ring. I am trying to define a polynomial ring as follows: from sage.combinat import * n=9 m=100 R = PolynomialRing(QQ,n*m,['x'+str(i)+str(j) for i in range(1,n+1) for j in range(1,m+1)]) It is ok with n=9, m=100. But when I change n, m to n=11, m=100. Then there is an error: ValueError: variable name 'x111' appears more than once I would like to have n=100, m=1000. How to solve this problem? Thank you very much. 2022-01-23 15:05:49 +0100 answered a question How to find the element with maximal length in a double coset of a Coxeter group? The following codes work. def LongestPermInDoubleCosetWeylGroupGivenTypeRank(S1,w,S2,typ,rank): # typ='A', longest elem 2022-01-23 10:29:07 +0100 asked a question A question about definition of a polynomial ring. A question about definition of a polynomial ring. I am trying to define a polynomial ring as follows: from sage.combina 2022-01-21 20:47:21 +0100 marked best answer 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. 2022-01-21 20:47:21 +0100 commented answer How to find the longest word in a subgroup of the symmetric group using Sage? @FrédéricC, thank you very much for your very useful answer. Do you know how to find the unique element with maximal len