40
40
invariant factors of the group. You should now use
41
41
:meth:`~AbelianGroup_class.gens_orders` instead::
42
42
43
- sage: J = AbelianGroup([2,0,3,2,4]); J
44
- Multiplicative Abelian group isomorphic to C2 x Z x C3 x C2 x C4
45
- sage: J.gens_orders() # use this instead
46
- (2, 0, 3, 2, 4)
47
- sage: J.invariants() # deprecated
48
- (2, 0, 3, 2, 4)
49
- sage: J.elementary_divisors() # these are the "invariant factors"
50
- (2, 2, 12, 0)
51
- sage: for i in range(J.ngens()):
52
- ....: print((i, J.gen(i), J.gen(i).order())) # or use this form
53
- (0, f0, 2)
54
- (1, f1, +Infinity)
55
- (2, f2, 3)
56
- (3, f3, 2)
57
- (4, f4, 4)
43
+ sage: J = AbelianGroup([2,0,3,2,4]); J
44
+ Multiplicative Abelian group isomorphic to C2 x Z x C3 x C2 x C4
45
+ sage: J.gens_orders() # use this instead
46
+ (2, 0, 3, 2, 4)
47
+ sage: J.invariants() # deprecated
48
+ (2, 0, 3, 2, 4)
49
+ sage: J.elementary_divisors() # these are the "invariant factors"
50
+ (2, 2, 12, 0)
51
+ sage: for i in range(J.ngens()):
52
+ ....: print((i, J.gen(i), J.gen(i).order())) # or use this form
53
+ (0, f0, 2)
54
+ (1, f1, +Infinity)
55
+ (2, f2, 3)
56
+ (3, f3, 2)
57
+ (4, f4, 4)
58
58
59
59
Background on invariant factors and the Smith normal form
60
60
(according to section 4.1 of [Cohen1]_): An abelian group is a
160
160
.. [Rotman] \J. Rotman, An introduction to the theory of
161
161
groups, 4th ed, Springer, 1995.
162
162
163
- .. warning ::
163
+ .. WARNING ::
164
164
165
165
Many basic properties for infinite abelian groups are not
166
166
implemented.
221
221
from sage .structure .unique_representation import UniqueRepresentation
222
222
223
223
224
- # TODO: this uses perm groups - the AbelianGroupElement instance method
225
- # uses a different implementation.
224
+ # .. TODO::
225
+
226
+ # this uses perm groups - the AbelianGroupElement instance method
227
+ # uses a different implementation.
226
228
def word_problem (words , g , verbose = False ):
227
229
r"""
228
- G and H are abelian, g in G, H is a subgroup of G generated by a
229
- list (words) of elements of G . If g is in H , return the expression
230
- for g as a word in the elements of (words).
230
+ `G` and `H` are abelian, `g` in `G`, `H` is a subgroup of `G` generated by
231
+ a list (words) of elements of `G` . If `g` is in `H` , return the expression
232
+ for `g` as a word in the elements of (words).
231
233
232
- The 'word problem' for a finite abelian group G boils down to the
234
+ The 'word problem' for a finite abelian group `G` boils down to the
233
235
following matrix-vector analog of the Chinese remainder theorem.
234
236
235
237
Problem: Fix integers `1<n_1\leq n_2\leq ...\leq n_k`
@@ -289,7 +291,7 @@ def word_problem(words, g, verbose=False):
289
291
sage: word_problem([a,b,c,d,e], b)
290
292
[[b, 1]]
291
293
292
- .. warning ::
294
+ .. WARNING ::
293
295
294
296
1. Might have unpleasant effect when the word problem
295
297
cannot be solved.
@@ -448,7 +450,7 @@ def AbelianGroup(n, gens_orders=None, names="f"):
448
450
449
451
def is_AbelianGroup (x ):
450
452
"""
451
- Return True if ``x`` is an Abelian group.
453
+ Return `` True`` if ``x`` is an Abelian group.
452
454
453
455
EXAMPLES::
454
456
@@ -467,7 +469,7 @@ class AbelianGroup_class(UniqueRepresentation, AbelianGroupBase):
467
469
"""
468
470
The parent for Abelian groups with chosen generator orders.
469
471
470
- .. warning ::
472
+ .. WARNING ::
471
473
472
474
You should use :func:`AbelianGroup` to construct Abelian
473
475
groups and not instantiate this class directly.
@@ -518,7 +520,7 @@ class AbelianGroup_class(UniqueRepresentation, AbelianGroupBase):
518
520
519
521
def __init__ (self , generator_orders , names , category = None ):
520
522
"""
521
- The Python constructor
523
+ The Python constructor.
522
524
523
525
TESTS::
524
526
@@ -552,15 +554,13 @@ def __init__(self, generator_orders, names, category=None):
552
554
553
555
def is_isomorphic (left , right ):
554
556
"""
555
- Check whether ``left`` and ``right`` are isomorphic
557
+ Check whether ``left`` and ``right`` are isomorphic.
556
558
557
559
INPUT:
558
560
559
561
- ``right`` -- anything.
560
562
561
- OUTPUT:
562
-
563
- Boolean. Whether ``left`` and ``right`` are isomorphic as abelian groups.
563
+ OUTPUT: boolean; whether ``left`` and ``right`` are isomorphic as abelian groups
564
564
565
565
EXAMPLES::
566
566
@@ -601,7 +601,7 @@ def is_subgroup(left, right):
601
601
602
602
def __ge__ (left , right ):
603
603
"""
604
- Test whether ``right`` is a subgroup of ``left``
604
+ Test whether ``right`` is a subgroup of ``left``.
605
605
606
606
EXAMPLES::
607
607
@@ -614,7 +614,7 @@ def __ge__(left, right):
614
614
615
615
def __lt__ (left , right ):
616
616
"""
617
- Test whether ``left`` is a strict subgroup of ``right``
617
+ Test whether ``left`` is a strict subgroup of ``right``.
618
618
619
619
EXAMPLES::
620
620
@@ -627,7 +627,7 @@ def __lt__(left, right):
627
627
628
628
def __gt__ (left , right ):
629
629
"""
630
- Test whether ``right`` is a strict subgroup of ``left``
630
+ Test whether ``right`` is a strict subgroup of ``left``.
631
631
632
632
EXAMPLES::
633
633
@@ -640,7 +640,7 @@ def __gt__(left, right):
640
640
641
641
def is_trivial (self ):
642
642
"""
643
- Return whether the group is trivial
643
+ Return whether the group is trivial.
644
644
645
645
A group is trivial if it has precisely one element.
646
646
@@ -682,9 +682,7 @@ def dual_group(self, names="X", base_ring=None):
682
682
- ``base_ring`` -- the base ring. If ``None`` (default), then
683
683
a suitable cyclotomic field is picked automatically.
684
684
685
- OUTPUT:
686
-
687
- The :class:`dual abelian group <sage.groups.abelian_gps.dual_abelian_group.DualAbelianGroup_class>`.
685
+ OUTPUT: the :class:`dual abelian group <sage.groups.abelian_gps.dual_abelian_group.DualAbelianGroup_class>`
688
686
689
687
EXAMPLES::
690
688
@@ -719,9 +717,9 @@ def dual_group(self, names="X", base_ring=None):
719
717
@cached_method
720
718
def elementary_divisors (self ):
721
719
r"""
722
- This returns the elementary divisors of the group, using Pari.
720
+ Return the elementary divisors of the group, using Pari.
723
721
724
- .. note ::
722
+ .. NOTE ::
725
723
726
724
Here is another algorithm for computing the elementary divisors
727
725
`d_1, d_2, d_3, \ldots`, of a finite abelian group (where `d_1 | d_2 | d_3 | \ldots`
@@ -736,9 +734,7 @@ def elementary_divisors(self):
736
734
on these "smaller invariants" to compute `d_{i-1}`, and so on.
737
735
(Thanks to Robert Miller for communicating this algorithm.)
738
736
739
- OUTPUT:
740
-
741
- A tuple of integers.
737
+ OUTPUT: tuple of integers
742
738
743
739
EXAMPLES::
744
740
@@ -806,15 +802,13 @@ def identity(self):
806
802
807
803
def _group_notation (self , eldv ):
808
804
"""
809
- Return abstract group notation for generator orders ``eldv``
805
+ Return abstract group notation for generator orders ``eldv``.
810
806
811
807
INPUT:
812
808
813
- - ``eldv`` -- iterable of integers.
814
-
815
- OUTPUT:
809
+ - ``eldv`` -- iterable of integers
816
810
817
- String.
811
+ OUTPUT: string
818
812
819
813
EXAMPLES::
820
814
@@ -955,9 +949,7 @@ def gens_orders(self):
955
949
Use :meth:`elementary_divisors` if you are looking for an
956
950
invariant of the group.
957
951
958
- OUTPUT:
959
-
960
- A tuple of integers.
952
+ OUTPUT: tuple of integers
961
953
962
954
EXAMPLES::
963
955
@@ -1018,9 +1010,7 @@ def invariants(self):
1018
1010
Use :meth:`elementary_divisors` if you are looking for an
1019
1011
invariant of the group.
1020
1012
1021
- OUTPUT:
1022
-
1023
- A tuple of integers. Zero means infinite cyclic factor.
1013
+ OUTPUT: tuple of integers; zero means infinite cyclic factor
1024
1014
1025
1015
EXAMPLES::
1026
1016
@@ -1043,7 +1033,7 @@ def invariants(self):
1043
1033
1044
1034
def is_cyclic (self ):
1045
1035
"""
1046
- Return True if the group is a cyclic group.
1036
+ Return `` True`` if the group is a cyclic group.
1047
1037
1048
1038
EXAMPLES::
1049
1039
@@ -1153,7 +1143,7 @@ def permutation_group(self):
1153
1143
1154
1144
def is_commutative (self ):
1155
1145
"""
1156
- Return True since this group is commutative.
1146
+ Return `` True`` since this group is commutative.
1157
1147
1158
1148
EXAMPLES::
1159
1149
@@ -1432,8 +1422,8 @@ def subgroups(self, check=False):
1432
1422
1433
1423
INPUT:
1434
1424
1435
- - check: if ``True``, performs the same computation in GAP and
1436
- checks that the number of subgroups generated is the
1425
+ - `` check`` -- boolean; if ``True``, performs the same computation in
1426
+ GAP and checks that the number of subgroups generated is the
1437
1427
same. (I don't know how to convert GAP's output back into
1438
1428
Sage, so we don't actually compare the subgroups).
1439
1429
@@ -1528,15 +1518,15 @@ def subgroups(self, check=False):
1528
1518
1529
1519
def subgroup_reduced (self , elts , verbose = False ):
1530
1520
r"""
1531
- Given a list of lists of integers (corresponding to elements of self),
1532
- find a set of independent generators for the subgroup generated by
1533
- these elements, and return the subgroup with these as generators,
1534
- forgetting the original generators.
1521
+ Given a list of lists of integers (corresponding to elements of
1522
+ ``self``), find a set of independent generators for the subgroup
1523
+ generated by these elements, and return the subgroup with these as
1524
+ generators, forgetting the original generators.
1535
1525
1536
1526
This is used by the ``subgroups`` routine.
1537
1527
1538
1528
An error will be raised if the elements given are not linearly
1539
- independent over QQ .
1529
+ independent over `\QQ` .
1540
1530
1541
1531
EXAMPLES::
1542
1532
@@ -1595,7 +1585,8 @@ def torsion_subgroup(self, n=None):
1595
1585
1596
1586
sage: G = AbelianGroup([2, 2*3, 2*3*5, 0, 2*3*5*7, 2*3*5*7*11])
1597
1587
sage: G.torsion_subgroup(5) # needs sage.libs.gap # optional - gap_package_polycyclic
1598
- Multiplicative Abelian subgroup isomorphic to C5 x C5 x C5 generated by {f2^6, f4^42, f5^462}
1588
+ Multiplicative Abelian subgroup isomorphic to C5 x C5 x C5
1589
+ generated by {f2^6, f4^42, f5^462}
1599
1590
"""
1600
1591
if n is None :
1601
1592
torsion_generators = [g for g in self .gens () if g .order () != infinity ]
@@ -1615,7 +1606,7 @@ def torsion_subgroup(self, n=None):
1615
1606
1616
1607
class AbelianGroup_subgroup (AbelianGroup_class ):
1617
1608
"""
1618
- Subgroup subclass of AbelianGroup_class, so instance methods are
1609
+ Subgroup subclass of `` AbelianGroup_class`` , so instance methods are
1619
1610
inherited.
1620
1611
1621
1612
.. TODO::
@@ -1787,11 +1778,9 @@ def __contains__(self, x):
1787
1778
1788
1779
def ambient_group (self ):
1789
1780
"""
1790
- Return the ambient group related to self.
1781
+ Return the ambient group related to `` self`` .
1791
1782
1792
- OUTPUT:
1793
-
1794
- A multiplicative Abelian group.
1783
+ OUTPUT: a multiplicative Abelian group
1795
1784
1796
1785
EXAMPLES::
1797
1786
@@ -1809,11 +1798,11 @@ def equals(left, right):
1809
1798
1810
1799
INPUT:
1811
1800
1812
- - ``right`` -- anything.
1801
+ - ``right`` -- anything
1813
1802
1814
1803
OUTPUT:
1815
1804
1816
- Boolean. If ``right`` is a subgroup, test whether ``left`` and
1805
+ boolean; if ``right`` is a subgroup, test whether ``left`` and
1817
1806
``right`` are the same subset of the ambient group. If
1818
1807
``right`` is not a subgroup, test whether they are isomorphic
1819
1808
groups, see :meth:`~AbelianGroup_class.is_isomorphic`.
@@ -1855,7 +1844,7 @@ def equals(left, right):
1855
1844
1856
1845
def _repr_ (self ):
1857
1846
"""
1858
- Return a string representation
1847
+ Return a string representation.
1859
1848
1860
1849
EXAMPLES::
1861
1850
@@ -1879,9 +1868,7 @@ def gens(self) -> tuple:
1879
1868
"""
1880
1869
Return the generators for this subgroup.
1881
1870
1882
- OUTPUT:
1883
-
1884
- A tuple of group elements generating the subgroup.
1871
+ OUTPUT: tuple of group elements generating the subgroup
1885
1872
1886
1873
EXAMPLES::
1887
1874
0 commit comments