Skip to content

Commit 9222df6

Browse files
mantepsedimpase
authored andcommitted
is_trivial for matrix groups
1 parent 4092ca9 commit 9222df6

File tree

1 file changed

+31
-0
lines changed

1 file changed

+31
-0
lines changed

src/sage/groups/matrix_gps/matrix_group.py

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -542,3 +542,34 @@ def __richcmp__(self, other, op):
542542
if lx != rx:
543543
return richcmp_not_equal(lx, rx, op)
544544
return rich_to_bool(op, 0)
545+
546+
def is_trivial(self):
547+
r"""
548+
Return ``True`` if this group is the trivial group.
549+
550+
A group is trivial, if it consists only of the identity
551+
element, that is, if all its generators are the identity.
552+
553+
EXAMPLES::
554+
555+
sage: MatrixGroup([identity_matrix(3)]).is_trivial()
556+
True
557+
sage: SL(2, ZZ).is_trivial()
558+
False
559+
sage: CoxeterGroup(['B',3], implementation="matrix").is_trivial()
560+
False
561+
562+
TESTS::
563+
564+
sage: CoxeterGroup(['A',0], implementation="matrix").is_trivial()
565+
True
566+
sage: MatrixGroup([matrix(SR, [[1,x], [0,1]])]).is_trivial()
567+
False
568+
sage: G = MatrixGroup([identity_matrix(3), identity_matrix(3)])
569+
sage: G.ngens()
570+
2
571+
sage: G.is_trivial()
572+
True
573+
574+
"""
575+
return all(g.is_one() for g in self.gens())

0 commit comments

Comments
 (0)