Skip to content

Commit

Permalink
perm_groups docstring edits
Browse files Browse the repository at this point in the history
  • Loading branch information
smichr committed Sep 11, 2012
1 parent 9cfba20 commit f7b73a2
Showing 1 changed file with 40 additions and 4 deletions.
44 changes: 40 additions & 4 deletions sympy/combinatorics/perm_groups.py
Expand Up @@ -1138,8 +1138,9 @@ def coset_rank(self, g):
The coset rank of ``g`` is the ordering number in which
it appears in the lexicographic listing according to the
coset decomposition, see coset_decomposition;
the ordering is the same as in G.generate(method='coset').
coset decomposition
The ordering is the same as in G.generate(method='coset').
If ``g`` does not belong to the group it returns None.
Examples
Expand All @@ -1158,6 +1159,11 @@ def coset_rank(self, g):
>>> G.coset_unrank(40, af=True)
[6, 7, 4, 5, 2, 3, 0, 1]
See Also
========
coset_decomposition
"""
u = self.coset_repr()
if isinstance(g, Permutation):
Expand Down Expand Up @@ -1246,6 +1252,9 @@ def coset_unrank(self, rank, af=False):
def degree(self):
"""Returns the size of the permutations in the group.
(The length of the group -- the number of permutations -- is
given by len(group).)
Examples
========
Expand All @@ -1255,6 +1264,8 @@ def degree(self):
>>> G = PermutationGroup([a])
>>> G.degree
2
>>> len(G)
1
"""
return self._degree
Expand Down Expand Up @@ -1509,11 +1520,30 @@ def generators(self):
return self._generators

def has(self, g):
"""Test if g is one of the permutations in self."""
"""Test if g is one of the permutations in self.
Examples
========
>>> from sympy.combinatorics.permutations import Permutation
>>> from sympy.combinatorics.perm_groups import PermutationGroup
>>> a = Permutation([0, 2, 1])
>>> b = Permutation([1, 0, 2])
>>> G = PermutationGroup([a])
>>> G.has(a)
True
>>> G.has(b)
False
See Also
========
has_element
"""
return g in self

def has_element(self, g):
"""Test if permutation ``g`` belongs to G; see coset_decomposition
"""Test if permutation ``g`` belongs to G.
Examples
========
Expand All @@ -1535,6 +1565,12 @@ def has_element(self, g):
False
>>> g.has(elem)
False
See Also
========
coset_decomposition, has
"""
return bool(self.coset_decomposition(g.array_form))

Expand Down

0 comments on commit f7b73a2

Please sign in to comment.