passagemath-repl 10.5.28__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.28.dist-info → passagemath_repl-10.5.29.dist-info}/METADATA +3 -3
- {passagemath_repl-10.5.28.dist-info → passagemath_repl-10.5.29.dist-info}/RECORD +95 -24
- {passagemath_repl-10.5.28.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.28.data → passagemath_repl-10.5.29.data}/scripts/sage-cachegrind +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.29.data}/scripts/sage-callgrind +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.29.data}/scripts/sage-cleaner +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.29.data}/scripts/sage-coverage +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.29.data}/scripts/sage-eval +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.29.data}/scripts/sage-fixdoctests +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.29.data}/scripts/sage-inline-fortran +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.29.data}/scripts/sage-ipynb2rst +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.29.data}/scripts/sage-ipython +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.29.data}/scripts/sage-massif +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.29.data}/scripts/sage-notebook +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.29.data}/scripts/sage-omega +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.29.data}/scripts/sage-preparse +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.29.data}/scripts/sage-run +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.29.data}/scripts/sage-run-cython +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.29.data}/scripts/sage-runtests +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.29.data}/scripts/sage-startuptime.py +0 -0
- {passagemath_repl-10.5.28.data → passagemath_repl-10.5.29.data}/scripts/sage-valgrind +0 -0
- {passagemath_repl-10.5.28.dist-info → passagemath_repl-10.5.29.dist-info}/WHEEL +0 -0
@@ -0,0 +1,173 @@
|
|
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 14.7 Sage
|
39
|
+
##
|
40
|
+
r"""
|
41
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
42
|
+
|
43
|
+
sage: D = DihedralGroup(8)
|
44
|
+
sage: C = D.center(); C
|
45
|
+
Subgroup generated by [(1,5)(2,6)(3,7)(4,8)]
|
46
|
+
of (Dihedral group of order 16 as a permutation group)
|
47
|
+
|
48
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
49
|
+
|
50
|
+
sage: C.list()
|
51
|
+
[(), (1,5)(2,6)(3,7)(4,8)]
|
52
|
+
|
53
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
54
|
+
|
55
|
+
sage: a = D("(1,2)(3,8)(4,7)(5,6)")
|
56
|
+
sage: C1 = D.centralizer(a); C1.list()
|
57
|
+
[(), (1,2)(3,8)(4,7)(5,6), (1,5)(2,6)(3,7)(4,8), (1,6)(2,5)(3,4)(7,8)]
|
58
|
+
|
59
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
60
|
+
|
61
|
+
sage: b = D("(1,2,3,4,5,6,7,8)")
|
62
|
+
sage: C2 = D.centralizer(b); C2.order()
|
63
|
+
8
|
64
|
+
|
65
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
66
|
+
|
67
|
+
sage: CCR = D.conjugacy_classes_representatives(); CCR
|
68
|
+
[(), (2,8)(3,7)(4,6), (1,2)(3,8)(4,7)(5,6), (1,2,3,4,5,6,7,8),
|
69
|
+
(1,3,5,7)(2,4,6,8), (1,4,7,2,5,8,3,6), (1,5)(2,6)(3,7)(4,8)]
|
70
|
+
|
71
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
72
|
+
|
73
|
+
sage: r = CCR[2]; r
|
74
|
+
(1,2)(3,8)(4,7)(5,6)
|
75
|
+
|
76
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
77
|
+
|
78
|
+
sage: conj = []
|
79
|
+
sage: x = [conj.append(g^-1*r*g) for g in D if not g^-1*r*g in conj]
|
80
|
+
sage: conj
|
81
|
+
[(1,2)(3,8)(4,7)(5,6),
|
82
|
+
(1,6)(2,5)(3,4)(7,8),
|
83
|
+
(1,8)(2,7)(3,6)(4,5),
|
84
|
+
(1,4)(2,3)(5,8)(6,7)]
|
85
|
+
|
86
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
87
|
+
|
88
|
+
sage: sizes = [D.order()/D.centralizer(g).order()
|
89
|
+
....: for g in D.conjugacy_classes_representatives()]
|
90
|
+
sage: sizes
|
91
|
+
[1, 4, 4, 2, 2, 2, 1]
|
92
|
+
|
93
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
94
|
+
|
95
|
+
sage: D.order() == sum(sizes)
|
96
|
+
True
|
97
|
+
|
98
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
99
|
+
|
100
|
+
sage: Q = graphs.CubeGraph(3)
|
101
|
+
sage: Q.plot(layout='spring') # not tested
|
102
|
+
|
103
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
104
|
+
|
105
|
+
sage: A = Q.automorphism_group()
|
106
|
+
sage: A.order()
|
107
|
+
48
|
108
|
+
|
109
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
110
|
+
|
111
|
+
sage: a = A("('000','001')('010','011')('110','111')('100','101')")
|
112
|
+
sage: a in A
|
113
|
+
True
|
114
|
+
|
115
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
116
|
+
|
117
|
+
sage: A.orbits() # random
|
118
|
+
[['000', '001', '010', '100', '011', '101', '110', '111']]
|
119
|
+
|
120
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
121
|
+
|
122
|
+
sage: A.is_transitive()
|
123
|
+
True
|
124
|
+
|
125
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
126
|
+
|
127
|
+
sage: S = A.stabilizer('000')
|
128
|
+
sage: S.list() # random
|
129
|
+
[(),
|
130
|
+
('001','100','010')('011','101','110'),
|
131
|
+
('010','100')('011','101'),
|
132
|
+
('001','010','100')('011','110','101'),
|
133
|
+
('001','100')('011','110'),
|
134
|
+
('001','010')('101','110')]
|
135
|
+
|
136
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
137
|
+
|
138
|
+
sage: P = graphs.PathGraph(11)
|
139
|
+
sage: P.plot() # not tested
|
140
|
+
|
141
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
142
|
+
|
143
|
+
sage: A = P.automorphism_group()
|
144
|
+
sage: A.list()
|
145
|
+
[(), (0,10)(1,9)(2,8)(3,7)(4,6)]
|
146
|
+
|
147
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
148
|
+
|
149
|
+
sage: A.is_transitive()
|
150
|
+
False
|
151
|
+
|
152
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
153
|
+
|
154
|
+
sage: A.orbits()
|
155
|
+
((0, 10), (1, 9), (2, 8), (3, 7), (4, 6), (5,))
|
156
|
+
|
157
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
158
|
+
|
159
|
+
sage: A.stabilizer(2).list()
|
160
|
+
[()]
|
161
|
+
|
162
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
163
|
+
|
164
|
+
sage: A.stabilizer(5).list()
|
165
|
+
[(), (0,10)(1,9)(2,8)(3,7)(4,6)]
|
166
|
+
|
167
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
168
|
+
|
169
|
+
sage: G = SymmetricGroup(4)
|
170
|
+
sage: S = G.stabilizer(4)
|
171
|
+
sage: S.orbits()
|
172
|
+
((1, 2, 3), (4,))
|
173
|
+
"""
|
@@ -0,0 +1,130 @@
|
|
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 8.8 Sage
|
39
|
+
##
|
40
|
+
r"""
|
41
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
42
|
+
|
43
|
+
sage: codes. # not tested
|
44
|
+
|
45
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
46
|
+
|
47
|
+
sage: H = codes.HammingCode(GF(2), 3); H
|
48
|
+
[7, 4] Hamming Code over GF(2)
|
49
|
+
|
50
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
51
|
+
|
52
|
+
sage: H.dimension()
|
53
|
+
4
|
54
|
+
|
55
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
56
|
+
|
57
|
+
sage: H.list()
|
58
|
+
[(0, 0, 0, 0, 0, 0, 0), (1, 0, 0, 0, 0, 1, 1), (0, 1, 0, 0, 1, 0, 1),
|
59
|
+
(1, 1, 0, 0, 1, 1, 0), (0, 0, 1, 0, 1, 1, 0), (1, 0, 1, 0, 1, 0, 1),
|
60
|
+
(0, 1, 1, 0, 0, 1, 1), (1, 1, 1, 0, 0, 0, 0), (0, 0, 0, 1, 1, 1, 1),
|
61
|
+
(1, 0, 0, 1, 1, 0, 0), (0, 1, 0, 1, 0, 1, 0), (1, 1, 0, 1, 0, 0, 1),
|
62
|
+
(0, 0, 1, 1, 0, 0, 1), (1, 0, 1, 1, 0, 1, 0), (0, 1, 1, 1, 1, 0, 0),
|
63
|
+
(1, 1, 1, 1, 1, 1, 1)]
|
64
|
+
|
65
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
66
|
+
|
67
|
+
sage: H.minimum_distance()
|
68
|
+
3
|
69
|
+
|
70
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
71
|
+
|
72
|
+
sage: C = H.parity_check_matrix(); C
|
73
|
+
[1 0 1 0 1 0 1]
|
74
|
+
[0 1 1 0 0 1 1]
|
75
|
+
[0 0 0 1 1 1 1]
|
76
|
+
|
77
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
78
|
+
|
79
|
+
sage: G = H.generator_matrix(); G
|
80
|
+
[1 0 0 0 0 1 1]
|
81
|
+
[0 1 0 0 1 0 1]
|
82
|
+
[0 0 1 0 1 1 0]
|
83
|
+
[0 0 0 1 1 1 1]
|
84
|
+
|
85
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
86
|
+
|
87
|
+
sage: C*G.transpose() == zero_matrix(3, 4)
|
88
|
+
True
|
89
|
+
|
90
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
91
|
+
|
92
|
+
sage: H.systematic_generator_matrix()
|
93
|
+
[1 0 0 0 0 1 1]
|
94
|
+
[0 1 0 0 1 0 1]
|
95
|
+
[0 0 1 0 1 1 0]
|
96
|
+
[0 0 0 1 1 1 1]
|
97
|
+
|
98
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
99
|
+
|
100
|
+
sage: r = vector(GF(2), [1, 1, 1, 1, 0, 0, 1]); r
|
101
|
+
(1, 1, 1, 1, 0, 0, 1)
|
102
|
+
|
103
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
104
|
+
|
105
|
+
sage: C*r
|
106
|
+
(1, 1, 0)
|
107
|
+
|
108
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
109
|
+
|
110
|
+
sage: H.decode_to_code(r)
|
111
|
+
(1, 1, 0, 1, 0, 0, 1)
|
112
|
+
|
113
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
114
|
+
|
115
|
+
sage: message = vector(GF(2), [1, 1, 0, 1, 0, 0, 1])
|
116
|
+
sage: errors = vector(GF(2), [0, 0, 1, 0, 1, 1, 0])
|
117
|
+
sage: received = message + errors
|
118
|
+
sage: received
|
119
|
+
(1, 1, 1, 1, 1, 1, 1)
|
120
|
+
|
121
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
122
|
+
|
123
|
+
sage: H.decode_to_code(received) == message
|
124
|
+
False
|
125
|
+
|
126
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
127
|
+
|
128
|
+
sage: H.decode_to_code(received) == received
|
129
|
+
True
|
130
|
+
"""
|
@@ -0,0 +1,269 @@
|
|
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 19.7 Sage
|
39
|
+
##
|
40
|
+
r"""
|
41
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
42
|
+
|
43
|
+
sage: X = (24).divisors()
|
44
|
+
sage: X
|
45
|
+
[1, 2, 3, 4, 6, 8, 12, 24]
|
46
|
+
|
47
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
48
|
+
|
49
|
+
sage: R = [(a,b) for a in X for b in X if a.divides(b)]; R
|
50
|
+
[(1, 1), (1, 2), (1, 3), (1, 4), (1, 6), (1, 8), (1, 12), (1, 24),
|
51
|
+
(2, 2), (2, 4), (2, 6), (2, 8), (2, 12), (2, 24), (3, 3), (3, 6),
|
52
|
+
(3, 12), (3, 24), (4, 4), (4, 8), (4, 12), (4, 24), (6, 6),
|
53
|
+
(6, 12), (6, 24), (8, 8), (8, 24), (12, 12), (12, 24), (24, 24)]
|
54
|
+
|
55
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
56
|
+
|
57
|
+
sage: D = Poset([X, R])
|
58
|
+
sage: D.plot() # not tested
|
59
|
+
|
60
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
61
|
+
|
62
|
+
sage: divisible = lambda x, y: x.divides(y)
|
63
|
+
sage: L = Poset([X, divisible])
|
64
|
+
sage: L == D
|
65
|
+
True
|
66
|
+
|
67
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
68
|
+
|
69
|
+
sage: L.plot() # not tested
|
70
|
+
|
71
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
72
|
+
|
73
|
+
sage: Q = Posets.PentagonPoset()
|
74
|
+
sage: Q.plot() # not tested
|
75
|
+
|
76
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
77
|
+
|
78
|
+
sage: S = Posets.BooleanLattice(4)
|
79
|
+
sage: S.plot() # not tested
|
80
|
+
|
81
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
82
|
+
|
83
|
+
sage: T = Posets.RandomPoset(20,0.05)
|
84
|
+
sage: T.plot() # not tested
|
85
|
+
|
86
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
87
|
+
|
88
|
+
sage: D.is_lequal(4, 8)
|
89
|
+
True
|
90
|
+
|
91
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
92
|
+
|
93
|
+
sage: D.is_lequal(4, 4)
|
94
|
+
True
|
95
|
+
|
96
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
97
|
+
|
98
|
+
sage: D.is_less_than(4, 8)
|
99
|
+
True
|
100
|
+
|
101
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
102
|
+
|
103
|
+
sage: D.is_less_than(4, 4)
|
104
|
+
False
|
105
|
+
|
106
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
107
|
+
|
108
|
+
sage: D.is_lequal(6, 8)
|
109
|
+
False
|
110
|
+
|
111
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
112
|
+
|
113
|
+
sage: D.is_lequal(8, 6)
|
114
|
+
False
|
115
|
+
|
116
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
117
|
+
|
118
|
+
sage: D.is_gequal(8, 4)
|
119
|
+
True
|
120
|
+
|
121
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
122
|
+
|
123
|
+
sage: D.is_greater_than(4, 8)
|
124
|
+
False
|
125
|
+
|
126
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
127
|
+
|
128
|
+
sage: X = range(20)
|
129
|
+
sage: C = [[18, 7], [9, 11], [9, 10], [11, 8], [6, 10],
|
130
|
+
....: [10, 2], [0, 2], [2, 1], [1, 8], [8, 12],
|
131
|
+
....: [8, 3], [3, 15], [15, 7], [7, 16], [7, 4],
|
132
|
+
....: [16, 17], [16, 13], [4, 19], [4, 14], [14, 5]]
|
133
|
+
sage: P = Poset([X, C])
|
134
|
+
sage: P.plot() # not tested
|
135
|
+
|
136
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
137
|
+
|
138
|
+
sage: P.minimal_elements()
|
139
|
+
[18, 9, 6, 0]
|
140
|
+
|
141
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
142
|
+
|
143
|
+
sage: P.maximal_elements()
|
144
|
+
[5, 19, 13, 17, 12]
|
145
|
+
|
146
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
147
|
+
|
148
|
+
sage: P.level_sets()
|
149
|
+
[[18, 9, 6, 0], [11, 10], [2], [1], [8], [3, 12],
|
150
|
+
[15], [7], [4, 16], [14, 19, 13, 17], [5]]
|
151
|
+
|
152
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
153
|
+
|
154
|
+
sage: linear = P.linear_extension(); linear
|
155
|
+
[18, 9, 11, 6, 10, 0, 2, 1, 8, 3, 15,
|
156
|
+
7, 4, 14, 5, 19, 16, 13, 17, 12]
|
157
|
+
|
158
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
159
|
+
|
160
|
+
sage: level = P.level_sets()
|
161
|
+
sage: bottomhalf = sum([level[i] for i in range(5)], [])
|
162
|
+
sage: B = P.subposet(bottomhalf)
|
163
|
+
sage: B.plot() # not tested
|
164
|
+
|
165
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
166
|
+
|
167
|
+
sage: Pdual = P.dual()
|
168
|
+
sage: Pdual.plot() # not tested
|
169
|
+
|
170
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
171
|
+
|
172
|
+
sage: Ddual = D.dual()
|
173
|
+
sage: Ddual.plot() # not tested
|
174
|
+
|
175
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
176
|
+
|
177
|
+
sage: P = Posets.AntichainPoset(8)
|
178
|
+
sage: P.is_lattice()
|
179
|
+
False
|
180
|
+
|
181
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
182
|
+
|
183
|
+
sage: LatticePoset(P)
|
184
|
+
Traceback (most recent call last):
|
185
|
+
...
|
186
|
+
ValueError: not a meet-semilattice: no bottom element
|
187
|
+
|
188
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
189
|
+
|
190
|
+
sage: CP = Posets.IntegerCompositions(5)
|
191
|
+
sage: C = LatticePoset(CP)
|
192
|
+
sage: C.plot() # not tested
|
193
|
+
|
194
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
195
|
+
|
196
|
+
sage: par = C.an_element().parent()
|
197
|
+
sage: a = par([1, 1, 1, 2])
|
198
|
+
sage: b = par([2, 1, 1, 1])
|
199
|
+
sage: a, b
|
200
|
+
([1, 1, 1, 2], [2, 1, 1, 1])
|
201
|
+
|
202
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
203
|
+
|
204
|
+
sage: C.meet(a, b)
|
205
|
+
[2, 1, 2]
|
206
|
+
|
207
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
208
|
+
|
209
|
+
sage: c = par([1, 4])
|
210
|
+
sage: d = par([2, 3])
|
211
|
+
sage: c, d
|
212
|
+
([1, 4], [2, 3])
|
213
|
+
|
214
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
215
|
+
|
216
|
+
sage: C.join(c, d)
|
217
|
+
[1, 1, 3]
|
218
|
+
|
219
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
220
|
+
|
221
|
+
sage: C.is_distributive()
|
222
|
+
True
|
223
|
+
|
224
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
225
|
+
|
226
|
+
sage: C.top()
|
227
|
+
[1, 1, 1, 1, 1]
|
228
|
+
|
229
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
230
|
+
|
231
|
+
sage: C.bottom()
|
232
|
+
[5]
|
233
|
+
|
234
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
235
|
+
|
236
|
+
sage: comp = C.complements()
|
237
|
+
sage: comp[par([1, 1, 1, 2])]
|
238
|
+
[[4, 1]]
|
239
|
+
|
240
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
241
|
+
|
242
|
+
sage: comp # not tested
|
243
|
+
{[1, 1, 1, 1, 1]: [[5]],
|
244
|
+
[1, 1, 1, 2]: [[4, 1]],
|
245
|
+
[1, 1, 2, 1]: [[3, 2]],
|
246
|
+
[1, 1, 3]: [[3, 1, 1]],
|
247
|
+
[1, 2, 1, 1]: [[2, 3]],
|
248
|
+
[1, 2, 2]: [[2, 2, 1]],
|
249
|
+
[1, 3, 1]: [[2, 1, 2]],
|
250
|
+
[1, 4]: [[2, 1, 1, 1]],
|
251
|
+
[2, 1, 1, 1]: [[1, 4]],
|
252
|
+
[2, 1, 2]: [[1, 3, 1]],
|
253
|
+
[2, 2, 1]: [[1, 2, 2]],
|
254
|
+
[2, 3]: [[1, 2, 1, 1]],
|
255
|
+
[3, 1, 1]: [[1, 1, 3]],
|
256
|
+
[3, 2]: [[1, 1, 2, 1]],
|
257
|
+
[4, 1]: [[1, 1, 1, 2]],
|
258
|
+
[5]: [[1, 1, 1, 1, 1]]}
|
259
|
+
|
260
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
261
|
+
|
262
|
+
sage: [len(e[1]) for e in comp.items()]
|
263
|
+
[1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1]
|
264
|
+
|
265
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
266
|
+
|
267
|
+
sage: C.is_complemented()
|
268
|
+
True
|
269
|
+
"""
|
@@ -0,0 +1,87 @@
|
|
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 6.6 Sage Exercises
|
39
|
+
##
|
40
|
+
r"""
|
41
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
42
|
+
|
43
|
+
sage: a = 5
|
44
|
+
sage: b = 10
|
45
|
+
sage: c = 6
|
46
|
+
sage: d = 13
|
47
|
+
sage: a.divides(b)
|
48
|
+
True
|
49
|
+
|
50
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
51
|
+
|
52
|
+
sage: not (b in [c,d])
|
53
|
+
True
|
54
|
+
|
55
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
56
|
+
|
57
|
+
sage: a.divides(b) and not (b in [c,d])
|
58
|
+
True
|
59
|
+
|
60
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
61
|
+
|
62
|
+
sage: a = 20
|
63
|
+
sage: b = 6
|
64
|
+
sage: a.mod(b)
|
65
|
+
2
|
66
|
+
|
67
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
68
|
+
|
69
|
+
sage: prime_range(50, 100)
|
70
|
+
[53, 59, 61, 67, 71, 73, 79, 83, 89, 97]
|
71
|
+
|
72
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
73
|
+
|
74
|
+
sage: all([True, True, True, True])
|
75
|
+
True
|
76
|
+
|
77
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
78
|
+
|
79
|
+
sage: all([True, True, False, True])
|
80
|
+
False
|
81
|
+
|
82
|
+
~~~~~~~~~~~~~~~~~~~~~~ ::
|
83
|
+
|
84
|
+
sage: [a/b for a in srange(9) for b in srange(1,a) if gcd(a,b)==1]
|
85
|
+
[2, 3, 3/2, 4, 4/3, 5, 5/2, 5/3, 5/4, 6, 6/5,
|
86
|
+
7, 7/2, 7/3, 7/4, 7/5, 7/6, 8, 8/3, 8/5, 8/7]
|
87
|
+
"""
|