Write an element of a permutation group as a product of generators in SageMath

141 Views Asked by At

For instance, let's say I have this group in Sage (taken from an example in the docs):

G = PermutationGroup(['(1,2)(3,4)', '(3,4,5,6)'], canonicalize=False)

The permutation (1,2)(3,5,6) is in this group, and can be shown to be the product of the two generators. Is there any way to make Sage decompose an arbitrary element of a permutation group into a product of the group's generators automatically (and efficiently)? Since Sage can efficiently tell me if an arbitrary permutation is in a given permutation group, it seems like this should be possible, but I haven't found any way to do it.