# “Named” Permutation groups (such as the symmetric group, S_n)#

You can construct the following permutation groups:

• SymmetricGroup, $$S_n$$ of order $$n!$$ ($$n$$ can also be a list $$X$$ of distinct positive integers, in which case it returns $$S_X$$)

• AlternatingGroup, $$A_n$$ of order $$n!/2$$ (n can also be a list $$X$$ of distinct positive integers, in which case it returns $$A_X$$)

• DihedralGroup, $$D_n$$ of order $$2n$$

• GeneralDihedralGroup, $$Dih(G)$$, where $$G$$ is an abelian group

• CyclicPermutationGroup, $$C_n$$ of order $$n$$

• DiCyclicGroup, nonabelian groups of order $$4m$$ with a unique element of order 2

• TransitiveGroup, $$n$$-th transitive group of degree $$d$$ from the GAP tables of transitive groups

• TransitiveGroups(d), TransitiveGroups(), set of all of the above

• PrimitiveGroup, $$n$$-th primitive group of degree $$d$$ from the GAP tables of primitive groups

• PrimitiveGroups(d), PrimitiveGroups(), set of all of the above

• MathieuGroup(degree), Mathieu group of degree 9, 10, 11, 12, 21, 22, 23, or 24.

• KleinFourGroup, subgroup of $$S_4$$ of order $$4$$ which is not $$C_2 \times C_2$$

• QuaternionGroup, non-abelian group of order $$8$$, $$\{\pm 1, \pm I, \pm J, \pm K\}$$

• SplitMetacyclicGroup, nonabelian groups of order $$p^m$$ with cyclic subgroups of index p

• SemidihedralGroup, nonabelian 2-groups with cyclic subgroups of index 2

• PGL(n,q), projective general linear group of $$n\times n$$ matrices over the finite field $$\GF(q)$$

• PSL(n,q), projective special linear group of $$n\times n$$ matrices over the finite field $$\GF(q)$$

• PSp(2n,q), projective symplectic linear group of $$2n\times 2n$$ matrices over the finite field $$\GF(q)$$

• PSU(n,q), projective special unitary group of $$n \times n$$ matrices having coefficients in the finite field $$\GF(q^2)$$ that respect a fixed nondegenerate sesquilinear form, of determinant 1.

• PGU(n,q), projective general unitary group of $$n\times n$$ matrices having coefficients in the finite field $$\GF(q^2)$$ that respect a fixed nondegenerate sesquilinear form, modulo the centre.

• SuzukiGroup(q), Suzuki group over $$\GF(q)$$, $$^2 B_2(2^{2k+1}) = Sz(2^{2k+1})$$.

• ComplexReflectionGroup, the complex reflection group $$G(m, p, n)$$ or the exceptional complex reflection group $$G_m$$

• SmallPermutationGroup, a permutation realization of a group specified by its GAP id.

AUTHOR:

• David Joyner (2007-06): split from permgp.py (suggested by Nick Alexander)

REFERENCES:

• Cameron, P., Permutation Groups. New York: Cambridge University Press, 1999.

• Wielandt, H., Finite Permutation Groups. New York: Academic Press, 1964.

• Dixon, J. and Mortimer, B., Permutation Groups, Springer-Verlag, Berlin/New York, 1996.

Note

Though Suzuki groups are okay, Ree groups should not be wrapped as permutation groups - the construction is too slow - unless (for small values or the parameter) they are made using explicit generators.

class sage.groups.perm_gps.permgroup_named.AlternatingGroup(domain=None)[source]#

Bases: PermutationGroup_symalt

The alternating group of order $$n!/2$$, as a permutation group.

INPUT:

• n – a positive integer, or list or tuple thereof

Note

This group is also available via groups.permutation.Alternating().

EXAMPLES:

sage: G = AlternatingGroup(6)
sage: G.order()
360
sage: G
Alternating group of order 6!/2 as a permutation group
sage: G.category()
Category of finite enumerated permutation groups
sage: TestSuite(G).run()  # long time

sage: G = AlternatingGroup([1,2,4,5])
sage: G
Alternating group of order 4!/2 as a permutation group
sage: G.domain()
{1, 2, 4, 5}
sage: G.category()
Category of finite enumerated permutation groups
sage: TestSuite(G).run()
>>> from sage.all import *
>>> G = AlternatingGroup(Integer(6))
>>> G.order()
360
>>> G
Alternating group of order 6!/2 as a permutation group
>>> G.category()
Category of finite enumerated permutation groups
>>> TestSuite(G).run()  # long time

>>> G = AlternatingGroup([Integer(1),Integer(2),Integer(4),Integer(5)])
>>> G
Alternating group of order 4!/2 as a permutation group
>>> G.domain()
{1, 2, 4, 5}
>>> G.category()
Category of finite enumerated permutation groups
>>> TestSuite(G).run()
class sage.groups.perm_gps.permgroup_named.ComplexReflectionGroup(m, p=None, n=None)[source]#

Bases: PermutationGroup_unique

A finite complex reflection group as a permutation group.

We can realize $$G(m,1,n)$$ as $$m$$ copies of the symmetric group $$S_n$$ with $$s_i$$ for $$1 \leq i < n$$ acting as the usual adjacent transposition on each copy of $$S_n$$. We construct the cycle $$s_n = (n, 2n, \ldots, mn)$$.

We construct $$G(m,p,n)$$ as a subgroup of $$G(m,1,n)$$ by $$s_i \mapsto s_i$$ for all $$1 \leq i < n$$,

$s_n \mapsto s_n^{-1} s_{n-1} s_n, \qquad\qquad s_{n+1} \mapsto s_n^p.$

Note that if $$p = m$$, then $$s_{n+1} = 1$$, in which case we do not consider it as a generator.

The exceptional complex reflection groups $$G_m$$ (in the Shephard-Todd classification) are not yet implemented.

INPUT:

One of the following:

• m, p, n – positive integers to construct $$G(m,p,n)$$

• m – integer such that $$4 \leq m \leq 37$$ to construct an exceptional complex reflection $$G_m$$

Note

This group is also available via groups.permutation.ComplexReflection().

Note

The convention for the index set is for $$G(m, 1, n)$$ to have the complex reflection of order $$m$$ correspond to $$s_n$$; i.e., $$s_n^m = 1$$ and $$s_i^2 = 1$$ for all $$i < m$$.

EXAMPLES:

sage: G = groups.permutation.ComplexReflection(3, 1, 5)
sage: G.order()
29160
sage: G
Complex reflection group G(3, 1, 5) as a permutation group
sage: G.category()
Join of Category of finite enumerated permutation groups
and Category of finite complex reflection groups

sage: G = groups.permutation.ComplexReflection(3, 3, 4)
sage: G.cardinality()
648
sage: s1, s2, s3, s4 = G.simple_reflections()
sage: s4*s2*s4 == s2*s4*s2
True
sage: (s4*s3*s2)^2 == (s2*s4*s3)^2
True

sage: G = groups.permutation.ComplexReflection(6, 2, 3)
sage: G.cardinality()
648
sage: s1, s2, s3, s4 = G.simple_reflections()
sage: s3^2 == G.one()
True
sage: s4^3 == G.one()
True
sage: s4 * s3 * s2 == s3 * s2 * s4
True
sage: (s3*s2*s1)^2 == (s1*s3*s2)^2
True
sage: s3 * s1 * s3 == s1 * s3 * s1
True
sage: s4 * s3 * (s2*s3)^(2-1) == s2 * s4
True

sage: G = groups.permutation.ComplexReflection(4, 2, 5)
sage: G.cardinality()
61440

sage: G = groups.permutation.ComplexReflection(4)
Traceback (most recent call last):
...
NotImplementedError: exceptional complex reflection groups are not yet implemented
>>> from sage.all import *
>>> G = groups.permutation.ComplexReflection(Integer(3), Integer(1), Integer(5))
>>> G.order()
29160
>>> G
Complex reflection group G(3, 1, 5) as a permutation group
>>> G.category()
Join of Category of finite enumerated permutation groups
and Category of finite complex reflection groups

>>> G = groups.permutation.ComplexReflection(Integer(3), Integer(3), Integer(4))
>>> G.cardinality()
648
>>> s1, s2, s3, s4 = G.simple_reflections()
>>> s4*s2*s4 == s2*s4*s2
True
>>> (s4*s3*s2)**Integer(2) == (s2*s4*s3)**Integer(2)
True

>>> G = groups.permutation.ComplexReflection(Integer(6), Integer(2), Integer(3))
>>> G.cardinality()
648
>>> s1, s2, s3, s4 = G.simple_reflections()
>>> s3**Integer(2) == G.one()
True
>>> s4**Integer(3) == G.one()
True
>>> s4 * s3 * s2 == s3 * s2 * s4
True
>>> (s3*s2*s1)**Integer(2) == (s1*s3*s2)**Integer(2)
True
>>> s3 * s1 * s3 == s1 * s3 * s1
True
>>> s4 * s3 * (s2*s3)**(Integer(2)-Integer(1)) == s2 * s4
True

>>> G = groups.permutation.ComplexReflection(Integer(4), Integer(2), Integer(5))
>>> G.cardinality()
61440

>>> G = groups.permutation.ComplexReflection(Integer(4))
Traceback (most recent call last):
...
NotImplementedError: exceptional complex reflection groups are not yet implemented

REFERENCES:

codegrees()[source]#

Return the codegrees of self.

Let $$G$$ be a complex reflection group. The codegrees $$d_1^* \leq d_2^* \leq \cdots \leq d_{\ell}^*$$ of $$G$$ can be defined by:

$\prod_{i=1}^{\ell} (q - d_i^* - 1) = \sum_{g \in G} \det(g) q^{\dim(V^g)},$

where $$V$$ is the natural complex vector space that $$G$$ acts on and $$\ell$$ is the rank().

If $$m = 1$$, then we are in the special case of the symmetric group and the codegrees are $$(n-2, n-3, \ldots 1, 0)$$. Otherwise the codegrees are $$((n-1)m, (n-2)m, \ldots, m, 0)$$.

EXAMPLES:

sage: C = groups.permutation.ComplexReflection(4, 1, 3)
sage: C.codegrees()
(8, 4, 0)
sage: G = groups.permutation.ComplexReflection(3, 3, 4)
sage: G.codegrees()
(6, 5, 3, 0)
sage: S = groups.permutation.ComplexReflection(1, 1, 3)
sage: S.codegrees()
(1, 0)
>>> from sage.all import *
>>> C = groups.permutation.ComplexReflection(Integer(4), Integer(1), Integer(3))
>>> C.codegrees()
(8, 4, 0)
>>> G = groups.permutation.ComplexReflection(Integer(3), Integer(3), Integer(4))
>>> G.codegrees()
(6, 5, 3, 0)
>>> S = groups.permutation.ComplexReflection(Integer(1), Integer(1), Integer(3))
>>> S.codegrees()
(1, 0)
degrees()[source]#

Return the degrees of self.

The degrees of a complex reflection group are the degrees of the fundamental invariants of the ring of polynomial invariants.

If $$m = 1$$, then we are in the special case of the symmetric group and the degrees are $$(2, 3, \ldots, n, n+1)$$. Otherwise the degrees are $$(m, 2m, \ldots, (n-1)m, nm/p)$$.

EXAMPLES:

sage: C = groups.permutation.ComplexReflection(4, 1, 3)
sage: C.degrees()
(4, 8, 12)
sage: G = groups.permutation.ComplexReflection(4, 2, 3)
sage: G.degrees()
(4, 6, 8)
sage: Gp = groups.permutation.ComplexReflection(4, 4, 3)
sage: Gp.degrees()
(3, 4, 8)
sage: S = groups.permutation.ComplexReflection(1, 1, 3)
sage: S.degrees()
(2, 3)
>>> from sage.all import *
>>> C = groups.permutation.ComplexReflection(Integer(4), Integer(1), Integer(3))
>>> C.degrees()
(4, 8, 12)
>>> G = groups.permutation.ComplexReflection(Integer(4), Integer(2), Integer(3))
>>> G.degrees()
(4, 6, 8)
>>> Gp = groups.permutation.ComplexReflection(Integer(4), Integer(4), Integer(3))
>>> Gp.degrees()
(3, 4, 8)
>>> S = groups.permutation.ComplexReflection(Integer(1), Integer(1), Integer(3))
>>> S.degrees()
(2, 3)

