clesto.symmetric: Symmetric group and ring

class clesto.symmetric.symmetric.SymmetricGroup_element(iterable=(), /)[source]

Element in a finite symmetric group.

Create a SymmetricGroup_element from an iterable representing a permutation of (1,2,…,r) thought of as an automorphism of {1,…,r}.

>>> print(SymmetricGroup_element((1,3,2)))
(1,3,2)
property sign

Returns the sign of self.

The sign is defined as the mod 2 number of transpositions required to express the element.

>>> SymmetricGroup_element((5,2,4,3,1)).sign
1
property arity

Arity of self

The arity of a symmetric group element is defined as the cardinality of its domain.

>>> SymmetricGroup_element((5,2,4,3,1)).arity
5
inverse()[source]

Multiplicative inverse: self^{-1}.

>>> pi = SymmetricGroup_element((2,3,1))
>>> print(pi.inverse())
(3,1,2)
__mul__(other)[source]

Product: self * other.

This product agrees with the composition of bijections: self o other.

>>> x = SymmetricGroup_element((1,3,2))
>>> y = SymmetricGroup_element((2,3,1))
>>> print(y * x)
(2,1,3)
__pow__(times)[source]

Iterated product of self: self * … * self.

>>> x = SymmetricGroup_element((2,3,4,5,1))
>>> print(x**5)
(1,2,3,4,5)
compose(other, position)[source]

Operadic compositions: self o_*position* other.

>>> x = SymmetricGroup_element((1,3,2))
>>> y = SymmetricGroup_element((2,1))
>>> print(x.compose(y, 1))
(2,1,4,3)
class clesto.symmetric.symmetric.SymmetricRing_element(data=None, torsion=None)[source]

Elements in the (modular) integral group ring of finite symmetric groups.

property arity

Return the arity of self if homogeneous and None otherwise.

self is said to be homogeneous if all basis elements belong to the same arity.

>>> SymmetricRing_element({(5,2,4,3,1): 1}).arity
5
>>> SymmetricRing_element({(2,3,1): 1, (1,2): 1}).arity
__mul__(other)[source]

Linear product in the symmetric group ring: self * other.

>>> p = SymmetricRing_element({(4,3,2,1): 1, (1,2,3,4): 2})
>>> print(3 * p)
3(4,3,2,1) + 6(1,2,3,4)
>>> q = SymmetricRing_element({(4,1,2,3): 1})
>>> print(p * q)
(1,4,3,2) + 2(4,1,2,3)
__pow__(times)[source]

Iterated product of self: self * … * self.

>>> p = SymmetricRing_element({(4,3,2,1): 1, (1,2,3,4): 2})
>>> p ** 2
SymmetricRing_element({(1, 2, 3, 4): 3})
compose(other, position)[source]

Linear operadic compositions: self o_position other.

>>> x = SymmetricRing_element({(2,3,1): 1, (1,2,3): -1})
>>> y = SymmetricRing_element({(2,1): 1, (1,2): 1})
>>> print(x.compose(y, 2))
(3,2,4,1) + (2,3,4,1) - (1,3,2,4) - (1,2,3,4)
class clesto.symmetric.symmetric.SymmetricRing[source]

Produce special elements in the group ring of finite symmetric groups.

static identity_element(arity, torsion=None)[source]

Return (1,…,r).

static rotation_element(arity, torsion=None)[source]

Return (2,3,…,r-1,1).

static transposition_element(arity, torsion=None)[source]

Return (2,3,…,r-1,1) - (1,2,…,r).

static norm_element(arity, torsion=None)[source]

Return (2,3,…,r-1,1) ** 0 + … + (2,3,…,r-1,1) ** r.