# Ticket #14791: trac_14791_named_fpgroups.patch

File trac_14791_named_fpgroups.patch, 7.6 KB (added by dshurbert, 8 years ago)

Patch

• ## doc/en/reference/groups/index.rst

# HG changeset patch
# User Davis Shurbert <dshurbert@pugetsound.edu>
# Date 1370586997 25200
# Node ID dd54a38419e6bfd5db4dfbf440a72b43cb5792f5
# Parent  85611cde252dfb0f7c07abe2764ac495c66490ee
imported patch to_presentation

diff --git a/doc/en/reference/groups/index.rst b/doc/en/reference/groups/index.rst
 a sage/groups/generic sage/groups/free_group sage/groups/finitely_presented sage/groups/finitely_presented_named sage/groups/braid sage/groups/abelian_gps/abelian_group sage/groups/abelian_gps/values
• ## new file sage/groups/finitely_presented_catalog.py

diff --git a/sage/groups/finitely_presented_catalog.py b/sage/groups/finitely_presented_catalog.py
new file mode 100644
 - """ Type groups.presentation. to access examples of groups implemented as finite presentations (quotients of free groups). """ # groups imported here will be available # via  groups.presentation. # # Do not use this file for code # # If you import a new group, then add an # entry to the list in the module-level # docstring of groups/groups_catalog.py############ from finitely_presented_named import DihedralPresentation as Dihedral from finitely_presented_named import CyclicPresentation as Cyclic from finitely_presented_named import DiCyclicPresentation as DiCyclic from finitely_presented_named import KleinFourPresentation as KleinFour
• ## new file sage/groups/finitely_presented_named.py

diff --git a/sage/groups/finitely_presented_named.py b/sage/groups/finitely_presented_named.py
new file mode 100644
 - """ Named Finitely Presented Groups Construct groups of small order and "named" groups as quotients of free groups. These groups are available through tab completion by typing groups.presentation. or by importing the required methods. Tab completion is made available through Sage's :ref:group catalog . Groups available as finite presentations: -- CyclicGroup, $C_n$ of order $n$ - :func:groups.presentation.Cyclic  -- DiCyclicGroup, nonabelian groups of order $4n$ with a unique element of order 2 - :func:groups.presentation.DiCyclic  -- DihedralGroup, $D_n$ of order $2n$ - :func:groups.presentation.Dihedral  -- KleinFourGroup, C_2 \\times C_2 - :func:groups.presentation.KleinFour  EXAMPLES:: sage: groups.presentation.Cyclic(4) Finitely presented group < a | a^4 > You can also import the desired functions.:: sage: from sage.groups.finitely_presented_named import CyclicPresentation sage: CyclicPresentation(4) Finitely presented group < a | a^4 > """ from sage.rings.all      import Integer from sage.groups.free_group import FreeGroup from sage.groups.finitely_presented import FinitelyPresentedGroup def CyclicPresentation(n): """ Builds cyclic group of order n as a finitely presented group. INPUT: - n -- The order of the cyclic presentation to be returned. OUTPUT: The cyclic group of order n as finite presentation. EXAMPLES:: sage: groups.presentation.Cyclic(10) Finitely presented group < a | a^10 > sage: n = 8 sage: C = groups.presentation.Cyclic(n) sage: C.as_permutation_group().is_isomorphic(CyclicPermutationGroup(n)) True TESTS:: sage: groups.presentation.Cyclic(0) Traceback (most recent call last): ... ValueError: Finitely presented group order must be positive """ n = Integer(n) if n < 1: raise ValueError('Finitely presented group order must be positive') F = FreeGroup( 'a' ) rls = F([1])**n, return FinitelyPresentedGroup( F, rls ) def DihedralPresentation(n): """ Builds the Dihedral group of order $2n$ as a finitely presented group. INPUT: - n -- The size of the set that D_n is acting on. OUTPUT: Dihedral group of order 2n. EXAMPLES:: sage: D = groups.presentation.Dihedral(7); D Finitely presented group < a, b | a^7, b^2, a*b*a*b > sage: D.as_permutation_group().is_isomorphic(DihedralGroup(7)) True TESTS:: sage: n = 9 sage: D = groups.presentation.Dihedral(n) sage: D.ngens() == 2 True sage: groups.presentation.Dihedral(0) Traceback (most recent call last): ... ValueError: Finitely presented group order must be positive """ n = Integer( n ) if n < 1: raise ValueError('Finitely presented group order must be positive') F = FreeGroup([ 'a', 'b' ]) rls = F([1])**n, F([2])**2, (F([1])*F([2]))**2 return FinitelyPresentedGroup( F, rls ) def DiCyclicPresentation(n): """ Builds the DiCyclic group of order $4n$ as a finitely presented group. INPUT: - n -- Determines the order of the group (4n). OUTPUT: DiCyclic group of order 4n. EXAMPLES:: sage: D = groups.presentation.DiCyclic(9); D Finitely presented group < a, b | a^18, b^2*a^-9, b^-1*a*b*a > sage: D.as_permutation_group().is_isomorphic(groups.permutation.DiCyclic(9)) True TESTS:: sage: groups.presentation.DiCyclic(0) Traceback (most recent call last): ... ValueError: Finitely presented group order must be positive """ n = Integer(n) if n < 1: raise ValueError('Finitely presented group order must be positive') F = FreeGroup(['a','b']) rls = F([1])**(2*n), F([2,2])*F([-1])**n, F([-2,1,2,1]) return FinitelyPresentedGroup(F, rls) def KleinFourPresentation(): """ Builds the Klein group of order 4 as a finitely presented group. OUTPUT: Klein four group (C_2 \\times C_2) as a finitely presented group. EXAMPLES:: sage: K = groups.presentation.KleinFour(); K Finitely presented group < a, b | a^2, b^2, a^-1*b^-1*a*b > """ F = FreeGroup(['a','b']) rls = F([1])**2, F([2])**2, F([-1])*F([-2])*F([1])*F([2]) return FinitelyPresentedGroup(F, rls)
• ## sage/groups/groups_catalog.py

diff --git a/sage/groups/groups_catalog.py b/sage/groups/groups_catalog.py
 a - :func:groups.matrix.GO  - :func:groups.matrix.SO  - Finitely Presented Groups (groups.presentation.) - :func:groups.presentation.Cyclic  - :func:groups.presentation.Dihedral  - :func:groups.presentation.DiCyclic  - :func:groups.presentation.KleinFour  - Miscellaneous Groups (groups.misc.) """ from sage.groups.matrix_gps import matrix_groups_catalog as matrix from sage.groups.perm_gps import permutation_groups_catalog as permutation from sage.groups.misc_gps import misc_groups_catalog as misc from sage.groups import finitely_presented_catalog  as presentation