Check that the product of the degrees is equal to the cardinality:

sage: prod(C.degrees()) == C.cardinality()
True
sage: prod(G.degrees()) == G.cardinality()
True
sage: prod(Gp.degrees()) == Gp.cardinality()
True
sage: prod(S.degrees()) == S.cardinality()
True
>>> from sage.all import *
>>> prod(C.degrees()) == C.cardinality()
True
>>> prod(G.degrees()) == G.cardinality()
True
>>> prod(Gp.degrees()) == Gp.cardinality()
True
>>> prod(S.degrees()) == S.cardinality()
True
index_set()[source]#

Return the index set of self.

EXAMPLES:

sage: G = groups.permutation.ComplexReflection(4, 1, 3)
sage: G.index_set()
(1, 2, 3)

sage: G = groups.permutation.ComplexReflection(1, 1, 3)
sage: G.index_set()
(1, 2)

sage: G = groups.permutation.ComplexReflection(4, 2, 3)
sage: G.index_set()
(1, 2, 3, 4)

sage: G = groups.permutation.ComplexReflection(4, 4, 3)
sage: G.index_set()
(1, 2, 3)

sage: G = groups.permutation.ComplexReflection(10, 2, 1)
sage: G.index_set()
(1,)

sage: G = groups.permutation.ComplexReflection(10, 10, 1)
sage: G.index_set()
()
>>> from sage.all import *
>>> G = groups.permutation.ComplexReflection(Integer(4), Integer(1), Integer(3))
>>> G.index_set()
(1, 2, 3)

>>> G = groups.permutation.ComplexReflection(Integer(1), Integer(1), Integer(3))
>>> G.index_set()
(1, 2)

>>> G = groups.permutation.ComplexReflection(Integer(4), Integer(2), Integer(3))
>>> G.index_set()
(1, 2, 3, 4)

>>> G = groups.permutation.ComplexReflection(Integer(4), Integer(4), Integer(3))
>>> G.index_set()
(1, 2, 3)

>>> G = groups.permutation.ComplexReflection(Integer(10), Integer(2), Integer(1))
>>> G.index_set()
(1,)

>>> G = groups.permutation.ComplexReflection(Integer(10), Integer(10), Integer(1))
>>> G.index_set()
()
simple_reflection(i)[source]#

Return the i-th simple reflection of self.

EXAMPLES:

sage: G = groups.permutation.ComplexReflection(3, 1, 4)
sage: G.simple_reflection(2)
(2,3)(6,7)(10,11)
sage: G.simple_reflection(4)
(4,8,12)

sage: G = groups.permutation.ComplexReflection(1, 1, 4)
sage: G.simple_reflections()
Finite family {1: (1,2), 2: (2,3), 3: (3,4)}

sage: G = groups.permutation.ComplexReflection(10, 2, 1)
sage: G.simple_reflections()
Finite family {1: (1,3,5,7,9)(2,4,6,8,10)}

sage: G = groups.permutation.ComplexReflection(10, 10, 1)
sage: G.simple_reflections()
Finite family {}
>>> from sage.all import *
>>> G = groups.permutation.ComplexReflection(Integer(3), Integer(1), Integer(4))
>>> G.simple_reflection(Integer(2))
(2,3)(6,7)(10,11)
>>> G.simple_reflection(Integer(4))
(4,8,12)

>>> G = groups.permutation.ComplexReflection(Integer(1), Integer(1), Integer(4))
>>> G.simple_reflections()
Finite family {1: (1,2), 2: (2,3), 3: (3,4)}

>>> G = groups.permutation.ComplexReflection(Integer(10), Integer(2), Integer(1))
>>> G.simple_reflections()
Finite family {1: (1,3,5,7,9)(2,4,6,8,10)}

>>> G = groups.permutation.ComplexReflection(Integer(10), Integer(10), Integer(1))
>>> G.simple_reflections()
Finite family {}
class sage.groups.perm_gps.permgroup_named.CyclicPermutationGroup(n)[source]#

Bases: PermutationGroup_unique

A cyclic group of order $$n$$, as a permutation group.

INPUT:

• n – a positive integer

Note

This group is also available via groups.permutation.Cyclic().

EXAMPLES:

sage: G = CyclicPermutationGroup(8)
sage: G.order()
8
sage: G
Cyclic group of order 8 as a permutation group
sage: G.category()
Category of finite enumerated permutation groups
sage: TestSuite(G).run()
sage: C = CyclicPermutationGroup(10)
sage: C.is_abelian()
True
sage: C = CyclicPermutationGroup(10)
sage: C.as_AbelianGroup()
Multiplicative Abelian group isomorphic to C2 x C5
>>> from sage.all import *
>>> G = CyclicPermutationGroup(Integer(8))
>>> G.order()
8
>>> G
Cyclic group of order 8 as a permutation group
>>> G.category()
Category of finite enumerated permutation groups
>>> TestSuite(G).run()
>>> C = CyclicPermutationGroup(Integer(10))
>>> C.is_abelian()
True
>>> C = CyclicPermutationGroup(Integer(10))
>>> C.as_AbelianGroup()
Multiplicative Abelian group isomorphic to C2 x C5
as_AbelianGroup()[source]#

Return the corresponding AbelianGroup instance.

EXAMPLES:

sage: C = CyclicPermutationGroup(8)
sage: C.as_AbelianGroup()
Multiplicative Abelian group isomorphic to C8
>>> from sage.all import *
>>> C = CyclicPermutationGroup(Integer(8))
>>> C.as_AbelianGroup()
Multiplicative Abelian group isomorphic to C8
is_abelian()[source]#

Return True if this group is abelian.

EXAMPLES:

sage: C = CyclicPermutationGroup(8)
sage: C.is_abelian()
True
>>> from sage.all import *
>>> C = CyclicPermutationGroup(Integer(8))
>>> C.is_abelian()
True
is_commutative()[source]#

Return True if this group is commutative.

EXAMPLES:

sage: C = CyclicPermutationGroup(8)
sage: C.is_commutative()
True
>>> from sage.all import *
>>> C = CyclicPermutationGroup(Integer(8))
>>> C.is_commutative()
True
class sage.groups.perm_gps.permgroup_named.DiCyclicGroup(n)[source]#

Bases: PermutationGroup_unique

The dicyclic group of order $$4n$$, for $$n\geq 2$$.

INPUT:

• n – a positive integer, two or greater

OUTPUT:

This is a nonabelian group similar in some respects to the dihedral group of the same order, but with far fewer elements of order 2 (it has just one). The permutation representation constructed here is based on the presentation

$\langle a, x\mid a^{2n}=1, x^{2}=a^{n}, x^{-1}ax=a^{-1}\rangle$

For $$n=2$$ this is the group of quaternions ($${\pm 1, \pm I,\pm J, \pm K}$$), which is the nonabelian group of order 8 that is not the dihedral group $$D_4$$, the symmetries of a square. For $$n=3$$ this is the nonabelian group of order 12 that is not the dihedral group $$D_6$$ nor the alternating group $$A_4$$. This group of order 12 is also the semi-direct product of $$C_2$$ by $$C_4$$, $$C_3\rtimes C_4$$. [Con]

When the order of the group is a power of 2 it is known as a “generalized quaternion group.”

IMPLEMENTATION:

The presentation above means every element can be written as $$a^{i}x^{j}$$ with $$0\leq i<2n$$, $$j=0,1$$. We code $$a^i$$ as the symbol $$i+1$$ and code $$a^{i}x$$ as the symbol $$2n+i+1$$. The two generators are then represented using a left regular representation.

Note

This group is also available via groups.permutation.DiCyclic().

EXAMPLES:

A dicyclic group of order 384, with a large power of 2 as a divisor:

sage: n = 3*2^5
sage: G = DiCyclicGroup(n)
sage: G.order()
384
sage: a = G.gen(0)
sage: x = G.gen(1)
sage: a^(2*n)
()
sage: a^n==x^2
True
sage: x^-1*a*x==a^-1
True
>>> from sage.all import *
>>> n = Integer(3)*Integer(2)**Integer(5)
>>> G = DiCyclicGroup(n)
>>> G.order()
384
>>> a = G.gen(Integer(0))
>>> x = G.gen(Integer(1))
>>> a**(Integer(2)*n)
()
>>> a**n==x**Integer(2)
True
>>> x**-Integer(1)*a*x==a**-Integer(1)
True

A large generalized quaternion group (order is a power of 2):

sage: n = 2^10
sage: G = DiCyclicGroup(n)
sage: G.order()
4096
sage: a = G.gen(0)
sage: x = G.gen(1)
sage: a^(2*n)
()
sage: a^n==x^2
True
sage: x^-1*a*x==a^-1
True
>>> from sage.all import *
>>> n = Integer(2)**Integer(10)
>>> G = DiCyclicGroup(n)
>>> G.order()
4096
>>> a = G.gen(Integer(0))
>>> x = G.gen(Integer(1))
>>> a**(Integer(2)*n)
()
>>> a**n==x**Integer(2)
True
>>> x**-Integer(1)*a*x==a**-Integer(1)
True

Just like the dihedral group, the dicyclic group has an element whose order is half the order of the group. Unlike the dihedral group, the dicyclic group has only one element of order 2. Like the dihedral groups of even order, the center of the dicyclic group is a subgroup of order 2 (thus has the unique element of order 2 as its non-identity element).

sage: G = DiCyclicGroup(3*5*4)
sage: G.order()
240
sage: two = [g for g in G if g.order()==2]; two
[(1,5)(2,6)(3,7)(4,8)(9,13)(10,14)(11,15)(12,16)]
sage: G.center().order()
2
>>> from sage.all import *
>>> G = DiCyclicGroup(Integer(3)*Integer(5)*Integer(4))
>>> G.order()
240
>>> two = [g for g in G if g.order()==Integer(2)]; two
[(1,5)(2,6)(3,7)(4,8)(9,13)(10,14)(11,15)(12,16)]
>>> G.center().order()
2

For small orders, we check this is really a group we do not have in Sage otherwise.

sage: G = DiCyclicGroup(2)
sage: H = DihedralGroup(4)
sage: G.is_isomorphic(H)
False
sage: G = DiCyclicGroup(3)
sage: H = DihedralGroup(6)
sage: K = AlternatingGroup(6)
sage: G.is_isomorphic(H) or G.is_isomorphic(K)
False
>>> from sage.all import *
>>> G = DiCyclicGroup(Integer(2))
>>> H = DihedralGroup(Integer(4))
>>> G.is_isomorphic(H)
False
>>> G = DiCyclicGroup(Integer(3))
>>> H = DihedralGroup(Integer(6))
>>> K = AlternatingGroup(Integer(6))
>>> G.is_isomorphic(H) or G.is_isomorphic(K)
False

AUTHOR:

• Rob Beezer (2009-10-18)

is_abelian()[source]#

Return True if this group is abelian.

EXAMPLES:

sage: D = DiCyclicGroup(12)
sage: D.is_abelian()
False
>>> from sage.all import *
>>> D = DiCyclicGroup(Integer(12))
>>> D.is_abelian()
False
is_commutative()[source]#

Return True if this group is commutative.

EXAMPLES:

sage: D = DiCyclicGroup(12)
sage: D.is_commutative()
False
>>> from sage.all import *
>>> D = DiCyclicGroup(Integer(12))
>>> D.is_commutative()
False
class sage.groups.perm_gps.permgroup_named.DihedralGroup(n)[source]#

Bases: PermutationGroup_unique

The Dihedral group of order $$2n$$ for any integer $$n\geq 1$$.

INPUT:

• n – a positive integer

OUTPUT: the dihedral group of order $$2n$$, as a permutation group

Note

This group is also available via groups.permutation.Dihedral().

EXAMPLES:

sage: DihedralGroup(1)
Dihedral group of order 2 as a permutation group

sage: DihedralGroup(2)
Dihedral group of order 4 as a permutation group
sage: DihedralGroup(2).gens()
((3,4), (1,2))

