Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

60

61

62

63

64

65

66

67

68

69

70

71

72

73

74

75

76

77

78

79

80

81

82

83

84

85

86

87

88

89

90

91

92

93

94

95

96

97

98

99

100

101

102

103

104

105

106

107

108

109

110

111

112

113

114

115

116

117

118

119

120

121

122

123

124

125

126

127

128

129

130

131

132

133

134

135

136

137

138

139

140

141

142

143

144

145

146

147

148

149

150

151

152

153

154

155

156

157

158

159

160

161

162

163

164

165

166

167

168

169

170

171

172

173

174

175

176

177

178

179

180

181

182

183

""" 

Symplectic Linear Groups 

 

EXAMPLES:: 

 

sage: G = Sp(4,GF(7)); G 

Symplectic Group of degree 4 over Finite Field of size 7 

sage: g = prod(G.gens()); g 

[3 0 3 0] 

[1 0 0 0] 

[0 1 0 1] 

[0 2 0 0] 

sage: m = g.matrix() 

sage: m * G.invariant_form() * m.transpose() == G.invariant_form() 

True 

sage: G.order() 

276595200 

 

AUTHORS: 

 

- David Joyner (2006-03): initial version, modified from 

special_linear (by W. Stein) 

 

- Volker Braun (2013-1) port to new Parent, libGAP, extreme refactoring. 

""" 

 

#***************************************************************************** 

# Copyright (C) 2006 David Joyner and William Stein 

# Copyright (C) 2013 Volker Braun <vbraun.name@gmail.com> 

# 

# Distributed under the terms of the GNU General Public License (GPL) 

# http://www.gnu.org/licenses/ 

#***************************************************************************** 

 

from sage.misc.latex import latex 

from sage.misc.cachefunc import cached_method 

from sage.groups.matrix_gps.named_group import ( 

normalize_args_vectorspace, NamedMatrixGroup_generic, NamedMatrixGroup_gap ) 

 

 

 

############################################################################### 

# Symplectic Group 

############################################################################### 

 

def Sp(n, R, var='a'): 

r""" 

Return the symplectic group. 

 

The special linear group `GL( d, R )` consists of all `d \times d` 

matrices that are invertible over the ring `R` with determinant 

one. 

 

.. note:: 

 

This group is also available via ``groups.matrix.Sp()``. 

 

INPUT: 

 

- ``n`` -- a positive integer. 

 

- ``R`` -- ring or an integer. If an integer is specified, the 

corresponding finite field is used. 

 

- ``var`` -- variable used to represent generator of the finite 

field, if needed. 

 

EXAMPLES:: 

 

sage: Sp(4, 5) 

Symplectic Group of degree 4 over Finite Field of size 5 

 

sage: Sp(4, IntegerModRing(15)) 

Symplectic Group of degree 4 over Ring of integers modulo 15 

 

sage: Sp(3, GF(7)) 

Traceback (most recent call last): 

... 

ValueError: the degree must be even 

 

TESTS:: 

 

sage: groups.matrix.Sp(2, 3) 

Symplectic Group of degree 2 over Finite Field of size 3 

 

sage: G = Sp(4,5) 

sage: TestSuite(G).run() 

""" 

degree, ring = normalize_args_vectorspace(n, R, var=var) 

if degree % 2 != 0: 

raise ValueError('the degree must be even') 

name = 'Symplectic Group of degree {0} over {1}'.format(degree, ring) 

ltx = r'\text{{Sp}}_{{{0}}}({1})'.format(degree, latex(ring)) 

from sage.libs.gap.libgap import libgap 

try: 

cmd = 'Sp({0}, {1})'.format(degree, ring._gap_init_()) 

return SymplecticMatrixGroup_gap(degree, ring, True, name, ltx, cmd) 

except ValueError: 

return SymplecticMatrixGroup_generic(degree, ring, True, name, ltx) 

 

 

 

class SymplecticMatrixGroup_generic(NamedMatrixGroup_generic): 

 

@cached_method 

def invariant_form(self): 

""" 

Return the quadratic form preserved by the orthogonal group. 

 

OUTPUT: 

 

A matrix. 

 

EXAMPLES:: 

 

sage: Sp(4, QQ).invariant_form() 

[0 0 0 1] 

[0 0 1 0] 

[0 1 0 0] 

[1 0 0 0] 

""" 

from sage.matrix.constructor import zero_matrix 

m = zero_matrix(self.base_ring(), self.degree()) 

for i in range(self.degree()): 

m[i, self.degree()-i-1] = 1 

m.set_immutable() 

return m 

 

def _check_matrix(self, x, *args): 

""" 

Check whether the matrix ``x`` is symplectic. 

 

See :meth:`~sage.groups.matrix_gps.matrix_group._check_matrix` 

for details. 

 

EXAMPLES:: 

 

sage: G = Sp(4,GF(5)) 

sage: G._check_matrix(G.an_element().matrix()) 

""" 

F = self.invariant_form() 

if x * F * x.transpose() != F: 

raise TypeError('matrix must be symplectic') 

 

 

class SymplecticMatrixGroup_gap(SymplecticMatrixGroup_generic, NamedMatrixGroup_gap): 

r""" 

Symplectic group in GAP 

 

EXAMPLES:: 

 

sage: Sp(2,4) 

Symplectic Group of degree 2 over Finite Field in a of size 2^2 

 

sage: latex(Sp(4,5)) 

\text{Sp}_{4}(\Bold{F}_{5}) 

""" 

 

@cached_method 

def invariant_form(self): 

""" 

Return the quadratic form preserved by the orthogonal group. 

 

OUTPUT: 

 

A matrix. 

 

EXAMPLES:: 

 

sage: Sp(4, GF(3)).invariant_form() 

[0 0 0 1] 

[0 0 1 0] 

[0 2 0 0] 

[2 0 0 0] 

""" 

m = self.gap().InvariantBilinearForm()['matrix'].matrix() 

m.set_immutable() 

return m