ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 21 Jun 2013 11:56:33 +0200Writing a given permutaion as a product of generatorshttps://ask.sagemath.org/question/10267/writing-a-given-permutaion-as-a-product-of-generators/Suppose that I have a group generated by three elements (written in cycle notation). I know that Sage will find all of the elements of this group.
What I need is to be able to write a given permutation as a product of these generators.
Any ideas?
For refernce, I am working in S_16. My generators are a=(13,14,15,16), b=(1,2,3,4)(5,6,7,8)(9,10,11,12), and c=(1,5,9,13,12,8,4). I want to "factor" (1,2) and (1,5) as a product of a,b,c.Fri, 21 Jun 2013 10:35:43 +0200https://ask.sagemath.org/question/10267/writing-a-given-permutaion-as-a-product-of-generators/Answer by tmonteil for <p>Suppose that I have a group generated by three elements (written in cycle notation). I know that Sage will find all of the elements of this group. </p>
<p>What I need is to be able to write a given permutation as a product of these generators.</p>
<p>Any ideas?</p>
<p>For refernce, I am working in S_16. My generators are a=(13,14,15,16), b=(1,2,3,4)(5,6,7,8)(9,10,11,12), and c=(1,5,9,13,12,8,4). I want to "factor" (1,2) and (1,5) as a product of a,b,c.</p>
https://ask.sagemath.org/question/10267/writing-a-given-permutaion-as-a-product-of-generators/?answer=15112#post-id-15112What you are asking for is known as the [word problem](http://en.wikipedia.org/wiki/Word_problem).
In your case, you can do (the answer is quite a huge product):
sage: P = PermutationGroup([[(13,14,15,16)], [(1,2,3,4),(5,6,7,8),(9,10,11,12)], [(1,5,9,13,12,8,4)]])
sage: P.gens()
[(13,14,15,16), (1,2,3,4)(5,6,7,8)(9,10,11,12), (1,5,9,13,12,8,4)]
sage: p = P((1,2))
sage: ans = p.word_problem(P.gens(), display=False)
sage: ans[0]
'x3*x2^-1*x3*x2^2*x3^-1*x2^-1*x3^-1*x2^-1*x3^-1*x2^-2*x3*x2^-1*x3^-2*x2^-1*x3^\n-1*x2^-2*x3*x2^-2*x3*x2^-2*x3^-1*x2^-1*x3*x2^-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,8,4)*(1,2,3,4)(5,6,7,8)(9,10,11,12)^\n-2*(1,5,9,13,12,8,4)^-1*(1,2,3,4)(5,6,7,8)(9,10,11,12)^-1*(1,5,9,13,12,8,4)*(1,2,3,4)(5,6,7,8)(9,10,11,12)*(13,14,15,16)*(1,5,9,13,12,8,4)*(13,14,15,16)^-1*(1,5,9,13,12,8,4)^-1*(13,14,15,16)^-1*(1,5,9,13,12,8,4)*(13,14,15,16)*(1,5,9,13,12,8,4)^-1*(13,14,15,16)^2*(1,5,9,13,12,8,4)*(13,14,15,16)^-3*(1,5,9,13,12,8,4)^\n-1*(13,14,15,16)^-1*(1,2,3,4)(5,6,7,8)(9,10,11,12)^-1*(13,14,15,16)^-1*(1,5,9,13,12,8,4)*(1,2,3,4)(5,6,7,8)(9,10,11,12)^-1*(1,5,9,13,12,8,4)*(1,2,3,4)(5,6,7,8)(9,10,11,12)^2*(1,5,9,13,12,8,4)^-1*(1,2,3,4)(5,6,7,8)(9,10,11,12)^-1*(1,5,9,13,12,8,4)^-1*(1,2,3,4)(5,6,7,8)(9,10,11,12)^-1*(1,5,9,13,12,8,4)^-1*(1,2,3,4)(5,6,7,8)(9,10,11,12)^\n-2*(1,5,9,13,12,8,4)*(1,2,3,4)(5,6,7,8)(9,10,11,12)^-1*(1,5,9,13,12,8,4)^-2*(1,2,3,4)(5,6,7,8)(9,10,11,12)^-1*(1,5,9,13,12,8,4)^-1*(1,2,3,4)(5,6,7,8)(9,10,11,12)^-2*(1,5,9,13,12,8,4)*(1,2,3,4)(5,6,7,8)(9,10,11,12)^-2*(1,5,9,13,12,8,4)*(1,2,3,4)(5,6,7,8)(9,10,11,12)^-2*(1,5,9,13,12,8,4)^-1*(1,2,3,4)(5,6,7,8)(9,10,11,12)^-1*(1,5,9,13,12,8,4)*(1,2,3,4)(5,6,7,8)(9,10,11,12)^-1*(1,5,9,13,12,8,4)^\n-1*(1,2,3,4)(5,6,7,8)(9,10,11,12)^-2*(1,5,9,13,12,8,4)*(1,2,3,4)(5,6,7,8)(9,10,11,12)^-2*(1,5,9,13,12,8,4)*(1,2,3,4)(5,6,7,8)(9,10,11,12)^-2*(1,5,9,13,12,8,4)^-1*(1,2,3,4)(5,6,7,8)(9,10,11,12)^-2*(1,5,9,13,12,8,4)^-1*(1,2,3,4)(5,6,7,8)(9,10,11,12)*(1,5,9,13,12,8,4)*(1,2,3,4)(5,6,7,8)(9,10,11,12)^-1*(1,5,9,13,12,8,4)*(1,2,3,4)(5,6,7,8)(9,10,11,12)'
Fri, 21 Jun 2013 11:56:33 +0200https://ask.sagemath.org/question/10267/writing-a-given-permutaion-as-a-product-of-generators/?answer=15112#post-id-15112