sage: DihedralGroup(5).gens()
((1,2,3,4,5), (1,5)(2,4))
sage: sorted(DihedralGroup(5))
[(), (2,5)(3,4), (1,2)(3,5), (1,2,3,4,5), (1,3)(4,5), (1,3,5,2,4),
(1,4)(2,3), (1,4,2,5,3), (1,5,4,3,2), (1,5)(2,4)]

sage: G = DihedralGroup(6)
sage: G.order()
12
sage: G = DihedralGroup(5)
sage: G.order()
10
sage: G
Dihedral group of order 10 as a permutation group
sage: G.gens()
((1,2,3,4,5), (1,5)(2,4))

sage: DihedralGroup(0)
Traceback (most recent call last):
...
ValueError: n must be positive
>>> from sage.all import *
>>> DihedralGroup(Integer(1))
Dihedral group of order 2 as a permutation group

>>> DihedralGroup(Integer(2))
Dihedral group of order 4 as a permutation group
>>> DihedralGroup(Integer(2)).gens()
((3,4), (1,2))

>>> DihedralGroup(Integer(5)).gens()
((1,2,3,4,5), (1,5)(2,4))
>>> sorted(DihedralGroup(Integer(5)))
[(), (2,5)(3,4), (1,2)(3,5), (1,2,3,4,5), (1,3)(4,5), (1,3,5,2,4),
(1,4)(2,3), (1,4,2,5,3), (1,5,4,3,2), (1,5)(2,4)]

>>> G = DihedralGroup(Integer(6))
>>> G.order()
12
>>> G = DihedralGroup(Integer(5))
>>> G.order()
10
>>> G
Dihedral group of order 10 as a permutation group
>>> G.gens()
((1,2,3,4,5), (1,5)(2,4))

>>> DihedralGroup(Integer(0))
Traceback (most recent call last):
...
ValueError: n must be positive
class sage.groups.perm_gps.permgroup_named.GeneralDihedralGroup(factors)[source]#

Bases: PermutationGroup_generic

The Generalized Dihedral Group generated by the abelian group with direct factors in the input list.

INPUT:

• factors – a list of the sizes of the cyclic factors of the abelian group being dihedralized (this will be sorted once entered)

OUTPUT:

For a given abelian group (noting that each finite abelian group can be represented as the direct product of cyclic groups), the General Dihedral Group it generates is simply the semi-direct product of the given group with $$C_2$$, where the nonidentity element of $$C_2$$ acts on the abelian group by turning each element into its inverse. In this implementation, each input abelian group will be standardized so as to act on a minimal amount of letters. This will be done by breaking the direct factors into products of p-groups, before this new set of factors is ordered from smallest to largest for complete standardization. Note that the generalized dihedral group corresponding to a cyclic group, $$C_n$$, is simply the dihedral group $$D_n$$.

EXAMPLES:

As is noted in [TW1980], $$Dih(C_3 \times C_3)$$ has the presentation

$\langle a, b, c\mid a^{3}, b^{3}, c^{2}, ab = ba, ac = ca^{-1}, bc = cb^{-1} \rangle$

Note also the fact, verified by [TW1980], that the dihedralization of $$C_3 \times C_3$$ is the only nonabelian group of order 18 with no element of order 6.

sage: G = GeneralDihedralGroup([3,3])
sage: G
Generalized dihedral group generated by C3 x C3
sage: G.order()
18
sage: G.gens()
((4,5,6), (2,3)(5,6), (1,2,3))
sage: a = G.gens()[2]; b = G.gens()[0]; c = G.gens()[1]
sage: a.order() == 3, b.order() == 3, c.order() == 2
(True, True, True)
sage: a*b == b*a, a*c == c*a.inverse(), b*c == c*b.inverse()
(True, True, True)
sage: G.subgroup([a,b,c]) == G
True
sage: G.is_abelian()
False
sage: all(x.order() != 6 for x in G)
True
>>> from sage.all import *
>>> G = GeneralDihedralGroup([Integer(3),Integer(3)])
>>> G
Generalized dihedral group generated by C3 x C3
>>> G.order()
18
>>> G.gens()
((4,5,6), (2,3)(5,6), (1,2,3))
>>> a = G.gens()[Integer(2)]; b = G.gens()[Integer(0)]; c = G.gens()[Integer(1)]
>>> a.order() == Integer(3), b.order() == Integer(3), c.order() == Integer(2)
(True, True, True)
>>> a*b == b*a, a*c == c*a.inverse(), b*c == c*b.inverse()
(True, True, True)
>>> G.subgroup([a,b,c]) == G
True
>>> G.is_abelian()
False
>>> all(x.order() != Integer(6) for x in G)
True

If all of the direct factors are $$C_2$$, then the action turning each element into its inverse is trivial, and the semi-direct product becomes a direct product.

sage: G = GeneralDihedralGroup([2,2,2])
sage: G.order()
16
sage: G.gens()
((7,8), (5,6), (3,4), (1,2))
sage: G.is_abelian()
True
sage: H = KleinFourGroup()
sage: G.is_isomorphic(H.direct_product(H)[0])
True
>>> from sage.all import *
>>> G = GeneralDihedralGroup([Integer(2),Integer(2),Integer(2)])
>>> G.order()
16
>>> G.gens()
((7,8), (5,6), (3,4), (1,2))
>>> G.is_abelian()
True
>>> H = KleinFourGroup()
>>> G.is_isomorphic(H.direct_product(H)[Integer(0)])
True

If two nonidentical input lists generate isomorphic abelian groups, then they will generate identical groups (with each direct factor broken up into its prime factors), but they will still have distinct descriptions. Note that if $$\gcd(n,m)=1$$, then $$C_n \times C_m \cong C_{nm}$$, while the general dihedral groups generated by isomorphic abelian groups should be themselves isomorphic.

sage: G = GeneralDihedralGroup([6,34,46,14])
sage: H = GeneralDihedralGroup([7,17,3,46,2,2,2])
sage: G == H, G.gens() == H.gens()
(True, True)
sage: [x.order() for x in G.gens()]
[23, 17, 7, 2, 3, 2, 2, 2, 2]
sage: G
Generalized dihedral group generated by C6 x C34 x C46 x C14
sage: H
Generalized dihedral group generated by C7 x C17 x C3 x C46 x C2 x C2 x C2
>>> from sage.all import *
>>> G = GeneralDihedralGroup([Integer(6),Integer(34),Integer(46),Integer(14)])
>>> H = GeneralDihedralGroup([Integer(7),Integer(17),Integer(3),Integer(46),Integer(2),Integer(2),Integer(2)])
>>> G == H, G.gens() == H.gens()
(True, True)
>>> [x.order() for x in G.gens()]
[23, 17, 7, 2, 3, 2, 2, 2, 2]
>>> G
Generalized dihedral group generated by C6 x C34 x C46 x C14
>>> H
Generalized dihedral group generated by C7 x C17 x C3 x C46 x C2 x C2 x C2

A cyclic input yields a Classical Dihedral Group.

sage: G = GeneralDihedralGroup([6])
sage: D = DihedralGroup(6)
sage: G.is_isomorphic(D)
True
>>> from sage.all import *
>>> G = GeneralDihedralGroup([Integer(6)])
>>> D = DihedralGroup(Integer(6))
>>> G.is_isomorphic(D)
True

A Generalized Dihedral Group will always have size twice the underlying group, be solvable (as it has an abelian subgroup with index 2), and, unless the underlying group is of the form $${C_2}^n$$, be nonabelian (by the structure theorem of finite abelian groups and the fact that a semi-direct product is a direct product only when the underlying action is trivial).

sage: G = GeneralDihedralGroup([6,18,33,60])
sage: (6*18*33*60)*2
427680
sage: G.order()
427680
sage: G.is_solvable()
True
sage: G.is_abelian()
False
>>> from sage.all import *
>>> G = GeneralDihedralGroup([Integer(6),Integer(18),Integer(33),Integer(60)])
>>> (Integer(6)*Integer(18)*Integer(33)*Integer(60))*Integer(2)
427680
>>> G.order()
427680
>>> G.is_solvable()
True
>>> G.is_abelian()
False

AUTHOR:

• Kevin Halasz (2012-7-12)

class sage.groups.perm_gps.permgroup_named.JankoGroup(n)[source]#

Bases: PermutationGroup_unique

Janko Groups $$J1, J2$$, and $$J3$$. (Note that $$J4$$ is too big to be treated here.)

INPUT:

• n – integer among $$\{1,2,3\}$$.

EXAMPLES:

sage: G = groups.permutation.Janko(1); G                            # optional - gap_package_atlasrep internet
Janko group J1 of order 175560 as a permutation group
>>> from sage.all import *
>>> G = groups.permutation.Janko(Integer(1)); G                            # optional - gap_package_atlasrep internet
Janko group J1 of order 175560 as a permutation group
class sage.groups.perm_gps.permgroup_named.KleinFourGroup[source]#

Bases: PermutationGroup_unique

The Klein 4 Group, which has order $$4$$ and exponent $$2$$, viewed as a subgroup of $$S_4$$.

OUTPUT: the Klein 4 group of order 4, as a permutation group of degree 4

Note

This group is also available via groups.permutation.KleinFour().

EXAMPLES:

sage: G = KleinFourGroup(); G
The Klein 4 group of order 4, as a permutation group
sage: sorted(G)
[(), (3,4), (1,2), (1,2)(3,4)]
>>> from sage.all import *
>>> G = KleinFourGroup(); G
The Klein 4 group of order 4, as a permutation group
>>> sorted(G)
[(), (3,4), (1,2), (1,2)(3,4)]
AUTHOR:

– Bobby Moretti (2006-10)

class sage.groups.perm_gps.permgroup_named.MathieuGroup(n)[source]#

Bases: PermutationGroup_unique

The Mathieu group of degree $$n$$.

INPUT:

• n – a positive integer in {9, 10, 11, 12, 21, 22, 23, 24}.

OUTPUT: the Mathieu group of degree $$n$$, as a permutation group

Note

This group is also available via groups.permutation.Mathieu().

EXAMPLES:

sage: G = MathieuGroup(12); G
Mathieu group of degree 12 and order 95040 as a permutation group
>>> from sage.all import *
>>> G = MathieuGroup(Integer(12)); G
Mathieu group of degree 12 and order 95040 as a permutation group
class sage.groups.perm_gps.permgroup_named.PGL(n, q, name='a')[source]#

Bases: PermutationGroup_plg

The projective general linear groups over $$\GF(q)$$.

INPUT:

• n – positive integer; the degree

• q – prime power; the size of the ground field

• name – (default: 'a') variable name of indeterminate of finite field $$\GF(q)$$

OUTPUT: PGL($$n$$, $$q$$)

Note

This group is also available via groups.permutation.PGL().

EXAMPLES:

sage: G = PGL(2,3); G
Permutation Group with generators [(3,4), (1,2,4)]
sage: print(G)
The projective general linear group of degree 2 over Finite Field of size 3
sage: G.base_ring()
Finite Field of size 3
sage: G.order()
24

sage: G = PGL(2, 9, 'b'); G                                                 # needs sage.rings.finite_rings
Permutation Group with generators [(3,10,9,8,4,7,6,5), (1,2,4)(5,6,8)(7,9,10)]
sage: G.base_ring()
Finite Field in b of size 3^2

sage: G.category()
Category of finite enumerated permutation groups
sage: TestSuite(G).run()  # long time
>>> from sage.all import *
>>> G = PGL(Integer(2),Integer(3)); G
Permutation Group with generators [(3,4), (1,2,4)]
>>> print(G)
The projective general linear group of degree 2 over Finite Field of size 3
>>> G.base_ring()
Finite Field of size 3
>>> G.order()
24

>>> G = PGL(Integer(2), Integer(9), 'b'); G                                                 # needs sage.rings.finite_rings
Permutation Group with generators [(3,10,9,8,4,7,6,5), (1,2,4)(5,6,8)(7,9,10)]
>>> G.base_ring()
Finite Field in b of size 3^2

>>> G.category()
Category of finite enumerated permutation groups
>>> TestSuite(G).run()  # long time
class sage.groups.perm_gps.permgroup_named.PGU(n, q, name='a')[source]#

