This repository has been archived by the owner on Jan 30, 2023. It is now read-only.
/
actions-sage.py
174 lines (130 loc) · 4.11 KB
/
actions-sage.py
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
## -*- coding: utf-8 -*- ##
## Sage Doctest File ##
#**************************************#
#* Generated from PreTeXt source *#
#* on 2017-08-24T11:43:34-07:00 *#
#* *#
#* http://mathbook.pugetsound.edu *#
#* *#
#**************************************#
##
"""
Please contact Rob Beezer (beezer@ups.edu) with
any test failures here that need to be changed
as a result of changes accepted into Sage. You
may edit/change this file in any sensible way, so
that development work may procede. Your changes
may later be replaced by the authors of "Abstract
Algebra: Theory and Applications" when the text is
updated, and a replacement of this file is proposed
for review.
"""
##
## To execute doctests in these files, run
## $ $SAGE_ROOT/sage -t <directory-of-these-files>
## or
## $ $SAGE_ROOT/sage -t <a-single-file>
##
## Replace -t by "-tp n" for parallel testing,
## "-tp 0" will use a sensible number of threads
##
## See: http://www.sagemath.org/doc/developer/doctesting.html
## or run $ $SAGE_ROOT/sage --advanced for brief help
##
## Generated at 2017-08-24T11:43:34-07:00
## From "Abstract Algebra"
## At commit 26d3cac0b4047f4b8d6f737542be455606e2c4b4
##
## Section 14.7 Sage
##
r"""
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: D = DihedralGroup(8)
sage: C = D.center(); C
Subgroup generated by [(1,5)(2,6)(3,7)(4,8)]
of (Dihedral group of order 16 as a permutation group)
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: C.list()
[(), (1,5)(2,6)(3,7)(4,8)]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: a = D("(1,2)(3,8)(4,7)(5,6)")
sage: C1 = D.centralizer(a); C1.list()
[(), (1,2)(3,8)(4,7)(5,6), (1,5)(2,6)(3,7)(4,8), (1,6)(2,5)(3,4)(7,8)]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: b = D("(1,2,3,4,5,6,7,8)")
sage: C2 = D.centralizer(b); C2.order()
8
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: CCR = D.conjugacy_classes_representatives(); CCR
[(), (2,8)(3,7)(4,6), (1,2)(3,8)(4,7)(5,6), (1,2,3,4,5,6,7,8),
(1,3,5,7)(2,4,6,8), (1,4,7,2,5,8,3,6), (1,5)(2,6)(3,7)(4,8)]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: r = CCR[2]; r
(1,2)(3,8)(4,7)(5,6)
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: conj = []
sage: x = [conj.append(g^-1*r*g) for g in D if not g^-1*r*g in conj]
sage: conj
[(1,2)(3,8)(4,7)(5,6),
(1,6)(2,5)(3,4)(7,8),
(1,8)(2,7)(3,6)(4,5),
(1,4)(2,3)(5,8)(6,7)]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: sizes = [D.order()/D.centralizer(g).order()
....: for g in D.conjugacy_classes_representatives()]
sage: sizes
[1, 4, 4, 2, 2, 2, 1]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: D.order() == sum(sizes)
True
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: Q = graphs.CubeGraph(3)
sage: Q.plot(layout='spring') # not tested
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: A = Q.automorphism_group()
sage: A.order()
48
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: a = A("('000','001')('010','011')('110','111')('100','101')")
sage: a in A
True
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: A.orbits() # random
[['000', '001', '010', '100', '011', '101', '110', '111']]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: A.is_transitive()
True
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: S = A.stabilizer('000')
sage: S.list() # random
[(),
('001','100','010')('011','101','110'),
('010','100')('011','101'),
('001','010','100')('011','110','101'),
('001','100')('011','110'),
('001','010')('101','110')]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: P = graphs.PathGraph(11)
sage: P.plot() # not tested
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: A = P.automorphism_group()
sage: A.list()
[(), (0,10)(1,9)(2,8)(3,7)(4,6)]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: A.is_transitive()
False
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: A.orbits()
[[0, 10], [1, 9], [2, 8], [3, 7], [4, 6], [5]]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: A.stabilizer(2).list()
[()]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: A.stabilizer(5).list()
[(), (0,10)(1,9)(2,8)(3,7)(4,6)]
~~~~~~~~~~~~~~~~~~~~~~ ::
sage: G = SymmetricGroup(4)
sage: S = G.stabilizer(4)
sage: S.orbits()
[[1, 2, 3], [4]]
"""