passagemath-repl 10.5.28__py3-none-any.whl → 10.5.30__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- passagemath_repl-10.5.30.data/data/share/jupyter/kernels/sagemath/kernel.json +1 -0
- passagemath_repl-10.5.30.data/data/share/jupyter/kernels/sagemath/logo-64x64.png +0 -0
- passagemath_repl-10.5.30.data/data/share/jupyter/kernels/sagemath/logo.svg +352 -0
- {passagemath_repl-10.5.28.dist-info → passagemath_repl-10.5.30.dist-info}/METADATA +3 -3
- {passagemath_repl-10.5.28.dist-info → passagemath_repl-10.5.30.dist-info}/RECORD +95 -24
- {passagemath_repl-10.5.28.dist-info → passagemath_repl-10.5.30.dist-info}/top_level.txt +1 -0
- sage/ext_data/all__sagemath_repl.py +1 -0
- sage/interfaces/all__sagemath_repl.py +1 -0
- sage/repl/ipython_kernel/install.py +6 -8
- sage/tests/books/__init__.py +2 -0
- sage/tests/books/computational-mathematics-with-sagemath/__init__.py +1 -0
- sage/tests/books/computational-mathematics-with-sagemath/calculus_doctest.py +550 -0
- sage/tests/books/computational-mathematics-with-sagemath/combinat_doctest.py +1054 -0
- sage/tests/books/computational-mathematics-with-sagemath/domaines_doctest.py +444 -0
- sage/tests/books/computational-mathematics-with-sagemath/float_doctest.py +478 -0
- sage/tests/books/computational-mathematics-with-sagemath/graphique_doctest.py +255 -0
- sage/tests/books/computational-mathematics-with-sagemath/graphtheory_doctest.py +419 -0
- sage/tests/books/computational-mathematics-with-sagemath/integration_doctest.py +291 -0
- sage/tests/books/computational-mathematics-with-sagemath/linalg_doctest.py +455 -0
- sage/tests/books/computational-mathematics-with-sagemath/linsolve_doctest.py +422 -0
- sage/tests/books/computational-mathematics-with-sagemath/lp_doctest.py +235 -0
- sage/tests/books/computational-mathematics-with-sagemath/mpoly_doctest.py +561 -0
- sage/tests/books/computational-mathematics-with-sagemath/nonlinear_doctest.py +491 -0
- sage/tests/books/computational-mathematics-with-sagemath/numbertheory_doctest.py +156 -0
- sage/tests/books/computational-mathematics-with-sagemath/polynomes_doctest.py +406 -0
- sage/tests/books/computational-mathematics-with-sagemath/premierspas_doctest.py +181 -0
- sage/tests/books/computational-mathematics-with-sagemath/programmation_doctest.py +663 -0
- sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py +393 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/__init__.py +1 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/calculus_doctest.py +265 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/combinat_doctest.py +218 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/domaines_doctest.py +60 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/float_doctest.py +142 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/graphique_doctest.py +106 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/graphtheory_doctest.py +54 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/integration_doctest.py +57 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/linalg_doctest.py +57 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/linsolve_doctest.py +26 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/lp_doctest.py +48 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/mpoly_doctest.py +116 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/nonlinear_doctest.py +112 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/numbertheory_doctest.py +168 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/polynomes_doctest.py +108 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/recequadiff_doctest.py +59 -0
- sage/tests/books/judson-abstract-algebra/__init__.py +1 -0
- sage/tests/books/judson-abstract-algebra/actions-sage-exercises.py +52 -0
- sage/tests/books/judson-abstract-algebra/actions-sage.py +174 -0
- sage/tests/books/judson-abstract-algebra/algcodes-sage.py +131 -0
- sage/tests/books/judson-abstract-algebra/boolean-sage.py +270 -0
- sage/tests/books/judson-abstract-algebra/cosets-sage-exercises.py +88 -0
- sage/tests/books/judson-abstract-algebra/cosets-sage.py +171 -0
- sage/tests/books/judson-abstract-algebra/crypt-sage.py +152 -0
- sage/tests/books/judson-abstract-algebra/cyclic-sage.py +451 -0
- sage/tests/books/judson-abstract-algebra/domains-sage.py +164 -0
- sage/tests/books/judson-abstract-algebra/fields-sage.py +300 -0
- sage/tests/books/judson-abstract-algebra/finite-sage.py +109 -0
- sage/tests/books/judson-abstract-algebra/galois-sage.py +485 -0
- sage/tests/books/judson-abstract-algebra/groups-sage.py +281 -0
- sage/tests/books/judson-abstract-algebra/homomorph-sage-exercises.py +66 -0
- sage/tests/books/judson-abstract-algebra/homomorph-sage.py +201 -0
- sage/tests/books/judson-abstract-algebra/integers-sage.py +198 -0
- sage/tests/books/judson-abstract-algebra/isomorph-sage.py +173 -0
- sage/tests/books/judson-abstract-algebra/normal-sage.py +134 -0
- sage/tests/books/judson-abstract-algebra/permute-sage.py +320 -0
- sage/tests/books/judson-abstract-algebra/poly-sage.py +301 -0
- sage/tests/books/judson-abstract-algebra/rings-sage.py +414 -0
- sage/tests/books/judson-abstract-algebra/sets-sage.py +164 -0
- sage/tests/books/judson-abstract-algebra/struct-sage.py +64 -0
- sage/tests/books/judson-abstract-algebra/sylow-sage.py +251 -0
- sage/tests/books/judson-abstract-algebra/vect-sage-exercises.py +49 -0
- sage/tests/books/judson-abstract-algebra/vect-sage.py +212 -0
- sage/tests/memcheck/__init__.py +1 -0
- sage/tests/memcheck/run_tests.py +25 -0
- sage/tests/memcheck/run_tests_in_valgrind.py +36 -0
- sage/tests/memcheck/symbolic_expression.py +12 -0
- sage/tests/memcheck/verify_no_leak.py +28 -0
- sage/tests/all.py +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-cachegrind +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-callgrind +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-cleaner +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-coverage +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-eval +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-fixdoctests +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-inline-fortran +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-ipynb2rst +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-ipython +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-massif +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-notebook +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-omega +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-preparse +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-run +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-run-cython +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-runtests +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-startuptime.py +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-valgrind +0 -0
- {passagemath_repl-10.5.28.dist-info → passagemath_repl-10.5.30.dist-info}/WHEEL +0 -0
@@ -0,0 +1,251 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-repl
|
2
|
+
# sage.doctest: needs sage.groups
|
3
|
+
## Sage Doctest File ##
|
4
|
+
#**************************************#
|
5
|
+
#* Generated from PreTeXt source *#
|
6
|
+
#* on 2017-08-26T21:16:30-07:00 *#
|
7
|
+
#* *#
|
8
|
+
#* http://mathbook.pugetsound.edu *#
|
9
|
+
#* *#
|
10
|
+
#**************************************#
|
11
|
+
##
|
12
|
+
"""
|
13
|
+
Please contact Rob Beezer (beezer@ups.edu) with
|
14
|
+
any test failures here that need to be changed
|
15
|
+
as a result of changes accepted into Sage. You
|
16
|
+
may edit/change this file in any sensible way, so
|
17
|
+
that development work may procede. Your changes
|
18
|
+
may later be replaced by the authors of "Abstract
|
19
|
+
Algebra: Theory and Applications" when the text is
|
20
|
+
updated, and a replacement of this file is proposed
|
21
|
+
for review.
|
22
|
+
"""
|
23
|
+
##
|
24
|
+
## To execute doctests in these files, run
|
25
|
+
## $ $SAGE_ROOT/sage -t <directory-of-these-files>
|
26
|
+
## or
|
27
|
+
## $ $SAGE_ROOT/sage -t <a-single-file>
|
28
|
+
##
|
29
|
+
## Replace -t by "-tp n" for parallel testing,
|
30
|
+
## "-tp 0" will use a sensible number of threads
|
31
|
+
##
|
32
|
+
## See: http://www.sagemath.org/doc/developer/doctesting.html
|
33
|
+
## or run $ $SAGE_ROOT/sage --advanced for brief help
|
34
|
+
##
|
35
|
+
## Generated at 2017-08-26T21:16:30-07:00
|
36
|
+
## From "Abstract Algebra"
|
37
|
+
## At commit 26d3cac0b4047f4b8d6f737542be455606e2c4b4
|
38
|
+
##
|
39
|
+
## Section 15.6 Sage
|
40
|
+
##
|
41
|
+
r"""
|
42
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
43
|
+
|
44
|
+
sage: def all_sylow(G, p):
|
45
|
+
....: '''Form the set of all distinct Sylow p-subgroups of G'''
|
46
|
+
....: scriptP = []
|
47
|
+
....: P = G.sylow_subgroup(p)
|
48
|
+
....: for x in G:
|
49
|
+
....: H = P.conjugate(x)
|
50
|
+
....: if not(H in scriptP):
|
51
|
+
....: scriptP.append(H)
|
52
|
+
....: return scriptP
|
53
|
+
|
54
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
55
|
+
|
56
|
+
sage: G = DihedralGroup(18)
|
57
|
+
sage: S2 = G.sylow_subgroup(2); S2
|
58
|
+
Subgroup generated by
|
59
|
+
[(2,18)(3,17)(4,16)(5,15)(6,14)(7,13)(8,12)(9,11),
|
60
|
+
(1,10)(2,11)(3,12)(4,13)(5,14)(6,15)(7,16)(8,17)(9,18)]
|
61
|
+
of (Dihedral group of order 36 as a permutation group)
|
62
|
+
|
63
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
64
|
+
|
65
|
+
sage: uniqS2 = all_sylow(G, 2)
|
66
|
+
sage: uniqS2
|
67
|
+
[Permutation Group with generators [(2,18)(3,17)(4,16)(5,15)(6,14)(7,13)(8,12)(9,11), (1,10)(2,11)(3,12)(4,13)(5,14)(6,15)(7,16)(8,17)(9,18)],
|
68
|
+
Permutation Group with generators [(1,7)(2,6)(3,5)(8,18)(9,17)(10,16)(11,15)(12,14), (1,10)(2,11)(3,12)(4,13)(5,14)(6,15)(7,16)(8,17)(9,18)],
|
69
|
+
Permutation Group with generators [(1,13)(2,12)(3,11)(4,10)(5,9)(6,8)(14,18)(15,17), (1,10)(2,11)(3,12)(4,13)(5,14)(6,15)(7,16)(8,17)(9,18)],
|
70
|
+
Permutation Group with generators [(1,15)(2,14)(3,13)(4,12)(5,11)(6,10)(7,9)(16,18), (1,10)(2,11)(3,12)(4,13)(5,14)(6,15)(7,16)(8,17)(9,18)],
|
71
|
+
Permutation Group with generators [(1,3)(4,18)(5,17)(6,16)(7,15)(8,14)(9,13)(10,12), (1,10)(2,11)(3,12)(4,13)(5,14)(6,15)(7,16)(8,17)(9,18)],
|
72
|
+
Permutation Group with generators [(1,9)(2,8)(3,7)(4,6)(10,18)(11,17)(12,16)(13,15), (1,10)(2,11)(3,12)(4,13)(5,14)(6,15)(7,16)(8,17)(9,18)],
|
73
|
+
Permutation Group with generators [(1,11)(2,10)(3,9)(4,8)(5,7)(12,18)(13,17)(14,16), (1,10)(2,11)(3,12)(4,13)(5,14)(6,15)(7,16)(8,17)(9,18)],
|
74
|
+
Permutation Group with generators [(1,17)(2,16)(3,15)(4,14)(5,13)(6,12)(7,11)(8,10), (1,10)(2,11)(3,12)(4,13)(5,14)(6,15)(7,16)(8,17)(9,18)],
|
75
|
+
Permutation Group with generators [(1,5)(2,4)(6,18)(7,17)(8,16)(9,15)(10,14)(11,13), (1,10)(2,11)(3,12)(4,13)(5,14)(6,15)(7,16)(8,17)(9,18)]]
|
76
|
+
|
77
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
78
|
+
|
79
|
+
sage: len(uniqS2)
|
80
|
+
9
|
81
|
+
|
82
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
83
|
+
|
84
|
+
sage: G = DihedralGroup(18)
|
85
|
+
sage: S3 = G.sylow_subgroup(3); S3
|
86
|
+
Subgroup generated by
|
87
|
+
[(1,15,11,7,3,17,13,9,5)(2,16,12,8,4,18,14,10,6),
|
88
|
+
(1,7,13)(2,8,14)(3,9,15)(4,10,16)(5,11,17)(6,12,18)]
|
89
|
+
of (Dihedral group of order 36 as a permutation group)
|
90
|
+
|
91
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
92
|
+
|
93
|
+
sage: uniqS3 = all_sylow(G, 3)
|
94
|
+
sage: uniqS3
|
95
|
+
[Permutation Group with generators
|
96
|
+
[(1,15,11,7,3,17,13,9,5)(2,16,12,8,4,18,14,10,6),
|
97
|
+
(1,7,13)(2,8,14)(3,9,15)(4,10,16)(5,11,17)(6,12,18)]]
|
98
|
+
|
99
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
100
|
+
|
101
|
+
sage: len(uniqS3)
|
102
|
+
1
|
103
|
+
|
104
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
105
|
+
|
106
|
+
sage: S3.is_normal(G)
|
107
|
+
True
|
108
|
+
|
109
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
110
|
+
|
111
|
+
sage: S3.is_cyclic()
|
112
|
+
True
|
113
|
+
|
114
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
115
|
+
|
116
|
+
sage: G = DihedralGroup(18)
|
117
|
+
sage: S2 = G.sylow_subgroup(2)
|
118
|
+
sage: S3 = G.sylow_subgroup(3)
|
119
|
+
sage: N2 = G.normalizer(S2); N2
|
120
|
+
Subgroup generated by
|
121
|
+
[(1,10)(2,11)(3,12)(4,13)(5,14)(6,15)(7,16)(8,17)(9,18),
|
122
|
+
(2,18)(3,17)(4,16)(5,15)(6,14)(7,13)(8,12)(9,11)]
|
123
|
+
of (Dihedral group of order 36 as a permutation group)
|
124
|
+
|
125
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
126
|
+
|
127
|
+
sage: N2 == S2
|
128
|
+
True
|
129
|
+
|
130
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
131
|
+
|
132
|
+
sage: N3 = G.normalizer(S3); N3
|
133
|
+
Subgroup generated by
|
134
|
+
[(1,15,11,7,3,17,13,9,5)(2,16,12,8,4,18,14,10,6),
|
135
|
+
(1,7,13)(2,8,14)(3,9,15)(4,10,16)(5,11,17)(6,12,18),
|
136
|
+
(2,18)(3,17)(4,16)(5,15)(6,14)(7,13)(8,12)(9,11),
|
137
|
+
(1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18)]
|
138
|
+
of (Dihedral group of order 36 as a permutation group)
|
139
|
+
|
140
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
141
|
+
|
142
|
+
sage: N3 == G
|
143
|
+
True
|
144
|
+
|
145
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
146
|
+
|
147
|
+
sage: G = DihedralGroup(18)
|
148
|
+
sage: a = G("(1,7,13)(2,8,14)(3,9,15)(4,10,16)(5,11,17)(6,12,18)")
|
149
|
+
sage: b = G("(1,5)(2,4)(6,18)(7,17)(8,16)(9,15)(10,14)(11,13)")
|
150
|
+
sage: H = G.subgroup([a, b])
|
151
|
+
sage: H.order()
|
152
|
+
6
|
153
|
+
|
154
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
155
|
+
|
156
|
+
sage: N = G.normalizer(H)
|
157
|
+
sage: N
|
158
|
+
Subgroup generated by
|
159
|
+
[(1,5)(2,4)(6,18)(7,17)(8,16)(9,15)(10,14)(11,13),
|
160
|
+
(1,7,13)(2,8,14)(3,9,15)(4,10,16)(5,11,17)(6,12,18),
|
161
|
+
(1,2)(3,18)(4,17)(5,16)(6,15)(7,14)(8,13)(9,12)(10,11)]
|
162
|
+
of (Dihedral group of order 36 as a permutation group)
|
163
|
+
|
164
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
165
|
+
|
166
|
+
sage: N.order()
|
167
|
+
12
|
168
|
+
|
169
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
170
|
+
|
171
|
+
sage: H.is_normal(G)
|
172
|
+
False
|
173
|
+
|
174
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
175
|
+
|
176
|
+
sage: H.is_normal(N)
|
177
|
+
True
|
178
|
+
|
179
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
180
|
+
|
181
|
+
sage: DC=DiCyclicGroup(16)
|
182
|
+
sage: DC.order()
|
183
|
+
64
|
184
|
+
|
185
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
186
|
+
|
187
|
+
sage: DC.is_simple()
|
188
|
+
False
|
189
|
+
|
190
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
191
|
+
|
192
|
+
sage: ns = DC.normal_subgroups()
|
193
|
+
sage: len(ns)
|
194
|
+
9
|
195
|
+
|
196
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
197
|
+
|
198
|
+
sage: G = SymmetricGroup(100)
|
199
|
+
sage: a = G([(1,60), (2,72), (3,81), (4,43), (5,11), (6,87),
|
200
|
+
....: (7,34), (9,63), (12,46), (13,28), (14,71), (15,42),
|
201
|
+
....: (16,97), (18,57), (19,52), (21,32), (23,47), (24,54),
|
202
|
+
....: (25,83), (26,78), (29,89), (30,39), (33,61), (35,56),
|
203
|
+
....: (37,67), (44,76), (45,88), (48,59), (49,86), (50,74),
|
204
|
+
....: (51,66), (53,99), (55,75), (62,73), (65,79), (68,82),
|
205
|
+
....: (77,92), (84,90), (85,98), (94,100)])
|
206
|
+
sage: b = G([(1,86,13,10,47), (2,53,30,8,38),
|
207
|
+
....: (3,40,48,25,17), (4,29,92,88,43), (5,98,66,54, 65),
|
208
|
+
....: (6,27,51,73,24), (7,83,16,20,28), (9,23,89,95,61),
|
209
|
+
....: (11,42,46,91,32), (12,14, 81,55,68), (15,90,31,56,37),
|
210
|
+
....: (18,69,45,84,76), (19,59,79,35,93), (21,22,64,39,100),
|
211
|
+
....: (26,58,96,85,77), (33,52,94,75,44), (34,62,87,78,50),
|
212
|
+
....: (36,82,60,74,72), (41,80,70,49,67), (57,63,71,99,97)])
|
213
|
+
sage: a.order(), b.order()
|
214
|
+
(2, 5)
|
215
|
+
|
216
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
217
|
+
|
218
|
+
sage: HS = G.subgroup([a, b])
|
219
|
+
sage: HS.order()
|
220
|
+
44352000
|
221
|
+
|
222
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
223
|
+
|
224
|
+
sage: HS.is_simple()
|
225
|
+
True
|
226
|
+
|
227
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
228
|
+
|
229
|
+
sage: gap.version() # random
|
230
|
+
'4.10.0'
|
231
|
+
|
232
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
233
|
+
|
234
|
+
sage: G = gap('Group( (1,2,3,4,5,6), (1,3,5) )')
|
235
|
+
sage: G
|
236
|
+
Group( [ (1,2,3,4,5,6), (1,3,5) ] )
|
237
|
+
|
238
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
239
|
+
|
240
|
+
sage: G.Center()
|
241
|
+
Group( [ (1,3,5)(2,4,6) ] )
|
242
|
+
|
243
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
244
|
+
|
245
|
+
sage: G.Centralizer('(1, 3, 5)')
|
246
|
+
Group( [ (1,3,5), (2,4,6), (1,3,5)(2,4,6) ] )
|
247
|
+
|
248
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
249
|
+
|
250
|
+
sage: print(gap.help('SymmetricGroup', pager=False)) # not tested
|
251
|
+
"""
|
@@ -0,0 +1,49 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-repl
|
2
|
+
# sage.doctest: needs sage.modules
|
3
|
+
## Sage Doctest File ##
|
4
|
+
#**************************************#
|
5
|
+
#* Generated from PreTeXt source *#
|
6
|
+
#* on 2017-08-24T11:43:34-07:00 *#
|
7
|
+
#* *#
|
8
|
+
#* http://mathbook.pugetsound.edu *#
|
9
|
+
#* *#
|
10
|
+
#**************************************#
|
11
|
+
##
|
12
|
+
"""
|
13
|
+
Please contact Rob Beezer (beezer@ups.edu) with
|
14
|
+
any test failures here that need to be changed
|
15
|
+
as a result of changes accepted into Sage. You
|
16
|
+
may edit/change this file in any sensible way, so
|
17
|
+
that development work may procede. Your changes
|
18
|
+
may later be replaced by the authors of "Abstract
|
19
|
+
Algebra: Theory and Applications" when the text is
|
20
|
+
updated, and a replacement of this file is proposed
|
21
|
+
for review.
|
22
|
+
"""
|
23
|
+
##
|
24
|
+
## To execute doctests in these files, run
|
25
|
+
## $ $SAGE_ROOT/sage -t <directory-of-these-files>
|
26
|
+
## or
|
27
|
+
## $ $SAGE_ROOT/sage -t <a-single-file>
|
28
|
+
##
|
29
|
+
## Replace -t by "-tp n" for parallel testing,
|
30
|
+
## "-tp 0" will use a sensible number of threads
|
31
|
+
##
|
32
|
+
## See: http://www.sagemath.org/doc/developer/doctesting.html
|
33
|
+
## or run $ $SAGE_ROOT/sage --advanced for brief help
|
34
|
+
##
|
35
|
+
## Generated at 2017-08-24T11:43:34-07:00
|
36
|
+
## From "Abstract Algebra"
|
37
|
+
## At commit 26d3cac0b4047f4b8d6f737542be455606e2c4b4
|
38
|
+
##
|
39
|
+
## Exercises 20.7 Sage Exercises
|
40
|
+
##
|
41
|
+
r"""
|
42
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
43
|
+
|
44
|
+
sage: M = ZZ^3
|
45
|
+
sage: u = M([1, 0, 0])
|
46
|
+
sage: v = M([2, 2, 0])
|
47
|
+
sage: w = M([0, 0, 4])
|
48
|
+
sage: N = M.submodule([u, v, w])
|
49
|
+
"""
|
@@ -0,0 +1,212 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-repl
|
2
|
+
# sage.doctest: needs sage.modules sage.rings.finite_rings
|
3
|
+
## Sage Doctest File ##
|
4
|
+
#**************************************#
|
5
|
+
#* Generated from PreTeXt source *#
|
6
|
+
#* on 2017-08-24T11:43:34-07:00 *#
|
7
|
+
#* *#
|
8
|
+
#* http://mathbook.pugetsound.edu *#
|
9
|
+
#* *#
|
10
|
+
#**************************************#
|
11
|
+
##
|
12
|
+
"""
|
13
|
+
Please contact Rob Beezer (beezer@ups.edu) with
|
14
|
+
any test failures here that need to be changed
|
15
|
+
as a result of changes accepted into Sage. You
|
16
|
+
may edit/change this file in any sensible way, so
|
17
|
+
that development work may procede. Your changes
|
18
|
+
may later be replaced by the authors of "Abstract
|
19
|
+
Algebra: Theory and Applications" when the text is
|
20
|
+
updated, and a replacement of this file is proposed
|
21
|
+
for review.
|
22
|
+
"""
|
23
|
+
##
|
24
|
+
## To execute doctests in these files, run
|
25
|
+
## $ $SAGE_ROOT/sage -t <directory-of-these-files>
|
26
|
+
## or
|
27
|
+
## $ $SAGE_ROOT/sage -t <a-single-file>
|
28
|
+
##
|
29
|
+
## Replace -t by "-tp n" for parallel testing,
|
30
|
+
## "-tp 0" will use a sensible number of threads
|
31
|
+
##
|
32
|
+
## See: http://www.sagemath.org/doc/developer/doctesting.html
|
33
|
+
## or run $ $SAGE_ROOT/sage --advanced for brief help
|
34
|
+
##
|
35
|
+
## Generated at 2017-08-24T11:43:34-07:00
|
36
|
+
## From "Abstract Algebra"
|
37
|
+
## At commit 26d3cac0b4047f4b8d6f737542be455606e2c4b4
|
38
|
+
##
|
39
|
+
## Section 20.6 Sage
|
40
|
+
##
|
41
|
+
r"""
|
42
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
43
|
+
|
44
|
+
sage: V = QQ^4; V
|
45
|
+
Vector space of dimension 4 over Rational Field
|
46
|
+
|
47
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
48
|
+
|
49
|
+
sage: F.<a> = FiniteField(3^4)
|
50
|
+
sage: W = F^5; W
|
51
|
+
Vector space of dimension 5 over Finite Field in a of size 3^4
|
52
|
+
|
53
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
54
|
+
|
55
|
+
sage: v = vector(QQ, [1, 1/2, 1/3, 1/4]); v
|
56
|
+
(1, 1/2, 1/3, 1/4)
|
57
|
+
|
58
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
59
|
+
|
60
|
+
sage: v in V
|
61
|
+
True
|
62
|
+
|
63
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
64
|
+
|
65
|
+
sage: w = vector(F, [1, a^2, a^4, a^6, a^8]); w
|
66
|
+
(1, a^2, a^3 + 1, a^3 + a^2 + a + 1, a^2 + a + 2)
|
67
|
+
|
68
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
69
|
+
|
70
|
+
sage: w in W
|
71
|
+
True
|
72
|
+
|
73
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
74
|
+
|
75
|
+
sage: u = vector(QQ, [ 1, 2, 3, 4, 5, 6])
|
76
|
+
sage: v = vector(QQ, [-1, 2, -4, 8, -16, 32])
|
77
|
+
sage: 3*u - 2*v
|
78
|
+
(5, 2, 17, -4, 47, -46)
|
79
|
+
|
80
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
81
|
+
|
82
|
+
sage: w = vector(F, [1, a^2, a^4, a^6, a^8])
|
83
|
+
sage: x = vector(F, [1, a, 2*a, a, 1])
|
84
|
+
sage: y = vector(F, [1, a^3, a^6, a^9, a^12])
|
85
|
+
sage: a^25*w + a^43*x + a^66*y
|
86
|
+
(a^3 + a^2 + a + 2, a^2 + 2*a, 2*a^3 + a^2 + 2, 2*a^3 + a^2 + a,
|
87
|
+
a^3 + 2*a^2 + a + 2)
|
88
|
+
|
89
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
90
|
+
|
91
|
+
sage: u = vector(QQ, [1, -1, 3])
|
92
|
+
sage: v = vector(QQ, [2, 1, -1])
|
93
|
+
sage: w = vector(QQ, [3, 0, 2])
|
94
|
+
sage: S = (QQ^3).subspace([u, v, w]); S
|
95
|
+
Vector space of degree 3 and dimension 2 over Rational Field
|
96
|
+
Basis matrix:
|
97
|
+
[ 1 0 2/3]
|
98
|
+
[ 0 1 -7/3]
|
99
|
+
|
100
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
101
|
+
|
102
|
+
sage: 3*u - 6*v + (1/2)*w in S
|
103
|
+
True
|
104
|
+
|
105
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
106
|
+
|
107
|
+
sage: vector(QQ, [4, -1, -2]) in S
|
108
|
+
False
|
109
|
+
|
110
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
111
|
+
|
112
|
+
sage: S.basis()
|
113
|
+
[(1, 0, 2/3), (0, 1, -7/3)]
|
114
|
+
|
115
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
116
|
+
|
117
|
+
sage: u = vector(QQ, [1, -1, 3])
|
118
|
+
sage: v = vector(QQ, [2, 1, -1])
|
119
|
+
sage: w = vector(QQ, [3, 0, 2])
|
120
|
+
sage: u + v == w
|
121
|
+
True
|
122
|
+
|
123
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
124
|
+
|
125
|
+
sage: S1 = (QQ^3).subspace([u, v, w])
|
126
|
+
sage: S2 = (QQ^3).subspace([u-v, v-w, w-u])
|
127
|
+
sage: S1 == S2
|
128
|
+
True
|
129
|
+
|
130
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
131
|
+
|
132
|
+
sage: u = vector(QQ, [1, -1, 3, 4])
|
133
|
+
sage: v = vector(QQ, [2, 1, -1, -2])
|
134
|
+
sage: S = (QQ^4).subspace([u, v, 2*u + 3*v, -u + 2*v])
|
135
|
+
sage: S.dimension()
|
136
|
+
2
|
137
|
+
|
138
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
139
|
+
|
140
|
+
sage: F.<a> = FiniteField(3^4)
|
141
|
+
sage: u = vector(F, [a^i for i in range(0, 7, 1)])
|
142
|
+
sage: v = vector(F, [a^i for i in range(0, 14, 2)])
|
143
|
+
sage: w = vector(F, [a^i for i in range(0, 21, 3)])
|
144
|
+
sage: S = (F^7).subspace([u, v, w])
|
145
|
+
sage: S.dimension()
|
146
|
+
3
|
147
|
+
|
148
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
149
|
+
|
150
|
+
sage: S = (F^7).subspace([u, v, a^3*u + a^11*v])
|
151
|
+
sage: S.dimension()
|
152
|
+
2
|
153
|
+
|
154
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
155
|
+
|
156
|
+
sage: F.<a> = FiniteField(7^6)
|
157
|
+
sage: u = 2*a^5 + 6*a^4 + 2*a^3 + 3*a^2 + 2*a + 3
|
158
|
+
sage: v = 4*a^5 + 4*a^4 + 4*a^3 + 6*a^2 + 5*a + 6
|
159
|
+
sage: u + v
|
160
|
+
6*a^5 + 3*a^4 + 6*a^3 + 2*a^2 + 2
|
161
|
+
|
162
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
163
|
+
|
164
|
+
sage: 4*u
|
165
|
+
a^5 + 3*a^4 + a^3 + 5*a^2 + a + 5
|
166
|
+
|
167
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
168
|
+
|
169
|
+
sage: 2*u + 5*v
|
170
|
+
3*a^5 + 4*a^4 + 3*a^3 + a^2 + a + 1
|
171
|
+
|
172
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
173
|
+
|
174
|
+
sage: V = F.vector_space(map=False); V
|
175
|
+
Vector space of dimension 6 over Finite Field of size 7
|
176
|
+
|
177
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
178
|
+
|
179
|
+
sage: R = V.base_ring(); R
|
180
|
+
Finite Field of size 7
|
181
|
+
|
182
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
183
|
+
|
184
|
+
sage: R == FiniteField(7)
|
185
|
+
True
|
186
|
+
|
187
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
188
|
+
|
189
|
+
sage: V.dimension()
|
190
|
+
6
|
191
|
+
|
192
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
193
|
+
|
194
|
+
sage: x = V(u); x
|
195
|
+
(3, 2, 3, 2, 6, 2)
|
196
|
+
|
197
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
198
|
+
|
199
|
+
sage: y = V(v); y
|
200
|
+
(6, 5, 6, 4, 4, 4)
|
201
|
+
|
202
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
203
|
+
|
204
|
+
sage: V(u + v) == V(u) + V(v)
|
205
|
+
True
|
206
|
+
|
207
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
208
|
+
|
209
|
+
sage: two = R(2)
|
210
|
+
sage: V(two*u) == two*V(u)
|
211
|
+
True
|
212
|
+
"""
|
@@ -0,0 +1 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-repl
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-repl
|
2
|
+
import types
|
3
|
+
|
4
|
+
|
5
|
+
def run_tests() -> None:
|
6
|
+
"""
|
7
|
+
Run all memcheck tests
|
8
|
+
"""
|
9
|
+
from sage.tests.memcheck import symbolic_expression
|
10
|
+
run_tests_in_module(symbolic_expression)
|
11
|
+
|
12
|
+
|
13
|
+
def run_tests_in_module(mod: types.ModuleType) -> None:
|
14
|
+
"""
|
15
|
+
Run all memcheck tests in the given module
|
16
|
+
"""
|
17
|
+
for entry in dir(mod):
|
18
|
+
if not entry.startswith('test_'):
|
19
|
+
continue
|
20
|
+
test_func = getattr(mod, entry)
|
21
|
+
test_func()
|
22
|
+
|
23
|
+
|
24
|
+
if __name__ == '__main__':
|
25
|
+
run_tests()
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-repl
|
2
|
+
"""
|
3
|
+
Launch valgrind and run the memory leak tests
|
4
|
+
|
5
|
+
|
6
|
+
From the commandline, run
|
7
|
+
|
8
|
+
sage -python -m sage.tests.memcheck.run_tests_in_valgrind
|
9
|
+
|
10
|
+
to launch valgrind and execute the memory leak tests. Requires valgrind
|
11
|
+
to be installed. Alternatively, run as a unit test:
|
12
|
+
|
13
|
+
sage: from sage.tests.memcheck.run_tests_in_valgrind import run_tests_in_valgrind
|
14
|
+
sage: run_tests_in_valgrind() # optional - valgrind
|
15
|
+
"""
|
16
|
+
|
17
|
+
import subprocess
|
18
|
+
|
19
|
+
|
20
|
+
def run_tests_in_valgrind() -> None:
|
21
|
+
"""
|
22
|
+
Run the sage.tests.memcheck.run_tests module inside valgrind
|
23
|
+
"""
|
24
|
+
subprocess.check_call([
|
25
|
+
'valgrind',
|
26
|
+
'--suppressions=src/sage/ext_data/valgrind/valgrind-python.supp',
|
27
|
+
'--show-possibly-lost=no',
|
28
|
+
'--show-reachable=no',
|
29
|
+
'./venv/bin/python',
|
30
|
+
'-m',
|
31
|
+
'sage.tests.memcheck.run_tests'
|
32
|
+
])
|
33
|
+
|
34
|
+
|
35
|
+
if __name__ == '__main__':
|
36
|
+
run_tests_in_valgrind()
|
@@ -0,0 +1,12 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-repl
|
2
|
+
from sage.tests.memcheck.verify_no_leak import verify_no_leak
|
3
|
+
|
4
|
+
|
5
|
+
def test_sqrt_sqrt_2() -> None:
|
6
|
+
from sage.misc.functional import sqrt
|
7
|
+
T2 = sqrt(2)
|
8
|
+
|
9
|
+
def sqrt_T2() -> None:
|
10
|
+
sqrt(T2)
|
11
|
+
|
12
|
+
verify_no_leak(sqrt_T2)
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-repl
|
2
|
+
from typing import Callable, Any
|
3
|
+
import valgrind
|
4
|
+
|
5
|
+
|
6
|
+
def verify_no_leak(callback: Callable[[], Any],
|
7
|
+
repeat: int = 10000,
|
8
|
+
fuzzy: int = 10,
|
9
|
+
) -> None:
|
10
|
+
"""
|
11
|
+
Verify that the callback does not generate new definitely lost blocks
|
12
|
+
|
13
|
+
Raises an assertion if the callback leaks memory
|
14
|
+
"""
|
15
|
+
callback() # warm_up
|
16
|
+
initial_blocks = (0, 0, 0, 0)
|
17
|
+
valgrind.memcheck_do_leak_check()
|
18
|
+
initial_blocks = valgrind.memcheck_count_leak_blocks()
|
19
|
+
for _ in range(repeat):
|
20
|
+
callback()
|
21
|
+
valgrind.memcheck_do_leak_check()
|
22
|
+
leak_blocks = valgrind.memcheck_count_leak_blocks()
|
23
|
+
leak = leak_blocks[0] - initial_blocks[0]
|
24
|
+
if leak < repeat - fuzzy:
|
25
|
+
return # callback did not leak at least once per call
|
26
|
+
blocks = round(leak / repeat, 2)
|
27
|
+
message = f'{callback} leaked {blocks} block on average ({repeat} iterations)'
|
28
|
+
raise AssertionError(message)
|
sage/tests/all.py
DELETED
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|
File without changes
|