Bases: PermutationGroup_pug

The projective general unitary groups over $$\GF(q)$$.

INPUT:

• n – positive integer; the degree

• q – prime power; the size of the ground field

• name – (default: 'a') variable name of indeterminate of finite field $$\GF(q)$$

OUTPUT: PGU($$n$$, $$q$$)

Note

This group is also available via groups.permutation.PGU().

EXAMPLES:

sage: PGU(2,3)                                                              # needs sage.rings.finite_rings
The projective general unitary group of degree 2 over Finite Field of size 3

sage: G = PGU(2, 8, name='alpha'); G                                        # needs sage.rings.finite_rings
The projective general unitary group of degree 2
over Finite Field in alpha of size 2^3
sage: G.base_ring()                                                         # needs sage.rings.finite_rings
Finite Field in alpha of size 2^3
>>> from sage.all import *
>>> PGU(Integer(2),Integer(3))                                                              # needs sage.rings.finite_rings
The projective general unitary group of degree 2 over Finite Field of size 3

>>> G = PGU(Integer(2), Integer(8), name='alpha'); G                                        # needs sage.rings.finite_rings
The projective general unitary group of degree 2
over Finite Field in alpha of size 2^3
>>> G.base_ring()                                                         # needs sage.rings.finite_rings
Finite Field in alpha of size 2^3
class sage.groups.perm_gps.permgroup_named.PSL(n, q, name='a')[source]#

Bases: PermutationGroup_plg

The projective special linear groups over $$\GF(q)$$.

INPUT:

• n – positive integer; the degree

• q – either a prime power (the size of the ground field) or a finite field

• name – (default: 'a') variable name of indeterminate of finite field $$\GF(q)$$

OUTPUT: the group PSL($$n$$, $$q$$)

Note

This group is also available via groups.permutation.PSL().

EXAMPLES:

sage: G = PSL(2,3); G
Permutation Group with generators [(2,3,4), (1,2)(3,4)]
sage: G.order()
12
sage: G.base_ring()
Finite Field of size 3
sage: print(G)
The projective special linear group of degree 2 over Finite Field of size 3
>>> from sage.all import *
>>> G = PSL(Integer(2),Integer(3)); G
Permutation Group with generators [(2,3,4), (1,2)(3,4)]
>>> G.order()
12
>>> G.base_ring()
Finite Field of size 3
>>> print(G)
The projective special linear group of degree 2 over Finite Field of size 3

We create two groups over nontrivial finite fields:

sage: G = PSL(2, 4, 'b'); G                                                 # needs sage.rings.finite_rings
Permutation Group with generators [(3,4,5), (1,2,3)]
sage: G.base_ring()
Finite Field in b of size 2^2
sage: G = PSL(2, 8); G                                                      # needs sage.rings.finite_rings
Permutation Group with generators [(3,8,6,4,9,7,5), (1,2,3)(4,7,5)(6,9,8)]
sage: G.base_ring()
Finite Field in a of size 2^3

sage: G.category()
Category of finite enumerated permutation groups
sage: TestSuite(G).run()  # long time
>>> from sage.all import *
>>> G = PSL(Integer(2), Integer(4), 'b'); G                                                 # needs sage.rings.finite_rings
Permutation Group with generators [(3,4,5), (1,2,3)]
>>> G.base_ring()
Finite Field in b of size 2^2
>>> G = PSL(Integer(2), Integer(8)); G                                                      # needs sage.rings.finite_rings
Permutation Group with generators [(3,8,6,4,9,7,5), (1,2,3)(4,7,5)(6,9,8)]
>>> G.base_ring()
Finite Field in a of size 2^3

>>> G.category()
Category of finite enumerated permutation groups
>>> TestSuite(G).run()  # long time
ramification_module_decomposition_hurwitz_curve()[source]#

Helps compute the decomposition of the ramification module for the Hurwitz curves X (over $$\CC$$ say) with automorphism group G = PSL(2,q), q a “Hurwitz prime” (ie, p is $$\pm 1 \pmod 7$$). Using this computation and Borne’s formula helps determine the G-module structure of the RR spaces of equivariant divisors can be determined explicitly.

The output is a list of integer multiplicities: [m1,…,mn], where n is the number of conj classes of G=PSL(2,p) and mi is the multiplicity of pi_i in the ramification module of a Hurwitz curve with automorphism group G. Here IrrRepns(G) = [pi_1,…,pi_n] (in the order listed in the output of self.character_table()).

REFERENCE:

David Joyner, Amy Ksir, Roger Vogeler, “Group representations on Riemann-Roch spaces of some Hurwitz curves,” preprint, 2006.

EXAMPLES:

sage: G = PSL(2,13)
sage: G.ramification_module_decomposition_hurwitz_curve()  # random, optional - gap_packages
[0, 7, 7, 12, 12, 12, 13, 15, 14]
>>> from sage.all import *
>>> G = PSL(Integer(2),Integer(13))
>>> G.ramification_module_decomposition_hurwitz_curve()  # random, optional - gap_packages
[0, 7, 7, 12, 12, 12, 13, 15, 14]

This means, for example, that the trivial representation does not occur in the ramification module of a Hurwitz curve with automorphism group PSL(2,13), since the trivial representation is listed first and that entry has multiplicity 0. The “randomness” is due to the fact that GAP randomly orders the conjugacy classes of the same order in the list of all conjugacy classes. Similarly, there is some randomness to the ordering of the characters.

If you try to use this function on a group PSL(2,q) where q is not a (smallish) “Hurwitz prime”, an error message will be printed.

ramification_module_decomposition_modular_curve()[source]#

Helps compute the decomposition of the ramification module for the modular curve X(p) (over CC say) with automorphism group G = PSL(2,q), q a prime > 5. Using this computation and Borne’s formula helps determine the G-module structure of the RR spaces of equivariant divisors can be determined explicitly.

The output is a list of integer multiplicities: [m1,…,mn], where n is the number of conj classes of G=PSL(2,p) and mi is the multiplicity of pi_i in the ramification module of a modular curve with automorphism group G. Here IrrRepns(G) = [pi_1,…,pi_n] (in the order listed in the output of self.character_table()).

REFERENCE: D. Joyner and A. Ksir, ‘Modular representations

on some Riemann-Roch spaces of modular curves $$X(N)$$’, Computational Aspects of Algebraic Curves, (Editor: T. Shaska) Lecture Notes in Computing, WorldScientific, 2005.)

EXAMPLES:

sage: G = PSL(2,7)
sage: G.ramification_module_decomposition_modular_curve()  # random, optional - gap_packages
[0, 4, 3, 6, 7, 8]
>>> from sage.all import *
>>> G = PSL(Integer(2),Integer(7))
>>> G.ramification_module_decomposition_modular_curve()  # random, optional - gap_packages
[0, 4, 3, 6, 7, 8]

This means, for example, that the trivial representation does not occur in the ramification module of X(7), since the trivial representation is listed first and that entry has multiplicity 0. The “randomness” is due to the fact that GAP randomly orders the conjugacy classes of the same order in the list of all conjugacy classes. Similarly, there is some randomness to the ordering of the characters.

sage.groups.perm_gps.permgroup_named.PSP[source]#

alias of PSp

class sage.groups.perm_gps.permgroup_named.PSU(n, q, name='a')[source]#

Bases: PermutationGroup_pug

The projective special unitary groups over $$\GF(q)$$.

INPUT:

• n – positive integer; the degree

• q – prime power; the size of the ground field

• name – (default: ‘a’) variable name of indeterminate of finite field GF(q)

OUTPUT: PSU(n,q)

Note

This group is also available via groups.permutation.PSU().

EXAMPLES:

sage: PSU(2,3)                                                              # needs sage.rings.finite_rings
The projective special unitary group of degree 2 over Finite Field of size 3

sage: G = PSU(2, 8, name='alpha'); G                                        # needs sage.rings.finite_rings
The projective special unitary group of degree 2 over Finite Field in alpha of size 2^3
sage: G.base_ring()                                                         # needs sage.rings.finite_rings
Finite Field in alpha of size 2^3
>>> from sage.all import *
>>> PSU(Integer(2),Integer(3))                                                              # needs sage.rings.finite_rings
The projective special unitary group of degree 2 over Finite Field of size 3

>>> G = PSU(Integer(2), Integer(8), name='alpha'); G                                        # needs sage.rings.finite_rings
The projective special unitary group of degree 2 over Finite Field in alpha of size 2^3
>>> G.base_ring()                                                         # needs sage.rings.finite_rings
Finite Field in alpha of size 2^3
class sage.groups.perm_gps.permgroup_named.PSp(n, q, name='a')[source]#

Bases: PermutationGroup_plg

The projective symplectic linear groups over $$\GF(q)$$.

INPUT:

• n – positive integer; the degree

• q – prime power; the size of the ground field

• name – (default: 'a') variable name of indeterminate of finite field $$\GF(q)$$

OUTPUT: PSp($$n$$, $$q$$)

Note

This group is also available via groups.permutation.PSp().

EXAMPLES:

sage: G = PSp(2,3); G
Permutation Group with generators [(2,3,4), (1,2)(3,4)]
sage: G.order()
12
sage: G = PSp(4,3); G
Permutation Group with generators [(3,4)(6,7)(9,10)(12,13)(17,20)(18,21)(19,22)(23,32)(24,33)(25,34)(26,38)(27,39)(28,40)(29,35)(30,36)(31,37), (1,5,14,17,27,22,19,36,3)(2,6,32)(4,7,23,20,37,13,16,26,40)(8,24,29,30,39,10,33,11,34)(9,15,35)(12,25,38)(21,28,31)]
sage: G.order()
25920
sage: print(G)
The projective symplectic linear group of degree 4 over Finite Field of size 3
sage: G.base_ring()
Finite Field of size 3

sage: G = PSp(2, 8, name='alpha'); G                                        # needs sage.rings.finite_rings
Permutation Group with generators [(3,8,6,4,9,7,5), (1,2,3)(4,7,5)(6,9,8)]
sage: G.base_ring()
Finite Field in alpha of size 2^3
>>> from sage.all import *
>>> G = PSp(Integer(2),Integer(3)); G
Permutation Group with generators [(2,3,4), (1,2)(3,4)]
>>> G.order()
12
>>> G = PSp(Integer(4),Integer(3)); G
Permutation Group with generators [(3,4)(6,7)(9,10)(12,13)(17,20)(18,21)(19,22)(23,32)(24,33)(25,34)(26,38)(27,39)(28,40)(29,35)(30,36)(31,37), (1,5,14,17,27,22,19,36,3)(2,6,32)(4,7,23,20,37,13,16,26,40)(8,24,29,30,39,10,33,11,34)(9,15,35)(12,25,38)(21,28,31)]
>>> G.order()
25920
>>> print(G)
The projective symplectic linear group of degree 4 over Finite Field of size 3
>>> G.base_ring()
Finite Field of size 3

>>> G = PSp(Integer(2), Integer(8), name='alpha'); G                                        # needs sage.rings.finite_rings
Permutation Group with generators [(3,8,6,4,9,7,5), (1,2,3)(4,7,5)(6,9,8)]
>>> G.base_ring()
Finite Field in alpha of size 2^3
class sage.groups.perm_gps.permgroup_named.PermutationGroup_plg(gens=None, gap_group=None, canonicalize=True, domain=None, category=None)[source]#

Bases: PermutationGroup_unique

base_ring()[source]#

EXAMPLES:

sage: G = PGL(2,3)
sage: G.base_ring()
Finite Field of size 3

sage: G = PSL(2,3)
sage: G.base_ring()
Finite Field of size 3
>>> from sage.all import *
>>> G = PGL(Integer(2),Integer(3))
>>> G.base_ring()
Finite Field of size 3

>>> G = PSL(Integer(2),Integer(3))
>>> G.base_ring()
Finite Field of size 3
matrix_degree()[source]#

EXAMPLES:

sage: G = PSL(2,3)
sage: G.matrix_degree()
2
>>> from sage.all import *
>>> G = PSL(Integer(2),Integer(3))
>>> G.matrix_degree()
2
class sage.groups.perm_gps.permgroup_named.PermutationGroup_pug(gens=None, gap_group=None, canonicalize=True, domain=None, category=None)[source]#

