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.
Files changed (96) hide show
  1. passagemath_repl-10.5.29.data/data/share/jupyter/kernels/sagemath/kernel.json +1 -0
  2. passagemath_repl-10.5.29.data/data/share/jupyter/kernels/sagemath/logo-64x64.png +0 -0
  3. passagemath_repl-10.5.29.data/data/share/jupyter/kernels/sagemath/logo.svg +352 -0
  4. {passagemath_repl-10.5.27.dist-info → passagemath_repl-10.5.29.dist-info}/METADATA +38 -13
  5. {passagemath_repl-10.5.27.dist-info → passagemath_repl-10.5.29.dist-info}/RECORD +95 -24
  6. {passagemath_repl-10.5.27.dist-info → passagemath_repl-10.5.29.dist-info}/top_level.txt +1 -0
  7. sage/ext_data/all__sagemath_repl.py +1 -0
  8. sage/interfaces/all__sagemath_repl.py +1 -0
  9. sage/repl/ipython_kernel/install.py +6 -8
  10. sage/tests/books/__init__.py +2 -0
  11. sage/tests/books/computational-mathematics-with-sagemath/__init__.py +1 -0
  12. sage/tests/books/computational-mathematics-with-sagemath/calculus_doctest.py +549 -0
  13. sage/tests/books/computational-mathematics-with-sagemath/combinat_doctest.py +1053 -0
  14. sage/tests/books/computational-mathematics-with-sagemath/domaines_doctest.py +443 -0
  15. sage/tests/books/computational-mathematics-with-sagemath/float_doctest.py +477 -0
  16. sage/tests/books/computational-mathematics-with-sagemath/graphique_doctest.py +254 -0
  17. sage/tests/books/computational-mathematics-with-sagemath/graphtheory_doctest.py +418 -0
  18. sage/tests/books/computational-mathematics-with-sagemath/integration_doctest.py +290 -0
  19. sage/tests/books/computational-mathematics-with-sagemath/linalg_doctest.py +454 -0
  20. sage/tests/books/computational-mathematics-with-sagemath/linsolve_doctest.py +421 -0
  21. sage/tests/books/computational-mathematics-with-sagemath/lp_doctest.py +234 -0
  22. sage/tests/books/computational-mathematics-with-sagemath/mpoly_doctest.py +560 -0
  23. sage/tests/books/computational-mathematics-with-sagemath/nonlinear_doctest.py +490 -0
  24. sage/tests/books/computational-mathematics-with-sagemath/numbertheory_doctest.py +155 -0
  25. sage/tests/books/computational-mathematics-with-sagemath/polynomes_doctest.py +405 -0
  26. sage/tests/books/computational-mathematics-with-sagemath/premierspas_doctest.py +180 -0
  27. sage/tests/books/computational-mathematics-with-sagemath/programmation_doctest.py +662 -0
  28. sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py +392 -0
  29. sage/tests/books/computational-mathematics-with-sagemath/sol/__init__.py +1 -0
  30. sage/tests/books/computational-mathematics-with-sagemath/sol/calculus_doctest.py +264 -0
  31. sage/tests/books/computational-mathematics-with-sagemath/sol/combinat_doctest.py +217 -0
  32. sage/tests/books/computational-mathematics-with-sagemath/sol/domaines_doctest.py +59 -0
  33. sage/tests/books/computational-mathematics-with-sagemath/sol/float_doctest.py +141 -0
  34. sage/tests/books/computational-mathematics-with-sagemath/sol/graphique_doctest.py +105 -0
  35. sage/tests/books/computational-mathematics-with-sagemath/sol/graphtheory_doctest.py +53 -0
  36. sage/tests/books/computational-mathematics-with-sagemath/sol/integration_doctest.py +56 -0
  37. sage/tests/books/computational-mathematics-with-sagemath/sol/linalg_doctest.py +56 -0
  38. sage/tests/books/computational-mathematics-with-sagemath/sol/linsolve_doctest.py +25 -0
  39. sage/tests/books/computational-mathematics-with-sagemath/sol/lp_doctest.py +47 -0
  40. sage/tests/books/computational-mathematics-with-sagemath/sol/mpoly_doctest.py +115 -0
  41. sage/tests/books/computational-mathematics-with-sagemath/sol/nonlinear_doctest.py +111 -0
  42. sage/tests/books/computational-mathematics-with-sagemath/sol/numbertheory_doctest.py +167 -0
  43. sage/tests/books/computational-mathematics-with-sagemath/sol/polynomes_doctest.py +107 -0
  44. sage/tests/books/computational-mathematics-with-sagemath/sol/recequadiff_doctest.py +58 -0
  45. sage/tests/books/judson-abstract-algebra/__init__.py +1 -0
  46. sage/tests/books/judson-abstract-algebra/actions-sage-exercises.py +51 -0
  47. sage/tests/books/judson-abstract-algebra/actions-sage.py +173 -0
  48. sage/tests/books/judson-abstract-algebra/algcodes-sage.py +130 -0
  49. sage/tests/books/judson-abstract-algebra/boolean-sage.py +269 -0
  50. sage/tests/books/judson-abstract-algebra/cosets-sage-exercises.py +87 -0
  51. sage/tests/books/judson-abstract-algebra/cosets-sage.py +170 -0
  52. sage/tests/books/judson-abstract-algebra/crypt-sage.py +151 -0
  53. sage/tests/books/judson-abstract-algebra/cyclic-sage.py +450 -0
  54. sage/tests/books/judson-abstract-algebra/domains-sage.py +163 -0
  55. sage/tests/books/judson-abstract-algebra/fields-sage.py +299 -0
  56. sage/tests/books/judson-abstract-algebra/finite-sage.py +108 -0
  57. sage/tests/books/judson-abstract-algebra/galois-sage.py +484 -0
  58. sage/tests/books/judson-abstract-algebra/groups-sage.py +280 -0
  59. sage/tests/books/judson-abstract-algebra/homomorph-sage-exercises.py +65 -0
  60. sage/tests/books/judson-abstract-algebra/homomorph-sage.py +200 -0
  61. sage/tests/books/judson-abstract-algebra/integers-sage.py +197 -0
  62. sage/tests/books/judson-abstract-algebra/isomorph-sage.py +172 -0
  63. sage/tests/books/judson-abstract-algebra/normal-sage.py +133 -0
  64. sage/tests/books/judson-abstract-algebra/permute-sage.py +319 -0
  65. sage/tests/books/judson-abstract-algebra/poly-sage.py +300 -0
  66. sage/tests/books/judson-abstract-algebra/rings-sage.py +413 -0
  67. sage/tests/books/judson-abstract-algebra/sets-sage.py +163 -0
  68. sage/tests/books/judson-abstract-algebra/struct-sage.py +63 -0
  69. sage/tests/books/judson-abstract-algebra/sylow-sage.py +250 -0
  70. sage/tests/books/judson-abstract-algebra/vect-sage-exercises.py +48 -0
  71. sage/tests/books/judson-abstract-algebra/vect-sage.py +211 -0
  72. sage/tests/memcheck/__init__.py +1 -0
  73. sage/tests/memcheck/run_tests.py +25 -0
  74. sage/tests/memcheck/run_tests_in_valgrind.py +36 -0
  75. sage/tests/memcheck/symbolic_expression.py +12 -0
  76. sage/tests/memcheck/verify_no_leak.py +28 -0
  77. sage/tests/all.py +0 -0
  78. {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-cachegrind +0 -0
  79. {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-callgrind +0 -0
  80. {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-cleaner +0 -0
  81. {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-coverage +0 -0
  82. {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-eval +0 -0
  83. {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-fixdoctests +0 -0
  84. {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-inline-fortran +0 -0
  85. {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-ipynb2rst +0 -0
  86. {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-ipython +0 -0
  87. {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-massif +0 -0
  88. {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-notebook +0 -0
  89. {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-omega +0 -0
  90. {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-preparse +0 -0
  91. {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-run +0 -0
  92. {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-run-cython +0 -0
  93. {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-runtests +0 -0
  94. {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-startuptime.py +0 -0
  95. {passagemath_repl-10.5.27.data → passagemath_repl-10.5.29.data}/scripts/sage-valgrind +0 -0
  96. {passagemath_repl-10.5.27.dist-info → passagemath_repl-10.5.29.dist-info}/WHEEL +0 -0
@@ -0,0 +1,250 @@
1
+ # sage_setup: distribution = sagemath-repl
2
+ ## Sage Doctest File ##
3
+ #**************************************#
4
+ #* Generated from PreTeXt source *#
5
+ #* on 2017-08-26T21:16:30-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-26T21:16:30-07:00
35
+ ## From "Abstract Algebra"
36
+ ## At commit 26d3cac0b4047f4b8d6f737542be455606e2c4b4
37
+ ##
38
+ ## Section 15.6 Sage
39
+ ##
40
+ r"""
41
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
42
+
43
+ sage: def all_sylow(G, p):
44
+ ....: '''Form the set of all distinct Sylow p-subgroups of G'''
45
+ ....: scriptP = []
46
+ ....: P = G.sylow_subgroup(p)
47
+ ....: for x in G:
48
+ ....: H = P.conjugate(x)
49
+ ....: if not(H in scriptP):
50
+ ....: scriptP.append(H)
51
+ ....: return scriptP
52
+
53
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
54
+
55
+ sage: G = DihedralGroup(18)
56
+ sage: S2 = G.sylow_subgroup(2); S2
57
+ Subgroup generated by
58
+ [(2,18)(3,17)(4,16)(5,15)(6,14)(7,13)(8,12)(9,11),
59
+ (1,10)(2,11)(3,12)(4,13)(5,14)(6,15)(7,16)(8,17)(9,18)]
60
+ of (Dihedral group of order 36 as a permutation group)
61
+
62
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
63
+
64
+ sage: uniqS2 = all_sylow(G, 2)
65
+ sage: uniqS2
66
+ [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)],
67
+ 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)],
68
+ 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)],
69
+ 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)],
70
+ 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)],
71
+ 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)],
72
+ 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)],
73
+ 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)],
74
+ 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)]]
75
+
76
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
77
+
78
+ sage: len(uniqS2)
79
+ 9
80
+
81
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
82
+
83
+ sage: G = DihedralGroup(18)
84
+ sage: S3 = G.sylow_subgroup(3); S3
85
+ Subgroup generated by
86
+ [(1,15,11,7,3,17,13,9,5)(2,16,12,8,4,18,14,10,6),
87
+ (1,7,13)(2,8,14)(3,9,15)(4,10,16)(5,11,17)(6,12,18)]
88
+ of (Dihedral group of order 36 as a permutation group)
89
+
90
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
91
+
92
+ sage: uniqS3 = all_sylow(G, 3)
93
+ sage: uniqS3
94
+ [Permutation Group with generators
95
+ [(1,15,11,7,3,17,13,9,5)(2,16,12,8,4,18,14,10,6),
96
+ (1,7,13)(2,8,14)(3,9,15)(4,10,16)(5,11,17)(6,12,18)]]
97
+
98
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
99
+
100
+ sage: len(uniqS3)
101
+ 1
102
+
103
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
104
+
105
+ sage: S3.is_normal(G)
106
+ True
107
+
108
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
109
+
110
+ sage: S3.is_cyclic()
111
+ True
112
+
113
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
114
+
115
+ sage: G = DihedralGroup(18)
116
+ sage: S2 = G.sylow_subgroup(2)
117
+ sage: S3 = G.sylow_subgroup(3)
118
+ sage: N2 = G.normalizer(S2); N2
119
+ Subgroup generated by
120
+ [(1,10)(2,11)(3,12)(4,13)(5,14)(6,15)(7,16)(8,17)(9,18),
121
+ (2,18)(3,17)(4,16)(5,15)(6,14)(7,13)(8,12)(9,11)]
122
+ of (Dihedral group of order 36 as a permutation group)
123
+
124
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
125
+
126
+ sage: N2 == S2
127
+ True
128
+
129
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
130
+
131
+ sage: N3 = G.normalizer(S3); N3
132
+ Subgroup generated by
133
+ [(1,15,11,7,3,17,13,9,5)(2,16,12,8,4,18,14,10,6),
134
+ (1,7,13)(2,8,14)(3,9,15)(4,10,16)(5,11,17)(6,12,18),
135
+ (2,18)(3,17)(4,16)(5,15)(6,14)(7,13)(8,12)(9,11),
136
+ (1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18)]
137
+ of (Dihedral group of order 36 as a permutation group)
138
+
139
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
140
+
141
+ sage: N3 == G
142
+ True
143
+
144
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
145
+
146
+ sage: G = DihedralGroup(18)
147
+ sage: a = G("(1,7,13)(2,8,14)(3,9,15)(4,10,16)(5,11,17)(6,12,18)")
148
+ sage: b = G("(1,5)(2,4)(6,18)(7,17)(8,16)(9,15)(10,14)(11,13)")
149
+ sage: H = G.subgroup([a, b])
150
+ sage: H.order()
151
+ 6
152
+
153
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
154
+
155
+ sage: N = G.normalizer(H)
156
+ sage: N
157
+ Subgroup generated by
158
+ [(1,5)(2,4)(6,18)(7,17)(8,16)(9,15)(10,14)(11,13),
159
+ (1,7,13)(2,8,14)(3,9,15)(4,10,16)(5,11,17)(6,12,18),
160
+ (1,2)(3,18)(4,17)(5,16)(6,15)(7,14)(8,13)(9,12)(10,11)]
161
+ of (Dihedral group of order 36 as a permutation group)
162
+
163
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
164
+
165
+ sage: N.order()
166
+ 12
167
+
168
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
169
+
170
+ sage: H.is_normal(G)
171
+ False
172
+
173
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
174
+
175
+ sage: H.is_normal(N)
176
+ True
177
+
178
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
179
+
180
+ sage: DC=DiCyclicGroup(16)
181
+ sage: DC.order()
182
+ 64
183
+
184
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
185
+
186
+ sage: DC.is_simple()
187
+ False
188
+
189
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
190
+
191
+ sage: ns = DC.normal_subgroups()
192
+ sage: len(ns)
193
+ 9
194
+
195
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
196
+
197
+ sage: G = SymmetricGroup(100)
198
+ sage: a = G([(1,60), (2,72), (3,81), (4,43), (5,11), (6,87),
199
+ ....: (7,34), (9,63), (12,46), (13,28), (14,71), (15,42),
200
+ ....: (16,97), (18,57), (19,52), (21,32), (23,47), (24,54),
201
+ ....: (25,83), (26,78), (29,89), (30,39), (33,61), (35,56),
202
+ ....: (37,67), (44,76), (45,88), (48,59), (49,86), (50,74),
203
+ ....: (51,66), (53,99), (55,75), (62,73), (65,79), (68,82),
204
+ ....: (77,92), (84,90), (85,98), (94,100)])
205
+ sage: b = G([(1,86,13,10,47), (2,53,30,8,38),
206
+ ....: (3,40,48,25,17), (4,29,92,88,43), (5,98,66,54, 65),
207
+ ....: (6,27,51,73,24), (7,83,16,20,28), (9,23,89,95,61),
208
+ ....: (11,42,46,91,32), (12,14, 81,55,68), (15,90,31,56,37),
209
+ ....: (18,69,45,84,76), (19,59,79,35,93), (21,22,64,39,100),
210
+ ....: (26,58,96,85,77), (33,52,94,75,44), (34,62,87,78,50),
211
+ ....: (36,82,60,74,72), (41,80,70,49,67), (57,63,71,99,97)])
212
+ sage: a.order(), b.order()
213
+ (2, 5)
214
+
215
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
216
+
217
+ sage: HS = G.subgroup([a, b])
218
+ sage: HS.order()
219
+ 44352000
220
+
221
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
222
+
223
+ sage: HS.is_simple()
224
+ True
225
+
226
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
227
+
228
+ sage: gap.version() # random
229
+ '4.10.0'
230
+
231
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
232
+
233
+ sage: G = gap('Group( (1,2,3,4,5,6), (1,3,5) )')
234
+ sage: G
235
+ Group( [ (1,2,3,4,5,6), (1,3,5) ] )
236
+
237
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
238
+
239
+ sage: G.Center()
240
+ Group( [ (1,3,5)(2,4,6) ] )
241
+
242
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
243
+
244
+ sage: G.Centralizer('(1, 3, 5)')
245
+ Group( [ (1,3,5), (2,4,6), (1,3,5)(2,4,6) ] )
246
+
247
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
248
+
249
+ sage: print(gap.help('SymmetricGroup', pager=False)) # not tested
250
+ """
@@ -0,0 +1,48 @@
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
+ ## Exercises 20.7 Sage Exercises
39
+ ##
40
+ r"""
41
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
42
+
43
+ sage: M = ZZ^3
44
+ sage: u = M([1, 0, 0])
45
+ sage: v = M([2, 2, 0])
46
+ sage: w = M([0, 0, 4])
47
+ sage: N = M.submodule([u, v, w])
48
+ """
@@ -0,0 +1,211 @@
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 20.6 Sage
39
+ ##
40
+ r"""
41
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
42
+
43
+ sage: V = QQ^4; V
44
+ Vector space of dimension 4 over Rational Field
45
+
46
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
47
+
48
+ sage: F.<a> = FiniteField(3^4)
49
+ sage: W = F^5; W
50
+ Vector space of dimension 5 over Finite Field in a of size 3^4
51
+
52
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
53
+
54
+ sage: v = vector(QQ, [1, 1/2, 1/3, 1/4]); v
55
+ (1, 1/2, 1/3, 1/4)
56
+
57
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
58
+
59
+ sage: v in V
60
+ True
61
+
62
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
63
+
64
+ sage: w = vector(F, [1, a^2, a^4, a^6, a^8]); w
65
+ (1, a^2, a^3 + 1, a^3 + a^2 + a + 1, a^2 + a + 2)
66
+
67
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
68
+
69
+ sage: w in W
70
+ True
71
+
72
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
73
+
74
+ sage: u = vector(QQ, [ 1, 2, 3, 4, 5, 6])
75
+ sage: v = vector(QQ, [-1, 2, -4, 8, -16, 32])
76
+ sage: 3*u - 2*v
77
+ (5, 2, 17, -4, 47, -46)
78
+
79
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
80
+
81
+ sage: w = vector(F, [1, a^2, a^4, a^6, a^8])
82
+ sage: x = vector(F, [1, a, 2*a, a, 1])
83
+ sage: y = vector(F, [1, a^3, a^6, a^9, a^12])
84
+ sage: a^25*w + a^43*x + a^66*y
85
+ (a^3 + a^2 + a + 2, a^2 + 2*a, 2*a^3 + a^2 + 2, 2*a^3 + a^2 + a,
86
+ a^3 + 2*a^2 + a + 2)
87
+
88
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
89
+
90
+ sage: u = vector(QQ, [1, -1, 3])
91
+ sage: v = vector(QQ, [2, 1, -1])
92
+ sage: w = vector(QQ, [3, 0, 2])
93
+ sage: S = (QQ^3).subspace([u, v, w]); S
94
+ Vector space of degree 3 and dimension 2 over Rational Field
95
+ Basis matrix:
96
+ [ 1 0 2/3]
97
+ [ 0 1 -7/3]
98
+
99
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
100
+
101
+ sage: 3*u - 6*v + (1/2)*w in S
102
+ True
103
+
104
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
105
+
106
+ sage: vector(QQ, [4, -1, -2]) in S
107
+ False
108
+
109
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
110
+
111
+ sage: S.basis()
112
+ [(1, 0, 2/3), (0, 1, -7/3)]
113
+
114
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
115
+
116
+ sage: u = vector(QQ, [1, -1, 3])
117
+ sage: v = vector(QQ, [2, 1, -1])
118
+ sage: w = vector(QQ, [3, 0, 2])
119
+ sage: u + v == w
120
+ True
121
+
122
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
123
+
124
+ sage: S1 = (QQ^3).subspace([u, v, w])
125
+ sage: S2 = (QQ^3).subspace([u-v, v-w, w-u])
126
+ sage: S1 == S2
127
+ True
128
+
129
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
130
+
131
+ sage: u = vector(QQ, [1, -1, 3, 4])
132
+ sage: v = vector(QQ, [2, 1, -1, -2])
133
+ sage: S = (QQ^4).subspace([u, v, 2*u + 3*v, -u + 2*v])
134
+ sage: S.dimension()
135
+ 2
136
+
137
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
138
+
139
+ sage: F.<a> = FiniteField(3^4)
140
+ sage: u = vector(F, [a^i for i in range(0, 7, 1)])
141
+ sage: v = vector(F, [a^i for i in range(0, 14, 2)])
142
+ sage: w = vector(F, [a^i for i in range(0, 21, 3)])
143
+ sage: S = (F^7).subspace([u, v, w])
144
+ sage: S.dimension()
145
+ 3
146
+
147
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
148
+
149
+ sage: S = (F^7).subspace([u, v, a^3*u + a^11*v])
150
+ sage: S.dimension()
151
+ 2
152
+
153
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
154
+
155
+ sage: F.<a> = FiniteField(7^6)
156
+ sage: u = 2*a^5 + 6*a^4 + 2*a^3 + 3*a^2 + 2*a + 3
157
+ sage: v = 4*a^5 + 4*a^4 + 4*a^3 + 6*a^2 + 5*a + 6
158
+ sage: u + v
159
+ 6*a^5 + 3*a^4 + 6*a^3 + 2*a^2 + 2
160
+
161
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
162
+
163
+ sage: 4*u
164
+ a^5 + 3*a^4 + a^3 + 5*a^2 + a + 5
165
+
166
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
167
+
168
+ sage: 2*u + 5*v
169
+ 3*a^5 + 4*a^4 + 3*a^3 + a^2 + a + 1
170
+
171
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
172
+
173
+ sage: V = F.vector_space(map=False); V
174
+ Vector space of dimension 6 over Finite Field of size 7
175
+
176
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
177
+
178
+ sage: R = V.base_ring(); R
179
+ Finite Field of size 7
180
+
181
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
182
+
183
+ sage: R == FiniteField(7)
184
+ True
185
+
186
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
187
+
188
+ sage: V.dimension()
189
+ 6
190
+
191
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
192
+
193
+ sage: x = V(u); x
194
+ (3, 2, 3, 2, 6, 2)
195
+
196
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
197
+
198
+ sage: y = V(v); y
199
+ (6, 5, 6, 4, 4, 4)
200
+
201
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
202
+
203
+ sage: V(u + v) == V(u) + V(v)
204
+ True
205
+
206
+ ~~~~~~~~~~~~~~~~~~~~~~ ::
207
+
208
+ sage: two = R(2)
209
+ sage: V(two*u) == two*V(u)
210
+ True
211
+ """
@@ -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