Open in CoCalc with one click!
%auto typeset_mode(True, display=False)
S3=SymmetricGroup(3); S3
(1,2,3),(1,2)\langle (1,2,3), (1,2) \rangle
f6f5c642-d0c8-4d06-9a2a-6c4ecfafa2d3 SymmetricGroup.3.list()
[$$, (1,3,2)(1,3,2), (1,2,3)(1,2,3), (2,3)(2,3), (1,3)(1,3), (1,2)(1,2)]
a = S3((1,2));a
(1,2)(1,2)
b= S3((2,3));b
(2,3)(2,3)
a*b
(1,3,2)(1,3,2)
b*a
(1,2,3)(1,2,3)
class NewSymmetricGroupElement(sage.groups.perm_gps.permgroup_element.SymmetricGroupElement): def __mul__(self, other): """Calling the original class method with order inverted""" print(self, other) return sage.groups.perm_gps.permgroup_element.SymmetricGroupElement._mul_(other, self) class NewSymmetricGroup(SymmetricGroup): def _element_class(self): return NewSymmetricGroupElement
NS3=NewSymmetricGroup(3); NS3
(1,2,3),(1,2)\langle (1,2,3), (1,2) \rangle
c=NS3((1,2)); type(c) d=NS3((2,3)); type(d)
<type 'sage.groups.perm_gps.permgroup_element.SymmetricGroupElement'> <type 'sage.groups.perm_gps.permgroup_element.SymmetricGroupElement'>
690ea8fc-cb69-47d5-9340-3c2876acddaas c*d # produces (1,3,2) but I would have expected (1,2,3), i.e. b*a above
(1,3,2)(1,3,2)
d*c # produces (1,2,3) but I would have expected (1,3,2), i.e. a*b above
(1,2,3)(1,2,3)