Bases: PermutationGroup_plg

field_of_definition()[source]#

EXAMPLES:

sage: PSU(2,3).field_of_definition()                                        # needs sage.rings.finite_rings
Finite Field in a of size 3^2
>>> from sage.all import *
>>> PSU(Integer(2),Integer(3)).field_of_definition()                                        # needs sage.rings.finite_rings
Finite Field in a of size 3^2
class sage.groups.perm_gps.permgroup_named.PermutationGroup_symalt(gens=None, gap_group=None, canonicalize=True, domain=None, category=None)[source]#

Bases: PermutationGroup_unique

This is a class used to factor out some of the commonality in the SymmetricGroup and AlternatingGroup classes.

class sage.groups.perm_gps.permgroup_named.PermutationGroup_unique(gens=None, gap_group=None, canonicalize=True, domain=None, category=None)[source]#

Todo

Fix the broken hash.

sage: G = SymmetricGroup(6)
sage: G3 = G.subgroup([G((1,2,3,4,5,6)),G((1,2))])
sage: hash(G) == hash(G3)  # todo: Should be True!
False
>>> from sage.all import *
>>> G = SymmetricGroup(Integer(6))
>>> G3 = G.subgroup([G((Integer(1),Integer(2),Integer(3),Integer(4),Integer(5),Integer(6))),G((Integer(1),Integer(2)))])
>>> hash(G) == hash(G3)  # todo: Should be True!
False
class sage.groups.perm_gps.permgroup_named.PrimitiveGroup(d, n)[source]#

Bases: PermutationGroup_unique

The primitive group from the GAP tables of primitive groups.

INPUT:

• d – non-negative integer. the degree of the group.

• n – positive integer. the index of the group in the GAP database, starting at 1

OUTPUT: the n-th primitive group of degree d

EXAMPLES:

sage: PrimitiveGroup(0,1)
Trivial group
sage: PrimitiveGroup(1,1)
Trivial group
sage: G = PrimitiveGroup(5, 2); G
D(2*5)
sage: G.gens()
((2,4)(3,5), (1,2,3,5,4))
sage: G.category()
Category of finite enumerated permutation groups
>>> from sage.all import *
>>> PrimitiveGroup(Integer(0),Integer(1))
Trivial group
>>> PrimitiveGroup(Integer(1),Integer(1))
Trivial group
>>> G = PrimitiveGroup(Integer(5), Integer(2)); G
D(2*5)
>>> G.gens()
((2,4)(3,5), (1,2,3,5,4))
>>> G.category()
Category of finite enumerated permutation groups

Warning

this follows GAP’s naming convention of indexing the primitive groups starting from 1:

sage: PrimitiveGroup(5,0)
Traceback (most recent call last):
...
ValueError: index n must be in {1,..,5}
>>> from sage.all import *
>>> PrimitiveGroup(Integer(5),Integer(0))
Traceback (most recent call last):
...
ValueError: index n must be in {1,..,5}

Only primitive groups of “small” degree are available in GAP’s database:

sage: PrimitiveGroup(2^12,1)
Traceback (most recent call last):
...
GAPError: Error, Primitive groups of degree 4096 are not known!
>>> from sage.all import *
>>> PrimitiveGroup(Integer(2)**Integer(12),Integer(1))
Traceback (most recent call last):
...
GAPError: Error, Primitive groups of degree 4096 are not known!
group_primitive_id()[source]#

Return the index of this group in the GAP database of primitive groups.

OUTPUT: a positive integer, following GAP’s conventions

EXAMPLES:

sage: G = PrimitiveGroup(5,2); G.group_primitive_id()
2
>>> from sage.all import *
>>> G = PrimitiveGroup(Integer(5),Integer(2)); G.group_primitive_id()
2
sage.groups.perm_gps.permgroup_named.PrimitiveGroups(d=None)[source]#

Return the set of all primitive groups of a given degree d

INPUT:

• d – integer (optional)

OUTPUT:

The set of all primitive groups of a given degree d up to isomorphisms using GAP. If d is not specified, it returns the set of all primitive groups up to isomorphisms stored in GAP.

EXAMPLES:

sage: PrimitiveGroups(3)
Primitive Groups of degree 3
sage: PrimitiveGroups(7)
Primitive Groups of degree 7
sage: PrimitiveGroups(8)
Primitive Groups of degree 8
sage: PrimitiveGroups()
Primitive Groups
>>> from sage.all import *
>>> PrimitiveGroups(Integer(3))
Primitive Groups of degree 3
>>> PrimitiveGroups(Integer(7))
Primitive Groups of degree 7
>>> PrimitiveGroups(Integer(8))
Primitive Groups of degree 8
>>> PrimitiveGroups()
Primitive Groups

The database is currently limited:

sage: PrimitiveGroups(2^12).cardinality()
Traceback (most recent call last):
...
GAPError: Error, Primitive groups of degree 4096 are not known!
>>> from sage.all import *
>>> PrimitiveGroups(Integer(2)**Integer(12)).cardinality()
Traceback (most recent call last):
...
GAPError: Error, Primitive groups of degree 4096 are not known!

Todo

This enumeration helper could be extended based on PrimitiveGroupsIterator in GAP. This method allows to enumerate groups with specified properties such as transitivity, solvability, …, without creating all groups.

class sage.groups.perm_gps.permgroup_named.PrimitiveGroupsAll[source]#

The infinite set of all primitive groups up to isomorphisms.

EXAMPLES:

sage: L = PrimitiveGroups(); L
Primitive Groups
sage: L.category()
Category of facade infinite enumerated sets
sage: L.cardinality()
+Infinity

sage: p = L.__iter__()
sage: (next(p), next(p), next(p), next(p),
....:  next(p), next(p), next(p), next(p))
(Trivial group, Trivial group, S(2), A(3), S(3), A(4), S(4), C(5))
>>> from sage.all import *
>>> L = PrimitiveGroups(); L
Primitive Groups
>>> L.category()
Category of facade infinite enumerated sets
>>> L.cardinality()
+Infinity

>>> p = L.__iter__()
>>> (next(p), next(p), next(p), next(p),
...  next(p), next(p), next(p), next(p))
(Trivial group, Trivial group, S(2), A(3), S(3), A(4), S(4), C(5))
class sage.groups.perm_gps.permgroup_named.PrimitiveGroupsOfDegree(n)[source]#

Bases: CachedRepresentation, Parent

The set of all primitive groups of a given degree up to isomorphisms.

EXAMPLES:

sage: S = PrimitiveGroups(5); S
Primitive Groups of degree 5
sage: S.list()
[C(5), D(2*5), AGL(1, 5), A(5), S(5)]
sage: S.an_element()
C(5)
>>> from sage.all import *
>>> S = PrimitiveGroups(Integer(5)); S
Primitive Groups of degree 5
>>> S.list()
[C(5), D(2*5), AGL(1, 5), A(5), S(5)]
>>> S.an_element()
C(5)

We write the cardinality of all primitive groups of degree 5:

sage: for G in PrimitiveGroups(5):
....:     print(G.cardinality())
5
10
20
60
120
>>> from sage.all import *
>>> for G in PrimitiveGroups(Integer(5)):
...     print(G.cardinality())
5
10
20
60
120
cardinality()[source]#

Return the cardinality of self.

OUTPUT: integer; the number of primitive groups of a given degree up to isomorphism

EXAMPLES:

sage: PrimitiveGroups(0).cardinality()
1
sage: PrimitiveGroups(2).cardinality()
1
sage: PrimitiveGroups(7).cardinality()
7
sage: PrimitiveGroups(12).cardinality()
6
sage: [PrimitiveGroups(i).cardinality() for i in range(11)]
[1, 1, 1, 2, 2, 5, 4, 7, 7, 11, 9]
>>> from sage.all import *
>>> PrimitiveGroups(Integer(0)).cardinality()
1
>>> PrimitiveGroups(Integer(2)).cardinality()
1
>>> PrimitiveGroups(Integer(7)).cardinality()
7
>>> PrimitiveGroups(Integer(12)).cardinality()
6
>>> [PrimitiveGroups(i).cardinality() for i in range(Integer(11))]
[1, 1, 1, 2, 2, 5, 4, 7, 7, 11, 9]
class sage.groups.perm_gps.permgroup_named.QuaternionGroup[source]#

Bases: DiCyclicGroup

The quaternion group of order 8.

OUTPUT:

The quaternion group of order 8, as a permutation group. See the DiCyclicGroup class for a generalization of this construction.

Note

This group is also available via groups.permutation.Quaternion().

EXAMPLES:

The quaternion group is one of two non-abelian groups of order 8, the other being the dihedral group $$D_4$$. One way to describe this group is with three generators, $$I, J, K$$, so the whole group is then given as the set $$\{\pm 1, \pm I, \pm J, \pm K\}$$ with relations such as $$I^2=J^2=K^2=-1$$, $$IJ=K$$ and $$JI=-K$$.

The examples below illustrate how to use this group in a similar manner, by testing some of these relations. The representation used here is the left-regular representation.

sage: Q = QuaternionGroup()
sage: I = Q.gen(0)
sage: J = Q.gen(1)
sage: K = I*J
sage: [I,J,K]
[(1,2,3,4)(5,6,7,8), (1,5,3,7)(2,8,4,6), (1,8,3,6)(2,7,4,5)]
sage: neg_one = I^2; neg_one
(1,3)(2,4)(5,7)(6,8)
sage: J^2 == neg_one and K^2 == neg_one
True
sage: J*I == neg_one*K
True
sage: Q.center().order() == 2
True
sage: neg_one in Q.center()
True
>>> from sage.all import *
>>> Q = QuaternionGroup()
>>> I = Q.gen(Integer(0))
>>> J = Q.gen(Integer(1))
>>> K = I*J
>>> [I,J,K]
[(1,2,3,4)(5,6,7,8), (1,5,3,7)(2,8,4,6), (1,8,3,6)(2,7,4,5)]
>>> neg_one = I**Integer(2); neg_one
(1,3)(2,4)(5,7)(6,8)
>>> J**Integer(2) == neg_one and K**Integer(2) == neg_one
True
>>> J*I == neg_one*K
True
>>> Q.center().order() == Integer(2)
True
>>> neg_one in Q.center()
True

AUTHOR:

• Rob Beezer (2009-10-09)

class sage.groups.perm_gps.permgroup_named.SemidihedralGroup(m)[source]#

Bases: PermutationGroup_unique

The semidihedral group of order $$2^m$$.

INPUT:

• m – a positive integer; the power of 2 that is the group’s order

OUTPUT:

The semidihedral group of order $$2^m$$. These groups can be thought of as a semidirect product of $$C_{2^{m-1}}$$ with $$C_2$$, where the nontrivial element of $$C_2$$ is sent to the element of the automorphism group of $$C_{2^{m-1}}$$ that sends elements to their $$-1+2^{m-2}$$ th power. Thus, the group has the presentation:

$\langle x, y\mid x^{2^{m-1}}, y^{2}, y^{-1}xy=x^{-1+2^{m-2}} \rangle$

This family is notable because it is made up of non-abelian 2-groups that all contain cyclic subgroups of index 2. It is one of only four such families.

EXAMPLES:

In [Gor1980] it is shown that the semidihedral groups have center of order 2. It is also shown that they have a Frattini subgroup equal to their commutator, which is a cyclic subgroup of order $$2^{m-2}$$.

sage: G = SemidihedralGroup(12)
sage: G.order() == 2^12
True
sage: G.commutator() == G.frattini_subgroup()
True
sage: G.commutator().order() == 2^10
True
sage: G.commutator().is_cyclic()
True
sage: G.center().order()
2

sage: G = SemidihedralGroup(4)
sage: len([H for H in G.subgroups() if H.is_cyclic() and H.order() == 8])
1
sage: G.gens()
((2,4)(3,7)(6,8), (1,2,3,4,5,6,7,8))
sage: x = G.gens()[1]; y = G.gens()[0]
sage: x.order() == 2^3; y.order() == 2
True
True
sage: y*x*y == x^(-1+2^2)
True
>>> from sage.all import *
>>> G = SemidihedralGroup(Integer(12))
>>> G.order() == Integer(2)**Integer(12)
True
>>> G.commutator() == G.frattini_subgroup()
True
>>> G.commutator().order() == Integer(2)**Integer(10)
True
>>> G.commutator().is_cyclic()
True
>>> G.center().order()
2

