How to find a permutation which sends a given list to another given list in SageMath?
Given two list L1, L2, say
L1=[1,2,5,6,3,4,4,8,2,1,9,3,2]
L2=[1,2,2,5,6,4,3,4,8,9,1,2,3]
How to find a permutation w in $S_{13}$ such that w(L1) = L2 in python?
Here $w=s_{i_1} \cdots s_{i_k}$ for some $k$, and each $s_{j}$ acts on L1 by exchanging the jth and j+1th element of L1.
Thank you very much.
I doubt that there is a built-in function for this since the data don't give a single well-defined permutation — since
L1
andL2
are multisets, there are choices. What have you tried?What is the relevance of the sentence "Here $s_i$ is ..."?
@John, thank you very much for your comments. I have edited the post.
@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 method I know is to check each $w$ in $S_{13}$ and to see if $w(L1)=L2$. But it will take a very long time if $n$ in $S_n$ is large.
@John, $L1$ and $L2$ are lists. There could be repetition of elements in $L1$, $L2$. The numbers of occurrences of each $i$ in $L1$, $L2$ are the same. For example, $L1=[1,1,3]$, $L2=[1,3,1]$. Then we can take $w = s_2$.