Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
sagemath
GitHub Repository: sagemath/sagelib
Path: blob/master/sage/groups/matrix_gps/special_linear.py
4057 views
1
"""
2
Special Linear Groups
3
4
AUTHORS:
5
6
- William Stein: initial version
7
8
- David Joyner (2006-05): added examples, _latex_, __str__, gens,
9
as_matrix_group
10
11
- William Stein (2006-12-09): rewrite
12
13
EXAMPLES::
14
15
sage: SL(2, ZZ)
16
Special Linear Group of degree 2 over Integer Ring
17
sage: G = SL(2,GF(3)); G
18
Special Linear Group of degree 2 over Finite Field of size 3
19
sage: G.is_finite()
20
True
21
sage: G.conjugacy_class_representatives()
22
[
23
[1 0]
24
[0 1],
25
[0 2]
26
[1 1],
27
[0 1]
28
[2 1],
29
[2 0]
30
[0 2],
31
[0 2]
32
[1 2],
33
[0 1]
34
[2 2],
35
[0 2]
36
[1 0]
37
]
38
sage: G = SL(6,GF(5))
39
sage: G.gens()
40
[
41
[2 0 0 0 0 0]
42
[0 3 0 0 0 0]
43
[0 0 1 0 0 0]
44
[0 0 0 1 0 0]
45
[0 0 0 0 1 0]
46
[0 0 0 0 0 1],
47
[4 0 0 0 0 1]
48
[4 0 0 0 0 0]
49
[0 4 0 0 0 0]
50
[0 0 4 0 0 0]
51
[0 0 0 4 0 0]
52
[0 0 0 0 4 0]
53
]
54
"""
55
56
#*****************************************************************************
57
# Copyright (C) 2006 William Stein <[email protected]>
58
#
59
# Distributed under the terms of the GNU General Public License (GPL)
60
# http://www.gnu.org/licenses/
61
#*****************************************************************************
62
63
from sage.structure.unique_representation import UniqueRepresentation
64
from sage.rings.all import is_FiniteField, Integer, FiniteField
65
from matrix_group import MatrixGroup_gap, MatrixGroup_gap_finite_field
66
67
def SL(n, R, var='a'):
68
r"""
69
Return the special linear group of degree `n` over the ring
70
`R`.
71
72
EXAMPLES::
73
74
sage: SL(3,GF(2))
75
Special Linear Group of degree 3 over Finite Field of size 2
76
sage: G = SL(15,GF(7)); G
77
Special Linear Group of degree 15 over Finite Field of size 7
78
sage: G.category()
79
Category of finite groups
80
sage: G.order()
81
1956712595698146962015219062429586341124018007182049478916067369638713066737882363393519966343657677430907011270206265834819092046250232049187967718149558134226774650845658791865745408000000
82
sage: len(G.gens())
83
2
84
sage: G = SL(2,ZZ); G
85
Special Linear Group of degree 2 over Integer Ring
86
sage: G.gens()
87
[
88
[ 0 1]
89
[-1 0],
90
[1 1]
91
[0 1]
92
]
93
94
Next we compute generators for `\mathrm{SL}_3(\ZZ)`.
95
96
::
97
98
sage: G = SL(3,ZZ); G
99
Special Linear Group of degree 3 over Integer Ring
100
sage: G.gens()
101
[
102
[0 1 0]
103
[0 0 1]
104
[1 0 0],
105
[ 0 1 0]
106
[-1 0 0]
107
[ 0 0 1],
108
[1 1 0]
109
[0 1 0]
110
[0 0 1]
111
]
112
113
sage: TestSuite(G).run()
114
"""
115
if isinstance(R, (int, long, Integer)):
116
R = FiniteField(R, var)
117
if is_FiniteField(R):
118
return SpecialLinearGroup_finite_field(n, R)
119
else:
120
return SpecialLinearGroup_generic(n, R)
121
122
class SpecialLinearGroup_generic(UniqueRepresentation, MatrixGroup_gap):
123
def _gap_init_(self):
124
"""
125
String to create this group in GAP.
126
127
EXAMPLES::
128
129
sage: G = SL(6,GF(5)); G
130
Special Linear Group of degree 6 over Finite Field of size 5
131
sage: G._gap_init_()
132
'SL(6, GF(5))'
133
"""
134
return "SL(%s, %s)"%(self.degree(), self.base_ring()._gap_init_())
135
136
def _latex_(self):
137
r"""
138
EXAMPLES::
139
140
sage: G = SL(6,GF(5))
141
sage: latex(G)
142
\text{SL}_{6}(\Bold{F}_{5})
143
"""
144
return "\\text{SL}_{%s}(%s)"%(self.degree(), self.field_of_definition()._latex_())
145
146
def _repr_(self):
147
"""
148
Text representation of self.
149
150
EXAMPLES::
151
152
sage: SL(6,GF(5))
153
Special Linear Group of degree 6 over Finite Field of size 5
154
"""
155
return "Special Linear Group of degree %s over %s"%(self.degree(), self.base_ring())
156
157
def __call__(self, x):
158
"""
159
Construct a new element in this group, i.e. try to coerce x into
160
self if at all possible.
161
162
EXAMPLES::
163
164
sage: G = SL(3, ZZ)
165
sage: x = [[1,0,1], [0,1,0], [0,0,1]]
166
sage: G(x)
167
[1 0 1]
168
[0 1 0]
169
[0 0 1]
170
"""
171
if isinstance(x, self.element_class) and x.parent() is self:
172
return x
173
try:
174
m = self.matrix_space()(x)
175
except TypeError:
176
raise TypeError, "Cannot coerce %s to a %s-by-%s matrix over %s"%(x,self.degree(),self.degree(),self.base_ring())
177
if m.determinant() == self.base_ring()(1):
178
return self.element_class(m, self)
179
else:
180
raise TypeError, "%s does not have determinant 1"%(x)
181
182
def __contains__(self, x):
183
"""
184
Return True if x is an element of self, False otherwise.
185
186
EXAMPLES::
187
188
sage: G = SL(2, GF(101))
189
sage: x = [[1,1], [0,1]]
190
sage: x in G
191
True
192
193
::
194
195
sage: G = SL(3, ZZ)
196
sage: x = [[1,0,1], [0,-1,0], [0,0,1]]
197
sage: x in G
198
False
199
"""
200
try:
201
x = self(x)
202
except TypeError:
203
return False
204
return True
205
206
207
208
class SpecialLinearGroup_finite_field(SpecialLinearGroup_generic, MatrixGroup_gap_finite_field):
209
pass
210
211
212