>>> G = SemidihedralGroup(Integer(4))
>>> len([H for H in G.subgroups() if H.is_cyclic() and H.order() == Integer(8)])
1
>>> G.gens()
((2,4)(3,7)(6,8), (1,2,3,4,5,6,7,8))
>>> x = G.gens()[Integer(1)]; y = G.gens()[Integer(0)]
>>> x.order() == Integer(2)**Integer(3); y.order() == Integer(2)
True
True
>>> y*x*y == x**(-Integer(1)+Integer(2)**Integer(2))
True

AUTHOR:

• Kevin Halasz (2012-8-7)

class sage.groups.perm_gps.permgroup_named.SmallPermutationGroup(order, gap_id)[source]#

Bases: PermutationGroup_generic

A GAP SmallGroup, returned as a permutation group.

GAP contains a library SGL of small groups, each identified by its GAP SmallGroup id. (MAGMA uses the same identifiers). The GAP SmallGroup id is a pair [n,k] consisting of n, the order of the group, and k, an index determining the group specifically. This class can construct the group as a permutation group from this data.

INPUT:

• order – the order of the group

• gap_id – the numerical index in the GAP id of the group

Generators may be obtained through the gens() method. These could change for a particular group in later releases of GAP. In many instances the degree of the constructed group SmallPermutationGroup(n,k) will be a permutation group on $$n$$ letters, but this will not always be true.

EXAMPLES:

sage: G = SmallPermutationGroup(12,4); G
Group of order 12 and GAP Id 4 as a permutation group
sage: G.gens()
((1,2)(3,5)(4,10)(6,8)(7,12)(9,11),
(1,3)(2,5)(4,7)(6,9)(8,11)(10,12),
(1,4,8)(2,6,10)(3,7,11)(5,9,12))
sage: G.character_table()                                                       # needs sage.rings.number_field
[ 1  1  1  1  1  1]
[ 1 -1 -1  1  1 -1]
[ 1 -1  1  1 -1  1]
[ 1  1 -1  1 -1 -1]
[ 2  0 -2 -1  0  1]
[ 2  0  2 -1  0 -1]
sage: def numgps(n): return ZZ(libgap.NumberSmallGroups(n))
sage: all(SmallPermutationGroup(n,k).id() == [n,k]
....:     for n in [1..64] for k in [1..numgps(n)])
True
sage: H = SmallPermutationGroup(6,1)
sage: H.is_abelian()
False
sage: [H.centralizer(g) for g in H.conjugacy_classes_representatives()]
[Subgroup generated by [(1,2)(3,6)(4,5), (1,3,5)(2,4,6)] of
(Group of order 6 and GAP Id 1 as a permutation group),
Subgroup generated by [(1,2)(3,6)(4,5)] of
(Group of order 6 and GAP Id 1 as a permutation group),
Subgroup generated by [(1,3,5)(2,4,6), (1,5,3)(2,6,4)] of
(Group of order 6 and GAP Id 1 as a permutation group)]
>>> from sage.all import *
>>> G = SmallPermutationGroup(Integer(12),Integer(4)); G
Group of order 12 and GAP Id 4 as a permutation group
>>> G.gens()
((1,2)(3,5)(4,10)(6,8)(7,12)(9,11),
(1,3)(2,5)(4,7)(6,9)(8,11)(10,12),
(1,4,8)(2,6,10)(3,7,11)(5,9,12))
>>> G.character_table()                                                       # needs sage.rings.number_field
[ 1  1  1  1  1  1]
[ 1 -1 -1  1  1 -1]
[ 1 -1  1  1 -1  1]
[ 1  1 -1  1 -1 -1]
[ 2  0 -2 -1  0  1]
[ 2  0  2 -1  0 -1]
>>> def numgps(n): return ZZ(libgap.NumberSmallGroups(n))
>>> all(SmallPermutationGroup(n,k).id() == [n,k]
...     for n in (ellipsis_range(Integer(1),Ellipsis,Integer(64))) for k in (ellipsis_range(Integer(1),Ellipsis,numgps(n))))
True
>>> H = SmallPermutationGroup(Integer(6),Integer(1))
>>> H.is_abelian()
False
>>> [H.centralizer(g) for g in H.conjugacy_classes_representatives()]
[Subgroup generated by [(1,2)(3,6)(4,5), (1,3,5)(2,4,6)] of
(Group of order 6 and GAP Id 1 as a permutation group),
Subgroup generated by [(1,2)(3,6)(4,5)] of
(Group of order 6 and GAP Id 1 as a permutation group),
Subgroup generated by [(1,3,5)(2,4,6), (1,5,3)(2,6,4)] of
(Group of order 6 and GAP Id 1 as a permutation group)]
gap_small_group()[source]#

Return the GAP small group object corresponding to self.

GAP realizes some small groups as PermutationGroup, others as PcGroups (polycyclic groups). The SmallPermutationGroup class always returns a PermutationGroup, but in the process of creating this group a GAP SmallGroup is generated. This method returns that group.

EXAMPLES:

sage: SmallPermutationGroup(168,41).gap_small_group()
<pc group of size 168 with 5 generators>
sage: SmallPermutationGroup(168,42).gap_small_group()
Group([ (3,4)(5,6), (1,2,3)(4,5,7) ])
>>> from sage.all import *
>>> SmallPermutationGroup(Integer(168),Integer(41)).gap_small_group()
<pc group of size 168 with 5 generators>
>>> SmallPermutationGroup(Integer(168),Integer(42)).gap_small_group()
Group([ (3,4)(5,6), (1,2,3)(4,5,7) ])
order()[source]#

Return the order of the group corresponding to self.

EXAMPLES:

sage: [SmallPermutationGroup(21,k).order() for k in [1,2]]
[21, 21]
>>> from sage.all import *
>>> [SmallPermutationGroup(Integer(21),k).order() for k in [Integer(1),Integer(2)]]
[21, 21]
class sage.groups.perm_gps.permgroup_named.SplitMetacyclicGroup(p, m)[source]#

Bases: PermutationGroup_unique

The split metacyclic group of order $$p^m$$.

INPUT:

• p – a prime number that is the prime underlying this p-group

• m – a positive integer such that the order of this group is the $$p^m$$. Be aware that, for even $$p$$, $$m$$ must be greater than 3, while for odd $$p$$, $$m$$ must be greater than 2.

OUTPUT:

The split metacyclic group of order $$p^m$$. This family of groups has presentation

$\langle x, y\mid x^{p^{m-1}}, y^{p}, y^{-1}xy=x^{1+p^{m-2}} \rangle$

This family is notable because, for odd $$p$$, these are the only $$p$$-groups with a cyclic subgroup of index $$p$$, a result proven in [Gor1980]. It is also shown in [Gor1980] that this is one of four families containing nonabelian 2-groups with a cyclic subgroup of index 2 (with the others being the dicyclic groups, the dihedral groups, and the semidihedral groups).

EXAMPLES:

Using the last relation in the group’s presentation, one can see that the elements of the form $$y^{i}x$$, $$0 \leq i \leq p-1$$ all have order $$p^{m-1}$$, as it can be shown that their $$p$$ th powers are all $$x^{p^{m-2}+p}$$, an element with order $$p^{m-2}$$. Manipulation of the same relation shows that none of these elements are powers of any other. Thus, there are $$p$$ cyclic maximal subgroups in each split metacyclic group. It is also proven in [Gor1980] that this family has commutator subgroup of order $$p$$, and the Frattini subgroup is equal to the center, with this group being cyclic of order $$p^{m-2}$$. These characteristics are necessary to identify these groups in the case that $$p=2$$, although the possession of a cyclic maximal subgroup in a non-abelian $$p$$-group is enough for odd $$p$$ given the group’s order.

sage: G = SplitMetacyclicGroup(2,8)
sage: G.order() == 2**8
True
sage: G.is_abelian()
False
sage: len([H for H in G.subgroups() if H.order() == 2^7 and H.is_cyclic()])
2
sage: G.commutator().order()
2
sage: G.frattini_subgroup() == G.center()
True
sage: G.center().order() == 2^6
True
sage: G.center().is_cyclic()
True

sage: G = SplitMetacyclicGroup(3,3)
sage: len([H for H in G.subgroups() if H.order() == 3^2 and H.is_cyclic()])
3
sage: G.commutator().order()
3
sage: G.frattini_subgroup() == G.center()
True
sage: G.center().order()
3
>>> from sage.all import *
>>> G = SplitMetacyclicGroup(Integer(2),Integer(8))
>>> G.order() == Integer(2)**Integer(8)
True
>>> G.is_abelian()
False
>>> len([H for H in G.subgroups() if H.order() == Integer(2)**Integer(7) and H.is_cyclic()])
2
>>> G.commutator().order()
2
>>> G.frattini_subgroup() == G.center()
True
>>> G.center().order() == Integer(2)**Integer(6)
True
>>> G.center().is_cyclic()
True

>>> G = SplitMetacyclicGroup(Integer(3),Integer(3))
>>> len([H for H in G.subgroups() if H.order() == Integer(3)**Integer(2) and H.is_cyclic()])
3
>>> G.commutator().order()
3
>>> G.frattini_subgroup() == G.center()
True
>>> G.center().order()
3

AUTHOR:

• Kevin Halasz (2012-8-7)

class sage.groups.perm_gps.permgroup_named.SuzukiGroup(q, name='a')[source]#

Bases: PermutationGroup_unique

The Suzuki group over $$\GF(q)$$, $$^2 B_2(2^{2k+1}) = Sz(2^{2k+1})$$.

A wrapper for the GAP function SuzukiGroup.

INPUT:

• q$$2^n$$, an odd power of 2; the size of the ground field. (Strictly speaking, $$n$$ should be greater than 1, or else this group is not simple.)

• name – (default: 'a') variable name of indeterminate of finite field $$\GF(q)$$

OUTPUT: a Suzuki group

Note

This group is also available via groups.permutation.Suzuki().

EXAMPLES:

sage: SuzukiGroup(8)                                                        # needs sage.rings.finite_rings
Permutation Group with generators [(1,28,10,44)(3,50,11,42)(4,43,53,64)(5,9,39,52)(6,36,63,13)(7,51,60,57)(8,33,37,16)(12,24,55,29)(14,30,48,47)(15,19,61,54)(17,59,22,62)(18,23,34,31)(20,38,49,25)(21,26,45,58)(27,32,41,65)(35,46,40,56),
(1,2)(3,10)(4,42)(5,18)(6,50)(7,26)(8,58)(9,34)(12,28)(13,45)(14,44)(15,23)(16,31)(17,21)(19,39)(20,38)(22,25)(24,61)(27,60)(29,65)(30,55)(32,33)(35,52)(36,49)(37,59)(40,54)(41,62)(43,53)(46,48)(47,56)(51,63)(57,64)]
sage: print(SuzukiGroup(8))                                                 # needs sage.rings.finite_rings
The Suzuki group over Finite Field in a of size 2^3

sage: # needs sage.rings.finite_rings
sage: G = SuzukiGroup(32, name='alpha')
sage: G.order()
32537600
sage: G.order().factor()
2^10 * 5^2 * 31 * 41
sage: G.base_ring()
Finite Field in alpha of size 2^5
>>> from sage.all import *
>>> SuzukiGroup(Integer(8))                                                        # needs sage.rings.finite_rings
Permutation Group with generators [(1,28,10,44)(3,50,11,42)(4,43,53,64)(5,9,39,52)(6,36,63,13)(7,51,60,57)(8,33,37,16)(12,24,55,29)(14,30,48,47)(15,19,61,54)(17,59,22,62)(18,23,34,31)(20,38,49,25)(21,26,45,58)(27,32,41,65)(35,46,40,56),
(1,2)(3,10)(4,42)(5,18)(6,50)(7,26)(8,58)(9,34)(12,28)(13,45)(14,44)(15,23)(16,31)(17,21)(19,39)(20,38)(22,25)(24,61)(27,60)(29,65)(30,55)(32,33)(35,52)(36,49)(37,59)(40,54)(41,62)(43,53)(46,48)(47,56)(51,63)(57,64)]
>>> print(SuzukiGroup(Integer(8)))                                                 # needs sage.rings.finite_rings
The Suzuki group over Finite Field in a of size 2^3

