passagemath-repl 10.5.27__py3-none-any.whl → 10.5.29__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.29.data/data/share/jupyter/kernels/sagemath/kernel.json +1 -0
- passagemath_repl-10.5.29.data/data/share/jupyter/kernels/sagemath/logo-64x64.png +0 -0
- passagemath_repl-10.5.29.data/data/share/jupyter/kernels/sagemath/logo.svg +352 -0
- {passagemath_repl-10.5.27.dist-info → passagemath_repl-10.5.29.dist-info}/METADATA +38 -13
- {passagemath_repl-10.5.27.dist-info → passagemath_repl-10.5.29.dist-info}/RECORD +95 -24
- {passagemath_repl-10.5.27.dist-info → passagemath_repl-10.5.29.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 +549 -0
- sage/tests/books/computational-mathematics-with-sagemath/combinat_doctest.py +1053 -0
- sage/tests/books/computational-mathematics-with-sagemath/domaines_doctest.py +443 -0
- sage/tests/books/computational-mathematics-with-sagemath/float_doctest.py +477 -0
- sage/tests/books/computational-mathematics-with-sagemath/graphique_doctest.py +254 -0
- sage/tests/books/computational-mathematics-with-sagemath/graphtheory_doctest.py +418 -0
- sage/tests/books/computational-mathematics-with-sagemath/integration_doctest.py +290 -0
- sage/tests/books/computational-mathematics-with-sagemath/linalg_doctest.py +454 -0
- sage/tests/books/computational-mathematics-with-sagemath/linsolve_doctest.py +421 -0
- sage/tests/books/computational-mathematics-with-sagemath/lp_doctest.py +234 -0
- sage/tests/books/computational-mathematics-with-sagemath/mpoly_doctest.py +560 -0
- sage/tests/books/computational-mathematics-with-sagemath/nonlinear_doctest.py +490 -0
- sage/tests/books/computational-mathematics-with-sagemath/numbertheory_doctest.py +155 -0
- sage/tests/books/computational-mathematics-with-sagemath/polynomes_doctest.py +405 -0
- sage/tests/books/computational-mathematics-with-sagemath/premierspas_doctest.py +180 -0
- sage/tests/books/computational-mathematics-with-sagemath/programmation_doctest.py +662 -0
- sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py +392 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/__init__.py +1 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/calculus_doctest.py +264 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/combinat_doctest.py +217 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/domaines_doctest.py +59 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/float_doctest.py +141 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/graphique_doctest.py +105 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/graphtheory_doctest.py +53 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/integration_doctest.py +56 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/linalg_doctest.py +56 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/linsolve_doctest.py +25 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/lp_doctest.py +47 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/mpoly_doctest.py +115 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/nonlinear_doctest.py +111 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/numbertheory_doctest.py +167 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/polynomes_doctest.py +107 -0
- sage/tests/books/computational-mathematics-with-sagemath/sol/recequadiff_doctest.py +58 -0
- sage/tests/books/judson-abstract-algebra/__init__.py +1 -0
- sage/tests/books/judson-abstract-algebra/actions-sage-exercises.py +51 -0
- sage/tests/books/judson-abstract-algebra/actions-sage.py +173 -0
- sage/tests/books/judson-abstract-algebra/algcodes-sage.py +130 -0
- sage/tests/books/judson-abstract-algebra/boolean-sage.py +269 -0
- sage/tests/books/judson-abstract-algebra/cosets-sage-exercises.py +87 -0
- sage/tests/books/judson-abstract-algebra/cosets-sage.py +170 -0
- sage/tests/books/judson-abstract-algebra/crypt-sage.py +151 -0
- sage/tests/books/judson-abstract-algebra/cyclic-sage.py +450 -0
- sage/tests/books/judson-abstract-algebra/domains-sage.py +163 -0
- sage/tests/books/judson-abstract-algebra/fields-sage.py +299 -0
- sage/tests/books/judson-abstract-algebra/finite-sage.py +108 -0
- sage/tests/books/judson-abstract-algebra/galois-sage.py +484 -0
- sage/tests/books/judson-abstract-algebra/groups-sage.py +280 -0
- sage/tests/books/judson-abstract-algebra/homomorph-sage-exercises.py +65 -0
- sage/tests/books/judson-abstract-algebra/homomorph-sage.py +200 -0
- sage/tests/books/judson-abstract-algebra/integers-sage.py +197 -0
- sage/tests/books/judson-abstract-algebra/isomorph-sage.py +172 -0
- sage/tests/books/judson-abstract-algebra/normal-sage.py +133 -0
- sage/tests/books/judson-abstract-algebra/permute-sage.py +319 -0
- sage/tests/books/judson-abstract-algebra/poly-sage.py +300 -0
- sage/tests/books/judson-abstract-algebra/rings-sage.py +413 -0
- sage/tests/books/judson-abstract-algebra/sets-sage.py +163 -0
- sage/tests/books/judson-abstract-algebra/struct-sage.py +63 -0
- sage/tests/books/judson-abstract-algebra/sylow-sage.py +250 -0
- sage/tests/books/judson-abstract-algebra/vect-sage-exercises.py +48 -0
- sage/tests/books/judson-abstract-algebra/vect-sage.py +211 -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.27.data → passagemath_repl-10.5.29.data}/scripts/sage-cachegrind +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-callgrind +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-cleaner +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-coverage +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-eval +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-fixdoctests +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-inline-fortran +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-ipynb2rst +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-ipython +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-massif +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-notebook +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-omega +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-preparse +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-run +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-run-cython +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-runtests +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-startuptime.py +0 -0
- {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-valgrind +0 -0
- {passagemath_repl-10.5.27.dist-info → passagemath_repl-10.5.29.dist-info}/WHEEL +0 -0
@@ -0,0 +1,319 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-repl
|
2
|
+
## Sage Doctest File ##
|
3
|
+
#**************************************#
|
4
|
+
#* Generated from PreTeXt source *#
|
5
|
+
#* on 2017-08-24T11:43:34-07:00 *#
|
6
|
+
#* *#
|
7
|
+
#* http://mathbook.pugetsound.edu *#
|
8
|
+
#* *#
|
9
|
+
#**************************************#
|
10
|
+
##
|
11
|
+
"""
|
12
|
+
Please contact Rob Beezer (beezer@ups.edu) with
|
13
|
+
any test failures here that need to be changed
|
14
|
+
as a result of changes accepted into Sage. You
|
15
|
+
may edit/change this file in any sensible way, so
|
16
|
+
that development work may procede. Your changes
|
17
|
+
may later be replaced by the authors of "Abstract
|
18
|
+
Algebra: Theory and Applications" when the text is
|
19
|
+
updated, and a replacement of this file is proposed
|
20
|
+
for review.
|
21
|
+
"""
|
22
|
+
##
|
23
|
+
## To execute doctests in these files, run
|
24
|
+
## $ $SAGE_ROOT/sage -t <directory-of-these-files>
|
25
|
+
## or
|
26
|
+
## $ $SAGE_ROOT/sage -t <a-single-file>
|
27
|
+
##
|
28
|
+
## Replace -t by "-tp n" for parallel testing,
|
29
|
+
## "-tp 0" will use a sensible number of threads
|
30
|
+
##
|
31
|
+
## See: http://www.sagemath.org/doc/developer/doctesting.html
|
32
|
+
## or run $ $SAGE_ROOT/sage --advanced for brief help
|
33
|
+
##
|
34
|
+
## Generated at 2017-08-24T11:43:34-07:00
|
35
|
+
## From "Abstract Algebra"
|
36
|
+
## At commit 26d3cac0b4047f4b8d6f737542be455606e2c4b4
|
37
|
+
##
|
38
|
+
## Section 5.4 Sage
|
39
|
+
##
|
40
|
+
r"""
|
41
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
42
|
+
|
43
|
+
sage: G = SymmetricGroup(5)
|
44
|
+
sage: sigma = G("(1,3)(2,5,4)")
|
45
|
+
sage: sigma*sigma
|
46
|
+
(2,4,5)
|
47
|
+
|
48
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
49
|
+
|
50
|
+
sage: rho = G("(2,4)(1,5)")
|
51
|
+
sage: rho^3
|
52
|
+
(1,5)(2,4)
|
53
|
+
|
54
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
55
|
+
|
56
|
+
sage: sigma*rho
|
57
|
+
(1,3,5,2)
|
58
|
+
|
59
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
60
|
+
|
61
|
+
sage: rho*sigma
|
62
|
+
(1,4,5,3)
|
63
|
+
|
64
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
65
|
+
|
66
|
+
sage: rho^-1*sigma*rho
|
67
|
+
(1,2,4)(3,5)
|
68
|
+
|
69
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
70
|
+
|
71
|
+
sage: sigma1 = G("(1,3)(2,5,4)")
|
72
|
+
sage: sigma1
|
73
|
+
(1,3)(2,5,4)
|
74
|
+
|
75
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
76
|
+
|
77
|
+
sage: sigma2 = G([(1,3),(2,5,4)])
|
78
|
+
sage: sigma2
|
79
|
+
(1,3)(2,5,4)
|
80
|
+
|
81
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
82
|
+
|
83
|
+
sage: sigma3 = G([3,5,1,2,4])
|
84
|
+
sage: sigma3
|
85
|
+
(1,3)(2,5,4)
|
86
|
+
|
87
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
88
|
+
|
89
|
+
sage: sigma1 == sigma2
|
90
|
+
True
|
91
|
+
|
92
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
93
|
+
|
94
|
+
sage: sigma2 == sigma3
|
95
|
+
True
|
96
|
+
|
97
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
98
|
+
|
99
|
+
sage: sigma2.cycle_tuples()
|
100
|
+
[(1, 3), (2, 5, 4)]
|
101
|
+
|
102
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
103
|
+
|
104
|
+
sage: [sigma3(x) for x in G.domain()]
|
105
|
+
[3, 5, 1, 2, 4]
|
106
|
+
|
107
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
108
|
+
|
109
|
+
sage: H = SymmetricGroup(4)
|
110
|
+
sage: sigma = H("(1,2,3,4)")
|
111
|
+
sage: G = SymmetricGroup(6)
|
112
|
+
sage: tau = G("(1,2,3,4,5,6)")
|
113
|
+
sage: rho = tau * sigma
|
114
|
+
sage: rho
|
115
|
+
(1,3)(2,4,5,6)
|
116
|
+
|
117
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
118
|
+
|
119
|
+
sage: sigma.parent()
|
120
|
+
Symmetric group of order 4! as a permutation group
|
121
|
+
|
122
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
123
|
+
|
124
|
+
sage: tau.parent()
|
125
|
+
Symmetric group of order 6! as a permutation group
|
126
|
+
|
127
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
128
|
+
|
129
|
+
sage: rho.parent()
|
130
|
+
Symmetric group of order 6! as a permutation group
|
131
|
+
|
132
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
133
|
+
|
134
|
+
sage: tau.parent() == rho.parent()
|
135
|
+
True
|
136
|
+
|
137
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
138
|
+
|
139
|
+
sage: sigmaG = G(sigma)
|
140
|
+
sage: sigmaG.parent()
|
141
|
+
Symmetric group of order 6! as a permutation group
|
142
|
+
|
143
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
144
|
+
|
145
|
+
sage: tauH = H(tau)
|
146
|
+
Traceback (most recent call last):
|
147
|
+
...
|
148
|
+
ValueError: invalid data to initialize a permutation
|
149
|
+
|
150
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
151
|
+
|
152
|
+
sage: groups.permutation. # not tested
|
153
|
+
|
154
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
155
|
+
|
156
|
+
sage: D = DihedralGroup(5)
|
157
|
+
sage: elements = D.list(); elements
|
158
|
+
[(),
|
159
|
+
(1,5,4,3,2),
|
160
|
+
(1,4,2,5,3),
|
161
|
+
(1,3,5,2,4),
|
162
|
+
(1,2,3,4,5),
|
163
|
+
(2,5)(3,4),
|
164
|
+
(1,5)(2,4),
|
165
|
+
(1,4)(2,3),
|
166
|
+
(1,3)(4,5),
|
167
|
+
(1,2)(3,5)]
|
168
|
+
|
169
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
170
|
+
|
171
|
+
sage: rotate = elements[4]
|
172
|
+
sage: flip = elements[5]
|
173
|
+
sage: flip*rotate == rotate* flip
|
174
|
+
False
|
175
|
+
|
176
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
177
|
+
|
178
|
+
sage: D = DihedralGroup(5)
|
179
|
+
sage: D.is_abelian()
|
180
|
+
False
|
181
|
+
|
182
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
183
|
+
|
184
|
+
sage: A4 = AlternatingGroup(4)
|
185
|
+
sage: A4.order()
|
186
|
+
12
|
187
|
+
|
188
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
189
|
+
|
190
|
+
sage: A4.is_finite()
|
191
|
+
True
|
192
|
+
|
193
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
194
|
+
|
195
|
+
sage: A4.is_abelian()
|
196
|
+
False
|
197
|
+
|
198
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
199
|
+
|
200
|
+
sage: A4.is_cyclic()
|
201
|
+
False
|
202
|
+
|
203
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
204
|
+
|
205
|
+
sage: sigma = A4("(1,2,4)")
|
206
|
+
sage: sigma^-1
|
207
|
+
(1,4,2)
|
208
|
+
|
209
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
210
|
+
|
211
|
+
sage: sigma.order()
|
212
|
+
3
|
213
|
+
|
214
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
215
|
+
|
216
|
+
sage: G = SymmetricGroup(3)
|
217
|
+
sage: sigma = G("(1,2)")
|
218
|
+
sage: tau = G("(1,3)")
|
219
|
+
sage: rho = sigma*tau
|
220
|
+
sage: sigma.sign()
|
221
|
+
-1
|
222
|
+
|
223
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
224
|
+
|
225
|
+
sage: rho.sign()
|
226
|
+
1
|
227
|
+
|
228
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
229
|
+
|
230
|
+
sage: A4 = AlternatingGroup(4)
|
231
|
+
sage: sigma = A4("(1,2,4)")
|
232
|
+
sage: sg = A4.subgroup([sigma])
|
233
|
+
sage: sg
|
234
|
+
Subgroup generated by
|
235
|
+
[(1,2,4)] of (Alternating group of order 4!/2 as a permutation group)
|
236
|
+
|
237
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
238
|
+
|
239
|
+
sage: sg.order()
|
240
|
+
3
|
241
|
+
|
242
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
243
|
+
|
244
|
+
sage: sg.list()
|
245
|
+
[(), (1,2,4), (1,4,2)]
|
246
|
+
|
247
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
248
|
+
|
249
|
+
sage: sg.is_abelian()
|
250
|
+
True
|
251
|
+
|
252
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
253
|
+
|
254
|
+
sage: sg.is_cyclic()
|
255
|
+
True
|
256
|
+
|
257
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
258
|
+
|
259
|
+
sage: sg.is_subgroup(A4)
|
260
|
+
True
|
261
|
+
|
262
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
263
|
+
|
264
|
+
sage: G = SymmetricGroup(5)
|
265
|
+
sage: sigma = G("(4,5)")
|
266
|
+
sage: tau = G("(1,3)")
|
267
|
+
sage: H = G.subgroup([sigma, tau])
|
268
|
+
sage: H.list()
|
269
|
+
[(), (4,5), (1,3), (1,3)(4,5)]
|
270
|
+
|
271
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
272
|
+
|
273
|
+
sage: text_names = ['id', 'sigma', 'tau', 'mu']
|
274
|
+
sage: H.cayley_table(names=text_names)
|
275
|
+
* id sigma tau mu
|
276
|
+
+------------------------
|
277
|
+
id| id sigma tau mu
|
278
|
+
sigma| sigma id mu tau
|
279
|
+
tau| tau mu id sigma
|
280
|
+
mu| mu tau sigma id
|
281
|
+
|
282
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
283
|
+
|
284
|
+
sage: G = SymmetricGroup(8)
|
285
|
+
sage: above = G("(1,2,3,4)(5,6,7,8)")
|
286
|
+
sage: front = G("(1,4,8,5)(2,3,7,6)")
|
287
|
+
sage: right = G("(1,2,6,5)(3,7,8,4)")
|
288
|
+
sage: cube = G.subgroup([above, front, right])
|
289
|
+
sage: cube.order()
|
290
|
+
24
|
291
|
+
|
292
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
293
|
+
|
294
|
+
sage: cube.list()
|
295
|
+
[(),
|
296
|
+
(1,3)(2,4)(5,7)(6,8),
|
297
|
+
(1,6)(2,5)(3,8)(4,7),
|
298
|
+
(1,8)(2,7)(3,6)(4,5),
|
299
|
+
(1,4,3,2)(5,8,7,6),
|
300
|
+
(1,2,3,4)(5,6,7,8),
|
301
|
+
(1,5)(2,8)(3,7)(4,6),
|
302
|
+
(1,7)(2,6)(3,5)(4,8),
|
303
|
+
(2,5,4)(3,6,8),
|
304
|
+
(1,3,8)(2,7,5),
|
305
|
+
(1,6,3)(4,5,7),
|
306
|
+
(1,8,6)(2,4,7),
|
307
|
+
(1,4)(2,8)(3,5)(6,7),
|
308
|
+
(1,2,6,5)(3,7,8,4),
|
309
|
+
(1,5,6,2)(3,4,8,7),
|
310
|
+
(1,7)(2,3)(4,6)(5,8),
|
311
|
+
(2,4,5)(3,8,6),
|
312
|
+
(1,3,6)(4,7,5),
|
313
|
+
(1,6,8)(2,7,4),
|
314
|
+
(1,8,3)(2,5,7),
|
315
|
+
(1,4,8,5)(2,3,7,6),
|
316
|
+
(1,2)(3,5)(4,6)(7,8),
|
317
|
+
(1,5,8,4)(2,6,7,3),
|
318
|
+
(1,7)(2,8)(3,4)(5,6)]
|
319
|
+
"""
|
@@ -0,0 +1,300 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-repl
|
2
|
+
## Sage Doctest File ##
|
3
|
+
#**************************************#
|
4
|
+
#* Generated from PreTeXt source *#
|
5
|
+
#* on 2017-08-24T11:43:34-07:00 *#
|
6
|
+
#* *#
|
7
|
+
#* http://mathbook.pugetsound.edu *#
|
8
|
+
#* *#
|
9
|
+
#**************************************#
|
10
|
+
##
|
11
|
+
"""
|
12
|
+
Please contact Rob Beezer (beezer@ups.edu) with
|
13
|
+
any test failures here that need to be changed
|
14
|
+
as a result of changes accepted into Sage. You
|
15
|
+
may edit/change this file in any sensible way, so
|
16
|
+
that development work may procede. Your changes
|
17
|
+
may later be replaced by the authors of "Abstract
|
18
|
+
Algebra: Theory and Applications" when the text is
|
19
|
+
updated, and a replacement of this file is proposed
|
20
|
+
for review.
|
21
|
+
"""
|
22
|
+
##
|
23
|
+
## To execute doctests in these files, run
|
24
|
+
## $ $SAGE_ROOT/sage -t <directory-of-these-files>
|
25
|
+
## or
|
26
|
+
## $ $SAGE_ROOT/sage -t <a-single-file>
|
27
|
+
##
|
28
|
+
## Replace -t by "-tp n" for parallel testing,
|
29
|
+
## "-tp 0" will use a sensible number of threads
|
30
|
+
##
|
31
|
+
## See: http://www.sagemath.org/doc/developer/doctesting.html
|
32
|
+
## or run $ $SAGE_ROOT/sage --advanced for brief help
|
33
|
+
##
|
34
|
+
## Generated at 2017-08-24T11:43:34-07:00
|
35
|
+
## From "Abstract Algebra"
|
36
|
+
## At commit 26d3cac0b4047f4b8d6f737542be455606e2c4b4
|
37
|
+
##
|
38
|
+
## Section 17.6 Sage
|
39
|
+
##
|
40
|
+
r"""
|
41
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
42
|
+
|
43
|
+
sage: R.<x> = Integers(8)[]; R
|
44
|
+
Univariate Polynomial Ring in x over Ring of integers modulo 8
|
45
|
+
|
46
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
47
|
+
|
48
|
+
sage: S.<y> = ZZ[]; S
|
49
|
+
Univariate Polynomial Ring in y over Integer Ring
|
50
|
+
|
51
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
52
|
+
|
53
|
+
sage: T.<z> = QQ[]; T
|
54
|
+
Univariate Polynomial Ring in z over Rational Field
|
55
|
+
|
56
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
57
|
+
|
58
|
+
sage: R.is_finite()
|
59
|
+
False
|
60
|
+
|
61
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
62
|
+
|
63
|
+
sage: R.is_integral_domain()
|
64
|
+
False
|
65
|
+
|
66
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
67
|
+
|
68
|
+
sage: S.is_integral_domain()
|
69
|
+
True
|
70
|
+
|
71
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
72
|
+
|
73
|
+
sage: T.is_field()
|
74
|
+
False
|
75
|
+
|
76
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
77
|
+
|
78
|
+
sage: R.characteristic()
|
79
|
+
8
|
80
|
+
|
81
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
82
|
+
|
83
|
+
sage: T.characteristic()
|
84
|
+
0
|
85
|
+
|
86
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
87
|
+
|
88
|
+
sage: y in S
|
89
|
+
True
|
90
|
+
|
91
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
92
|
+
|
93
|
+
sage: x in S
|
94
|
+
False
|
95
|
+
|
96
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
97
|
+
|
98
|
+
sage: q = (3/2) + (5/4)*z^2
|
99
|
+
sage: q in T
|
100
|
+
True
|
101
|
+
|
102
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
103
|
+
|
104
|
+
sage: 3 in S
|
105
|
+
True
|
106
|
+
|
107
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
108
|
+
|
109
|
+
sage: r = 3
|
110
|
+
sage: r.parent()
|
111
|
+
Integer Ring
|
112
|
+
|
113
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
114
|
+
|
115
|
+
sage: s = 3*y^0
|
116
|
+
sage: s.parent()
|
117
|
+
Univariate Polynomial Ring in y over Integer Ring
|
118
|
+
|
119
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
120
|
+
|
121
|
+
sage: p = 3 + 5*x + 2*x^2
|
122
|
+
sage: p.parent()
|
123
|
+
Univariate Polynomial Ring in x over Ring of integers modulo 8
|
124
|
+
|
125
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
126
|
+
|
127
|
+
sage: p(1)
|
128
|
+
2
|
129
|
+
|
130
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
131
|
+
|
132
|
+
sage: [p(t) for t in Integers(8)]
|
133
|
+
[3, 2, 5, 4, 7, 6, 1, 0]
|
134
|
+
|
135
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
136
|
+
|
137
|
+
sage: q = 4*x^2+4*x
|
138
|
+
sage: [q(t) for t in Integers(8)]
|
139
|
+
[0, 0, 0, 0, 0, 0, 0, 0]
|
140
|
+
|
141
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
142
|
+
|
143
|
+
sage: M.<s, t> = QQ[]; M
|
144
|
+
Multivariate Polynomial Ring in s, t over Rational Field
|
145
|
+
|
146
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
147
|
+
|
148
|
+
sage: R.<x> = QQ[]
|
149
|
+
sage: p = 1/4*x^4 - x^3 + x^2 - x - 1/2
|
150
|
+
sage: p.is_irreducible()
|
151
|
+
True
|
152
|
+
|
153
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
154
|
+
|
155
|
+
sage: p.factor()
|
156
|
+
(1/4) * (x^4 - 4*x^3 + 4*x^2 - 4*x - 2)
|
157
|
+
|
158
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
159
|
+
|
160
|
+
sage: q = 2*x^5 + 5/2*x^4 + 3/4*x^3 - 25/24*x^2 - x - 1/2
|
161
|
+
sage: q.is_irreducible()
|
162
|
+
False
|
163
|
+
|
164
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
165
|
+
|
166
|
+
sage: q.factor()
|
167
|
+
(2) * (x^2 + 3/2*x + 3/4) * (x^3 - 1/4*x^2 - 1/3)
|
168
|
+
|
169
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
170
|
+
|
171
|
+
sage: F.<a> = FiniteField(5^2)
|
172
|
+
sage: S.<y> = F[]
|
173
|
+
sage: p = 2*y^5 + 2*y^4 + 4*y^3 + 2*y^2 + 3*y + 1
|
174
|
+
sage: p.is_irreducible()
|
175
|
+
True
|
176
|
+
|
177
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
178
|
+
|
179
|
+
sage: p.factor()
|
180
|
+
(2) * (y^5 + y^4 + 2*y^3 + y^2 + 4*y + 3)
|
181
|
+
|
182
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
183
|
+
|
184
|
+
sage: q = 3*y^4+2*y^3-y+4; q.factor()
|
185
|
+
(3) * (y^2 + (a + 4)*y + 2*a + 3) * (y^2 + 4*a*y + 3*a)
|
186
|
+
|
187
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
188
|
+
|
189
|
+
sage: r = y^4+2*y^3+3*y^2+4; r.factor()
|
190
|
+
(y + 4) * (y^3 + 3*y^2 + y + 1)
|
191
|
+
|
192
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
193
|
+
|
194
|
+
sage: s = 3*y^4+2*y^3-y+3; s.factor()
|
195
|
+
(3) * (y + 1) * (y + 3) * (y + 2*a + 4) * (y + 3*a + 1)
|
196
|
+
|
197
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
198
|
+
|
199
|
+
sage: F.modulus()
|
200
|
+
x^2 + 4*x + 2
|
201
|
+
|
202
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
203
|
+
|
204
|
+
sage: [t for t in F if r(t)==0]
|
205
|
+
[1]
|
206
|
+
|
207
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
208
|
+
|
209
|
+
sage: [t for t in F if s(t)==0]
|
210
|
+
[2, 3*a + 1, 4, 2*a + 4]
|
211
|
+
|
212
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
213
|
+
|
214
|
+
sage: W.<w> = QQ[]
|
215
|
+
sage: p = 16*w^5 - 9*w^4 +3*w^2 + 6*w -21
|
216
|
+
sage: p.is_irreducible()
|
217
|
+
True
|
218
|
+
|
219
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
220
|
+
|
221
|
+
sage: W.<w> = QQ[]
|
222
|
+
sage: r = -w^5 + 5*w^4 - 4*w^3 + 14*w^2 - 67*w + 17
|
223
|
+
sage: s = 3*w^5 - 14*w^4 + 12*w^3 - 6*w^2 + w
|
224
|
+
sage: S = W.ideal(r, s)
|
225
|
+
sage: S
|
226
|
+
Principal ideal (w^2 - 4*w + 1) of
|
227
|
+
Univariate Polynomial Ring in w over Rational Field
|
228
|
+
|
229
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
230
|
+
|
231
|
+
sage: (w^2)*r + (3*w-6)*s in S
|
232
|
+
True
|
233
|
+
|
234
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
235
|
+
|
236
|
+
sage: F = Integers(7)
|
237
|
+
sage: R.<x> = F[]
|
238
|
+
sage: p = x^5+ x + 4
|
239
|
+
sage: p.is_irreducible()
|
240
|
+
True
|
241
|
+
|
242
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
243
|
+
|
244
|
+
sage: id = R.ideal(p)
|
245
|
+
sage: Q = R.quotient(id); Q
|
246
|
+
Univariate Quotient Polynomial Ring in xbar over
|
247
|
+
Ring of integers modulo 7 with modulus x^5 + x + 4
|
248
|
+
|
249
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
250
|
+
|
251
|
+
sage: Q.is_field()
|
252
|
+
True
|
253
|
+
|
254
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
255
|
+
|
256
|
+
sage: Q.order() == 7^5
|
257
|
+
True
|
258
|
+
|
259
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
260
|
+
|
261
|
+
sage: Q.gen(0)
|
262
|
+
xbar
|
263
|
+
|
264
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
265
|
+
|
266
|
+
sage: Q.<t> = R.quotient(id); Q
|
267
|
+
Univariate Quotient Polynomial Ring in t over
|
268
|
+
Ring of integers modulo 7 with modulus x^5 + x + 4
|
269
|
+
|
270
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
271
|
+
|
272
|
+
sage: t^5 + t + 4
|
273
|
+
0
|
274
|
+
|
275
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
276
|
+
|
277
|
+
sage: t^5 == -(t+4)
|
278
|
+
True
|
279
|
+
|
280
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
281
|
+
|
282
|
+
sage: t^5
|
283
|
+
6*t + 3
|
284
|
+
|
285
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
286
|
+
|
287
|
+
sage: (3*t^3 + t + 5)*(t^2 + 4*t + 2)
|
288
|
+
5*t^4 + 2*t^2 + 5*t + 5
|
289
|
+
|
290
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
291
|
+
|
292
|
+
sage: a = 3*t^4 - 6*t^3 + 3*t^2 + 5*t + 2
|
293
|
+
sage: ainv = a^-1; ainv
|
294
|
+
6*t^4 + 5*t^2 + 4
|
295
|
+
|
296
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
297
|
+
|
298
|
+
sage: a*ainv
|
299
|
+
1
|
300
|
+
"""
|