>>> # needs sage.rings.finite_rings
>>> G = SuzukiGroup(Integer(32), name='alpha')
>>> G.order()
32537600
>>> G.order().factor()
2^10 * 5^2 * 31 * 41
>>> G.base_ring()
Finite Field in alpha of size 2^5

REFERENCES:

base_ring()[source]#

EXAMPLES:

sage: G = SuzukiGroup(32, name='alpha')                                     # needs sage.rings.finite_rings
sage: G.base_ring()                                                         # needs sage.rings.finite_rings
Finite Field in alpha of size 2^5
>>> from sage.all import *
>>> G = SuzukiGroup(Integer(32), name='alpha')                                     # needs sage.rings.finite_rings
>>> G.base_ring()                                                         # needs sage.rings.finite_rings
Finite Field in alpha of size 2^5

Bases: PermutationGroup_unique

EXAMPLES:

sage: G = groups.permutation.SuzukiSporadic(); G                    # optional - gap_package_atlasrep internet
Sporadic Suzuki group acting on 1782 points
>>> from sage.all import *
>>> G = groups.permutation.SuzukiSporadic(); G                    # optional - gap_package_atlasrep internet
Sporadic Suzuki group acting on 1782 points
class sage.groups.perm_gps.permgroup_named.SymmetricGroup(domain=None)[source]#

Bases: PermutationGroup_symalt

The full symmetric group of order $$n!$$, as a permutation group.

If $$n$$ is a list or tuple of positive integers then it returns the symmetric group of the associated set.

INPUT:

• n – a positive integer, or list or tuple thereof

Note

This group is also available via groups.permutation.Symmetric().

EXAMPLES:

sage: G = SymmetricGroup(8)
sage: G.order()
40320
sage: G
Symmetric group of order 8! as a permutation group
sage: G.degree()
8
sage: S8 = SymmetricGroup(8)
sage: G = SymmetricGroup([1,2,4,5])
sage: G
Symmetric group of order 4! as a permutation group
sage: G.domain()
{1, 2, 4, 5}
sage: G = SymmetricGroup(4)
sage: G
Symmetric group of order 4! as a permutation group
sage: G.domain()
{1, 2, 3, 4}
sage: G.category()
Join of Category of finite enumerated permutation groups and
Category of finite Weyl groups and
Category of well generated finite irreducible complex reflection groups
>>> from sage.all import *
>>> G = SymmetricGroup(Integer(8))
>>> G.order()
40320
>>> G
Symmetric group of order 8! as a permutation group
>>> G.degree()
8
>>> S8 = SymmetricGroup(Integer(8))
>>> G = SymmetricGroup([Integer(1),Integer(2),Integer(4),Integer(5)])
>>> G
Symmetric group of order 4! as a permutation group
>>> G.domain()
{1, 2, 4, 5}
>>> G = SymmetricGroup(Integer(4))
>>> G
Symmetric group of order 4! as a permutation group
>>> G.domain()
{1, 2, 3, 4}
>>> G.category()
Join of Category of finite enumerated permutation groups and
Category of finite Weyl groups and
Category of well generated finite irreducible complex reflection groups
Element[source]#

alias of SymmetricGroupElement

algebra(base_ring, category=None)[source]#

Return the symmetric group algebra associated to self.

INPUT:

• base_ring – a ring

• category – a category (default: the category of self)

If self is the symmetric group on $$1,\ldots,n$$, then this is special cased to take advantage of the features in SymmetricGroupAlgebra. Otherwise the usual group algebra is returned.

EXAMPLES:

sage: S4 = SymmetricGroup(4)
sage: S4.algebra(QQ)                                                        # needs sage.combinat
Symmetric group algebra of order 4 over Rational Field

sage: S3 = SymmetricGroup([1,2,3])
sage: A = S3.algebra(QQ); A                                                 # needs sage.combinat
Symmetric group algebra of order 3 over Rational Field
sage: a = S3.an_element(); a
(2,3)
sage: A(a)                                                                  # needs sage.combinat
(2,3)
>>> from sage.all import *
>>> S4 = SymmetricGroup(Integer(4))
>>> S4.algebra(QQ)                                                        # needs sage.combinat
Symmetric group algebra of order 4 over Rational Field

>>> S3 = SymmetricGroup([Integer(1),Integer(2),Integer(3)])
>>> A = S3.algebra(QQ); A                                                 # needs sage.combinat
Symmetric group algebra of order 3 over Rational Field
>>> a = S3.an_element(); a
(2,3)
>>> A(a)                                                                  # needs sage.combinat
(2,3)

We illustrate the choice of the category:

sage: A.category()                                                          # needs sage.combinat
Join of Category of Coxeter group algebras over Rational Field
and Category of finite group algebras over Rational Field
and Category of finite dimensional cellular algebras with basis
over Rational Field
sage: A = S3.algebra(QQ, category=Semigroups())                             # needs sage.combinat
sage: A.category()                                                          # needs sage.combinat
Category of finite dimensional unital cellular semigroup algebras
over Rational Field
>>> from sage.all import *
>>> A.category()                                                          # needs sage.combinat
Join of Category of Coxeter group algebras over Rational Field
and Category of finite group algebras over Rational Field
and Category of finite dimensional cellular algebras with basis
over Rational Field
>>> A = S3.algebra(QQ, category=Semigroups())                             # needs sage.combinat
>>> A.category()                                                          # needs sage.combinat
Category of finite dimensional unital cellular semigroup algebras
over Rational Field

In the following case, a usual group algebra is returned:

sage: S = SymmetricGroup([2,3,5])
sage: S.algebra(QQ)                                                         # needs sage.combinat
Algebra of Symmetric group of order 3! as a permutation group over Rational Field
sage: a = S.an_element(); a
(3,5)
sage: S.algebra(QQ)(a)                                                      # needs sage.combinat
(3,5)
>>> from sage.all import *
>>> S = SymmetricGroup([Integer(2),Integer(3),Integer(5)])
>>> S.algebra(QQ)                                                         # needs sage.combinat
Algebra of Symmetric group of order 3! as a permutation group over Rational Field
>>> a = S.an_element(); a
(3,5)
>>> S.algebra(QQ)(a)                                                      # needs sage.combinat
(3,5)
cartan_type()[source]#

Return the Cartan type of self

The symmetric group $$S_n$$ is a Coxeter group of type $$A_{n-1}$$.

EXAMPLES:

sage: A = SymmetricGroup([2,3,7]); A.cartan_type()
['A', 2]

sage: A = SymmetricGroup([]); A.cartan_type()
['A', 0]
>>> from sage.all import *
>>> A = SymmetricGroup([Integer(2),Integer(3),Integer(7)]); A.cartan_type()
['A', 2]

>>> A = SymmetricGroup([]); A.cartan_type()
['A', 0]
conjugacy_class(g)[source]#

Return the conjugacy class of g inside the symmetric group self.

INPUT:

• g – a partition or an element of the symmetric group self

OUTPUT: a conjugacy class of a symmetric group

EXAMPLES:

sage: G = SymmetricGroup(5)
sage: g = G((1,2,3,4))
sage: G.conjugacy_class(g)                                                  # needs sage.combinat
Conjugacy class of cycle type [4, 1] in
Symmetric group of order 5! as a permutation group
>>> from sage.all import *
>>> G = SymmetricGroup(Integer(5))
>>> g = G((Integer(1),Integer(2),Integer(3),Integer(4)))
>>> G.conjugacy_class(g)                                                  # needs sage.combinat
Conjugacy class of cycle type [4, 1] in
Symmetric group of order 5! as a permutation group
conjugacy_classes()[source]#

Return a list of the conjugacy classes of self.

EXAMPLES:

sage: G = SymmetricGroup(5)
sage: G.conjugacy_classes()                                                 # needs sage.combinat
[Conjugacy class of cycle type [1, 1, 1, 1, 1] in
Symmetric group of order 5! as a permutation group,
Conjugacy class of cycle type [2, 1, 1, 1] in
Symmetric group of order 5! as a permutation group,
Conjugacy class of cycle type [2, 2, 1] in
Symmetric group of order 5! as a permutation group,
Conjugacy class of cycle type [3, 1, 1] in
Symmetric group of order 5! as a permutation group,
Conjugacy class of cycle type [3, 2] in
Symmetric group of order 5! as a permutation group,
Conjugacy class of cycle type [4, 1] in
Symmetric group of order 5! as a permutation group,
Conjugacy class of cycle type [5] in
Symmetric group of order 5! as a permutation group]
>>> from sage.all import *
>>> G = SymmetricGroup(Integer(5))
>>> G.conjugacy_classes()                                                 # needs sage.combinat
[Conjugacy class of cycle type [1, 1, 1, 1, 1] in
Symmetric group of order 5! as a permutation group,
Conjugacy class of cycle type [2, 1, 1, 1] in
Symmetric group of order 5! as a permutation group,
Conjugacy class of cycle type [2, 2, 1] in
Symmetric group of order 5! as a permutation group,
Conjugacy class of cycle type [3, 1, 1] in
Symmetric group of order 5! as a permutation group,
Conjugacy class of cycle type [3, 2] in
Symmetric group of order 5! as a permutation group,
Conjugacy class of cycle type [4, 1] in
Symmetric group of order 5! as a permutation group,
Conjugacy class of cycle type [5] in
Symmetric group of order 5! as a permutation group]
conjugacy_classes_iterator()[source]#

Iterate over the conjugacy classes of self.

EXAMPLES:

sage: G = SymmetricGroup(5)
sage: list(G.conjugacy_classes_iterator()) == G.conjugacy_classes()         # needs sage.combinat
True
>>> from sage.all import *
>>> G = SymmetricGroup(Integer(5))
>>> list(G.conjugacy_classes_iterator()) == G.conjugacy_classes()         # needs sage.combinat
True
conjugacy_classes_representatives()[source]#

Return a complete list of representatives of conjugacy classes in a permutation group $$G$$.

Let $$S_n$$ be the symmetric group on $$n$$ letters. The conjugacy classes are indexed by partitions $$\lambda$$ of $$n$$. The ordering of the conjugacy classes is reverse lexicographic order of the partitions.

EXAMPLES:

sage: G = SymmetricGroup(5)
sage: G.conjugacy_classes_representatives()                                 # needs sage.combinat
[(), (1,2), (1,2)(3,4), (1,2,3), (1,2,3)(4,5),
(1,2,3,4), (1,2,3,4,5)]
>>> from sage.all import *
>>> G = SymmetricGroup(Integer(5))
>>> G.conjugacy_classes_representatives()                                 # needs sage.combinat
[(), (1,2), (1,2)(3,4), (1,2,3), (1,2,3)(4,5),
(1,2,3,4), (1,2,3,4,5)]
sage: S = SymmetricGroup(['a','b','c'])
sage: S.conjugacy_classes_representatives()                                 # needs sage.combinat
[(), ('a','b'), ('a','b','c')]
>>> from sage.all import *
>>> S = SymmetricGroup(['a','b','c'])
>>> S.conjugacy_classes_representatives()                                 # needs sage.combinat
[(), ('a','b'), ('a','b','c')]
coxeter_matrix()[source]#

Return the Coxeter matrix of self.

EXAMPLES:

sage: A = SymmetricGroup([2,3,7,'a']); A.coxeter_matrix()                   # needs sage.graphs
[1 3 2]
[3 1 3]
[2 3 1]
>>> from sage.all import *
>>> A = SymmetricGroup([Integer(2),Integer(3),Integer(7),'a']); A.coxeter_matrix()                   # needs sage.graphs
[1 3 2]
[3 1 3]
[2 3 1]
index_set()[source]#

Return the index set for the descents of the symmetric group self.

EXAMPLES:

sage: S8 = SymmetricGroup(8)
sage: S8.index_set()
(1, 2, 3, 4, 5, 6, 7)

sage: S = SymmetricGroup([3,1,4,5])
sage: S.index_set()
(3, 1, 4)
>>> from sage.all import *
>>> S8 = SymmetricGroup(Integer(8))
>>> S8.index_set()
(1, 2, 3, 4, 5, 6, 7)

>>> S = SymmetricGroup([Integer(3),Integer(1),Integer(4),Integer(5)])
>>> S.index_set()
(3, 1, 4)
major_index(parameter=None)[source]#

Return the major index generating polynomial of self.

This is a gadget counting the elements of self by major index.

INPUT:

• parameter – an element of a ring; the result is more explicit with a formal variable (default: element q of Univariate Polynomial Ring in q over Integer Ring)

$P(q) = \sum_{g\in S_n} q^{ \operatorname{major\ index}(g) }$

EXAMPLES:

sage: S4 = SymmetricGroup(4)
sage: S4.major_index()                                                      # needs sage.combinat
q^6 + 3*q^5 + 5*q^4 + 6*q^3 + 5*q^2 + 3*q + 1
sage: K.<t> = QQ[]
sage: S4.major_index(t)                                                     # needs sage.combinat
t^6 + 3*t^5 + 5*t^4 + 6*t^3 + 5*t^2 + 3*t + 1
>>> from sage.all import *
>>> S4 = SymmetricGroup(Integer(4))
>>> S4.major_index()                                                      # needs sage.combinat
q^6 + 3*q^5 + 5*q^4 + 6*q^3 + 5*q^2 + 3*q + 1
>>> K = QQ['t']; (t,) = K._first_ngens(1)
>>> S4.major_index(t)                                                     # needs sage.combinat
t^6 + 3*t^5 + 5*t^4 + 6*t^3 + 5*t^2 + 3*t + 1
reflections()[source]#

Return the list of all reflections in self.

EXAMPLES:

sage: A = SymmetricGroup(3)
sage: A.reflections()
[(1,2), (1,3), (2,3)]
>>> from sage.all import *
>>> A = SymmetricGroup(Integer(3))
>>> A.reflections()
[(1,2), (1,3), (2,3)]
simple_reflection(i)[source]#

For $$i$$ in the index set of self, return the elementary transposition $$s_i = (i,i+1)$$.

EXAMPLES:

sage: A = SymmetricGroup(5)
sage: A.simple_reflection(3)
(3,4)

sage: A = SymmetricGroup([2,3,7])
sage: A.simple_reflections()
Finite family {2: (2,3), 3: (3,7)}
>>> from sage.all import *
>>> A = SymmetricGroup(Integer(5))
>>> A.simple_reflection(Integer(3))
(3,4)

>>> A = SymmetricGroup([Integer(2),Integer(3),Integer(7)])
>>> A.simple_reflections()
Finite family {2: (2,3), 3: (3,7)}
young_subgroup(comp)[source]#

Return the Young subgroup associated with the composition comp.

EXAMPLES:

sage: S = SymmetricGroup(8)
sage: c = Composition([2,2,2,2])
sage: S.young_subgroup(c)
Subgroup generated by [(1,2), (3,4), (5,6), (7,8)] of
(Symmetric group of order 8! as a permutation group)

sage: S = SymmetricGroup(['a','b','c'])
sage: S.young_subgroup([2,1])
Subgroup generated by [('a','b')] of
(Symmetric group of order 3! as a permutation group)

sage: Y = S.young_subgroup([2,2,2,2,2])
Traceback (most recent call last):
...
ValueError: the composition is not of expected size
>>> from sage.all import *
>>> S = SymmetricGroup(Integer(8))
>>> c = Composition([Integer(2),Integer(2),Integer(2),Integer(2)])
>>> S.young_subgroup(c)
Subgroup generated by [(1,2), (3,4), (5,6), (7,8)] of
(Symmetric group of order 8! as a permutation group)

>>> S = SymmetricGroup(['a','b','c'])
>>> S.young_subgroup([Integer(2),Integer(1)])
Subgroup generated by [('a','b')] of
(Symmetric group of order 3! as a permutation group)

>>> Y = S.young_subgroup([Integer(2),Integer(2),Integer(2),Integer(2),Integer(2)])
Traceback (most recent call last):
...
ValueError: the composition is not of expected size
class sage.groups.perm_gps.permgroup_named.TransitiveGroup(d, n)[source]#

Bases: PermutationGroup_unique

The transitive group from the GAP tables of transitive groups.

INPUT:

• d – non-negative integer; the degree

• n – positive integer; the index of the group in the GAP database, starting at 1

OUTPUT: the $$n$$-th transitive group of degree $$d$$

Note

This group is also available via groups.permutation.Transitive().

EXAMPLES:

sage: TransitiveGroup(0,1)
Transitive group number 1 of degree 0
sage: TransitiveGroup(1,1)
Transitive group number 1 of degree 1
sage: G = TransitiveGroup(5, 2); G
Transitive group number 2 of degree 5
sage: G.gens()
((1,2,3,4,5), (1,4)(2,3))

sage: G.category()
Category of finite enumerated permutation groups
>>> from sage.all import *
>>> TransitiveGroup(Integer(0),Integer(1))
Transitive group number 1 of degree 0
>>> TransitiveGroup(Integer(1),Integer(1))
Transitive group number 1 of degree 1
>>> G = TransitiveGroup(Integer(5), Integer(2)); G
Transitive group number 2 of degree 5
>>> G.gens()
((1,2,3,4,5), (1,4)(2,3))

>>> G.category()
Category of finite enumerated permutation groups

Warning

this follows GAP’s naming convention of indexing the transitive groups starting from 1:

sage: TransitiveGroup(5,0)
Traceback (most recent call last):
...
ValueError: index n must be in {1,..,5}
>>> from sage.all import *
>>> TransitiveGroup(Integer(5),Integer(0))
Traceback (most recent call last):
...
ValueError: index n must be in {1,..,5}

Warning

only transitive groups of “small” degree are available in GAP’s database:

sage: TransitiveGroup(32,1)
Traceback (most recent call last):
...
NotImplementedError: only the transitive groups of degree at most 31
are available in GAP's database
>>> from sage.all import *
>>> TransitiveGroup(Integer(32),Integer(1))
Traceback (most recent call last):
...
NotImplementedError: only the transitive groups of degree at most 31
are available in GAP's database
degree()[source]#

Return the degree of this permutation group

EXAMPLES:

sage: TransitiveGroup(8, 44).degree()
8
>>> from sage.all import *
>>> TransitiveGroup(Integer(8), Integer(44)).degree()
8
transitive_number()[source]#

Return the index of this group in the GAP database, starting at 1

EXAMPLES:

sage: TransitiveGroup(8, 44).transitive_number()
44
>>> from sage.all import *
>>> TransitiveGroup(Integer(8), Integer(44)).transitive_number()
44
sage.groups.perm_gps.permgroup_named.TransitiveGroups(d=None)[source]#

INPUT:

• d – integer (optional)

Return the set of all transitive groups of a given degree d up to isomorphisms. If d is not specified, it returns the set of all transitive groups up to isomorphisms.

EXAMPLES:

sage: TransitiveGroups(3)
Transitive Groups of degree 3
sage: TransitiveGroups(7)
Transitive Groups of degree 7
sage: TransitiveGroups(8)
Transitive Groups of degree 8

sage: TransitiveGroups()
Transitive Groups
>>> from sage.all import *
>>> TransitiveGroups(Integer(3))
Transitive Groups of degree 3
>>> TransitiveGroups(Integer(7))
Transitive Groups of degree 7
>>> TransitiveGroups(Integer(8))
Transitive Groups of degree 8

>>> TransitiveGroups()
Transitive Groups

Warning

in practice, the database currently only contains transitive groups up to degree 31:

sage: TransitiveGroups(32).cardinality()
Traceback (most recent call last):
...
NotImplementedError: only the transitive groups of degree at most 31
are available in GAP's database
>>> from sage.all import *
>>> TransitiveGroups(Integer(32)).cardinality()
Traceback (most recent call last):
...
NotImplementedError: only the transitive groups of degree at most 31
are available in GAP's database
class sage.groups.perm_gps.permgroup_named.TransitiveGroupsAll[source]#

The infinite set of all transitive groups up to isomorphisms.

EXAMPLES:

sage: L = TransitiveGroups(); L
Transitive Groups
sage: L.category()
Category of facade infinite enumerated sets
sage: L.cardinality()
+Infinity

sage: p = L.__iter__()
sage: (next(p), next(p), next(p), next(p), next(p), next(p), next(p), next(p))
(Transitive group number 1 of degree 0, Transitive group number 1 of degree 1,
Transitive group number 1 of degree 2, Transitive group number 1 of degree 3,
Transitive group number 2 of degree 3, Transitive group number 1 of degree 4,
Transitive group number 2 of degree 4, Transitive group number 3 of degree 4)
>>> from sage.all import *
>>> L = TransitiveGroups(); L
Transitive Groups
>>> L.category()
Category of facade infinite enumerated sets
>>> L.cardinality()
+Infinity

>>> p = L.__iter__()
>>> (next(p), next(p), next(p), next(p), next(p), next(p), next(p), next(p))
(Transitive group number 1 of degree 0, Transitive group number 1 of degree 1,
Transitive group number 1 of degree 2, Transitive group number 1 of degree 3,
Transitive group number 2 of degree 3, Transitive group number 1 of degree 4,
Transitive group number 2 of degree 4, Transitive group number 3 of degree 4)
class sage.groups.perm_gps.permgroup_named.TransitiveGroupsOfDegree(n)[source]#

Bases: CachedRepresentation, Parent

The set of all transitive groups of a given (small) degree up to isomorphism.

EXAMPLES:

sage: S = TransitiveGroups(4); S
Transitive Groups of degree 4
sage: list(S)
[Transitive group number 1 of degree 4,
Transitive group number 2 of degree 4,
Transitive group number 3 of degree 4,
Transitive group number 4 of degree 4,
Transitive group number 5 of degree 4]

sage: TransitiveGroups(5).an_element()
Transitive group number 1 of degree 5
>>> from sage.all import *
>>> S = TransitiveGroups(Integer(4)); S
Transitive Groups of degree 4
>>> list(S)
[Transitive group number 1 of degree 4,
Transitive group number 2 of degree 4,
Transitive group number 3 of degree 4,
Transitive group number 4 of degree 4,
Transitive group number 5 of degree 4]

>>> TransitiveGroups(Integer(5)).an_element()
Transitive group number 1 of degree 5

We write the cardinality of all transitive groups of degree 5:

sage: for G in TransitiveGroups(5):
....:     print(G.cardinality())
5
10
20
60
120
>>> from sage.all import *
>>> for G in TransitiveGroups(Integer(5)):
...     print(G.cardinality())
5
10
20
60
120
cardinality()[source]#

Return the cardinality of self, that is the number of transitive groups of a given degree.

EXAMPLES:

sage: TransitiveGroups(0).cardinality()
1
sage: TransitiveGroups(2).cardinality()
1
sage: TransitiveGroups(7).cardinality()
7
sage: TransitiveGroups(12).cardinality()
301
sage: [TransitiveGroups(i).cardinality() for i in range(11)]
[1, 1, 1, 2, 5, 5, 16, 7, 50, 34, 45]
>>> from sage.all import *
>>> TransitiveGroups(Integer(0)).cardinality()
1
>>> TransitiveGroups(Integer(2)).cardinality()
1
>>> TransitiveGroups(Integer(7)).cardinality()
7
>>> TransitiveGroups(Integer(12)).cardinality()
301
>>> [TransitiveGroups(i).cardinality() for i in range(Integer(11))]
[1, 1, 1, 2, 5, 5, 16, 7, 50, 34, 45]

Warning

GAP comes with a database containing all transitive groups up to degree 31:

sage: TransitiveGroups(32).cardinality()
Traceback (most recent call last):
...
NotImplementedError: only the transitive groups of degree at most 31
are available in GAP's database
>>> from sage.all import *
>>> TransitiveGroups(Integer(32)).cardinality()
Traceback (most recent call last):
...
NotImplementedError: only the transitive groups of degree at most 31
are available in GAP's database