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.
Files changed (96) hide show
  1. passagemath_repl-10.5.30.data/data/share/jupyter/kernels/sagemath/kernel.json +1 -0
  2. passagemath_repl-10.5.30.data/data/share/jupyter/kernels/sagemath/logo-64x64.png +0 -0
  3. passagemath_repl-10.5.30.data/data/share/jupyter/kernels/sagemath/logo.svg +352 -0
  4. {passagemath_repl-10.5.28.dist-info → passagemath_repl-10.5.30.dist-info}/METADATA +3 -3
  5. {passagemath_repl-10.5.28.dist-info → passagemath_repl-10.5.30.dist-info}/RECORD +95 -24
  6. {passagemath_repl-10.5.28.dist-info → passagemath_repl-10.5.30.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 +550 -0
  13. sage/tests/books/computational-mathematics-with-sagemath/combinat_doctest.py +1054 -0
  14. sage/tests/books/computational-mathematics-with-sagemath/domaines_doctest.py +444 -0
  15. sage/tests/books/computational-mathematics-with-sagemath/float_doctest.py +478 -0
  16. sage/tests/books/computational-mathematics-with-sagemath/graphique_doctest.py +255 -0
  17. sage/tests/books/computational-mathematics-with-sagemath/graphtheory_doctest.py +419 -0
  18. sage/tests/books/computational-mathematics-with-sagemath/integration_doctest.py +291 -0
  19. sage/tests/books/computational-mathematics-with-sagemath/linalg_doctest.py +455 -0
  20. sage/tests/books/computational-mathematics-with-sagemath/linsolve_doctest.py +422 -0
  21. sage/tests/books/computational-mathematics-with-sagemath/lp_doctest.py +235 -0
  22. sage/tests/books/computational-mathematics-with-sagemath/mpoly_doctest.py +561 -0
  23. sage/tests/books/computational-mathematics-with-sagemath/nonlinear_doctest.py +491 -0
  24. sage/tests/books/computational-mathematics-with-sagemath/numbertheory_doctest.py +156 -0
  25. sage/tests/books/computational-mathematics-with-sagemath/polynomes_doctest.py +406 -0
  26. sage/tests/books/computational-mathematics-with-sagemath/premierspas_doctest.py +181 -0
  27. sage/tests/books/computational-mathematics-with-sagemath/programmation_doctest.py +663 -0
  28. sage/tests/books/computational-mathematics-with-sagemath/recequadiff_doctest.py +393 -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 +265 -0
  31. sage/tests/books/computational-mathematics-with-sagemath/sol/combinat_doctest.py +218 -0
  32. sage/tests/books/computational-mathematics-with-sagemath/sol/domaines_doctest.py +60 -0
  33. sage/tests/books/computational-mathematics-with-sagemath/sol/float_doctest.py +142 -0
  34. sage/tests/books/computational-mathematics-with-sagemath/sol/graphique_doctest.py +106 -0
  35. sage/tests/books/computational-mathematics-with-sagemath/sol/graphtheory_doctest.py +54 -0
  36. sage/tests/books/computational-mathematics-with-sagemath/sol/integration_doctest.py +57 -0
  37. sage/tests/books/computational-mathematics-with-sagemath/sol/linalg_doctest.py +57 -0
  38. sage/tests/books/computational-mathematics-with-sagemath/sol/linsolve_doctest.py +26 -0
  39. sage/tests/books/computational-mathematics-with-sagemath/sol/lp_doctest.py +48 -0
  40. sage/tests/books/computational-mathematics-with-sagemath/sol/mpoly_doctest.py +116 -0
  41. sage/tests/books/computational-mathematics-with-sagemath/sol/nonlinear_doctest.py +112 -0
  42. sage/tests/books/computational-mathematics-with-sagemath/sol/numbertheory_doctest.py +168 -0
  43. sage/tests/books/computational-mathematics-with-sagemath/sol/polynomes_doctest.py +108 -0
  44. sage/tests/books/computational-mathematics-with-sagemath/sol/recequadiff_doctest.py +59 -0
  45. sage/tests/books/judson-abstract-algebra/__init__.py +1 -0
  46. sage/tests/books/judson-abstract-algebra/actions-sage-exercises.py +52 -0
  47. sage/tests/books/judson-abstract-algebra/actions-sage.py +174 -0
  48. sage/tests/books/judson-abstract-algebra/algcodes-sage.py +131 -0
  49. sage/tests/books/judson-abstract-algebra/boolean-sage.py +270 -0
  50. sage/tests/books/judson-abstract-algebra/cosets-sage-exercises.py +88 -0
  51. sage/tests/books/judson-abstract-algebra/cosets-sage.py +171 -0
  52. sage/tests/books/judson-abstract-algebra/crypt-sage.py +152 -0
  53. sage/tests/books/judson-abstract-algebra/cyclic-sage.py +451 -0
  54. sage/tests/books/judson-abstract-algebra/domains-sage.py +164 -0
  55. sage/tests/books/judson-abstract-algebra/fields-sage.py +300 -0
  56. sage/tests/books/judson-abstract-algebra/finite-sage.py +109 -0
  57. sage/tests/books/judson-abstract-algebra/galois-sage.py +485 -0
  58. sage/tests/books/judson-abstract-algebra/groups-sage.py +281 -0
  59. sage/tests/books/judson-abstract-algebra/homomorph-sage-exercises.py +66 -0
  60. sage/tests/books/judson-abstract-algebra/homomorph-sage.py +201 -0
  61. sage/tests/books/judson-abstract-algebra/integers-sage.py +198 -0
  62. sage/tests/books/judson-abstract-algebra/isomorph-sage.py +173 -0
  63. sage/tests/books/judson-abstract-algebra/normal-sage.py +134 -0
  64. sage/tests/books/judson-abstract-algebra/permute-sage.py +320 -0
  65. sage/tests/books/judson-abstract-algebra/poly-sage.py +301 -0
  66. sage/tests/books/judson-abstract-algebra/rings-sage.py +414 -0
  67. sage/tests/books/judson-abstract-algebra/sets-sage.py +164 -0
  68. sage/tests/books/judson-abstract-algebra/struct-sage.py +64 -0
  69. sage/tests/books/judson-abstract-algebra/sylow-sage.py +251 -0
  70. sage/tests/books/judson-abstract-algebra/vect-sage-exercises.py +49 -0
  71. sage/tests/books/judson-abstract-algebra/vect-sage.py +212 -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.28.data → passagemath_repl-10.5.30.data}/scripts/sage-cachegrind +0 -0
  79. {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-callgrind +0 -0
  80. {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-cleaner +0 -0
  81. {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-coverage +0 -0
  82. {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-eval +0 -0
  83. {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-fixdoctests +0 -0
  84. {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-inline-fortran +0 -0
  85. {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-ipynb2rst +0 -0
  86. {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-ipython +0 -0
  87. {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-massif +0 -0
  88. {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-notebook +0 -0
  89. {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-omega +0 -0
  90. {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-preparse +0 -0
  91. {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-run +0 -0
  92. {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-run-cython +0 -0
  93. {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-runtests +0 -0
  94. {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-startuptime.py +0 -0
  95. {passagemath_repl-10.5.28.data → passagemath_repl-10.5.30.data}/scripts/sage-valgrind +0 -0
  96. {passagemath_repl-10.5.28.dist-info → passagemath_repl-10.5.30.dist-info}/WHEEL +0 -0
@@ -0,0 +1,218 @@
1
+ # sage_setup: distribution = sagemath-repl
2
+ # sage.doctest: needs sage.combinat sage.graphs sage.modules
3
+ """
4
+ This file (./sol/combinat_doctest.sage) was *autogenerated* from ./sol/combinat.tex,
5
+ with sagetex.sty version 2011/05/27 v2.3.1.
6
+ It contains the contents of all the sageexample environments from this file.
7
+ You should be able to doctest this file with:
8
+ sage -t ./sol/combinat_doctest.sage
9
+ It is always safe to delete this file; it is not used in typesetting your
10
+ document.
11
+
12
+ Sage example in ./sol/combinat.tex, line 15::
13
+
14
+ sage: Suits = FiniteEnumeratedSet(
15
+ ....: ["Hearts", "Diamonds", "Spades", "Clubs"])
16
+ sage: Values = FiniteEnumeratedSet([2, 3, 4, 5, 6, 7, 8, 9, 10,
17
+ ....: "Jack", "Queen", "King", "Ace"])
18
+ sage: FourOfaKind = cartesian_product([Arrangements(Values,2), Suits])
19
+
20
+ Sage example in ./sol/combinat.tex, line 34::
21
+
22
+ sage: FourOfaKind.list()
23
+ [([2, 3], 'Hearts'),
24
+ ([2, 3], 'Diamonds'),
25
+ ...
26
+ (['Ace', 'King'], 'Clubs')]
27
+
28
+ Sage example in ./sol/combinat.tex, line 51::
29
+
30
+ sage: FourOfaKind.cardinality()
31
+ 624
32
+
33
+ Sage example in ./sol/combinat.tex, line 66::
34
+
35
+ sage: Cards = cartesian_product([Values, Suits])
36
+ sage: Hands = Subsets(Cards, 5)
37
+ sage: FourOfaKind.cardinality() / Hands.cardinality()
38
+ 1/4165
39
+
40
+ Sage example in ./sol/combinat.tex, line 86::
41
+
42
+ sage: StraightFlush = cartesian_product([range(1, 11), Suits])
43
+ sage: StraightFlush.cardinality()
44
+ 40
45
+
46
+ Sage example in ./sol/combinat.tex, line 98::
47
+
48
+ sage: AllFlush = cartesian_product([Subsets(Values,5),Suits])
49
+ sage: AllFlush.cardinality() - StraightFlush.cardinality()
50
+ 5108
51
+
52
+ Sage example in ./sol/combinat.tex, line 113::
53
+
54
+ sage: _ / Hands.cardinality()
55
+ 1277/649740
56
+ sage: float(_)
57
+ 0.001965401545233478
58
+
59
+ Sage example in ./sol/combinat.tex, line 153::
60
+
61
+ sage: Word(['a','b','b','a','a','b','a']).evaluation_dict()
62
+ {'a': 4, 'b': 3}
63
+
64
+ Sage example in ./sol/combinat.tex, line 170::
65
+
66
+ sage: def is_full_hand(hand):
67
+ ....: suits = Word([value for (value, suit) in hand])
68
+ ....: repetitions = sorted(suits.evaluation_dict().values())
69
+ ....: return repetitions == [2,3]
70
+ sage: is_full_hand({(5, 'Diamonds'), (6, 'Diamonds'), (6, 'Hearts'),
71
+ ....: (5, 'Spades'), (1, 'Spades')})
72
+ False
73
+ sage: is_full_hand({(3, 'Clubs'), (3, 'Spades'), (3, 'Hearts'),
74
+ ....: (2, 'Clubs'), (2, 'Spades')})
75
+ True
76
+
77
+ Sage example in ./sol/combinat.tex, line 200::
78
+
79
+ sage: def estimate_proportion(S, predicate, n):
80
+ ....: count = 0
81
+ ....: for i in range(n):
82
+ ....: if predicate(S.random_element()):
83
+ ....: count += 1
84
+ ....: return count/n
85
+
86
+ Sage example in ./sol/combinat.tex, line 212::
87
+
88
+ sage: float(estimate_proportion(Hands, is_full_hand, 10000)) # random
89
+ 0.0014
90
+
91
+ Sage example in ./sol/combinat.tex, line 229::
92
+
93
+ sage: FullHands = cartesian_product([Arrangements(Values, 2),
94
+ ....: Subsets(Suits, 3), Subsets(Suits, 2)])
95
+
96
+ Sage example in ./sol/combinat.tex, line 242::
97
+
98
+ sage: [sorted(v) for v in FullHands.first()]
99
+ [[2, 3], ['Diamonds', 'Hearts', 'Spades'], ['Diamonds', 'Hearts']]
100
+
101
+ Sage example in ./sol/combinat.tex, line 252::
102
+
103
+ sage: float(FullHands.cardinality() / Hands.cardinality())
104
+ 0.0014405762304921968
105
+
106
+ Sage example in ./sol/combinat.tex, line 312::
107
+
108
+ sage: C = Compositions(5,length=3)
109
+ sage: C.cardinality
110
+ <bound method ..._cardinality_from_iterator ...>
111
+
112
+ Sage example in ./sol/combinat.tex, line 322::
113
+
114
+ sage: IntegerVectors(5,3).list()
115
+ [[5, 0, 0], [4, 1, 0], [4, 0, 1], [3, 2, 0], [3, 1, 1], [3, 0, 2],
116
+ ...
117
+ [0, 4, 1], [0, 3, 2], [0, 2, 3], [0, 1, 4], [0, 0, 5]]
118
+
119
+ Sage example in ./sol/combinat.tex, line 328::
120
+
121
+ sage: OrderedSetPartitions(3).cardinality()
122
+ 13
123
+ sage: OrderedSetPartitions(3).list()
124
+ [[{1}, {2}, {3}], [{1}, {3}, {2}], [{2}, {1}, {3}], [{3}, {1}, {2}],
125
+ ...
126
+ [{1, 2}, {3}], [{1, 3}, {2}], [{2, 3}, {1}], [{1, 2, 3}]]
127
+ sage: OrderedSetPartitions(3,2).random_element() # random
128
+ [{1, 3}, {2}]
129
+
130
+ Sage example in ./sol/combinat.tex, line 338::
131
+
132
+ sage: StandardTableaux([3,2]).cardinality()
133
+ 5
134
+ sage: StandardTableaux([3,2]).an_element()
135
+ [[1, 3, 5], [2, 4]]
136
+
137
+ Sage example in ./sol/combinat.tex, line 350::
138
+
139
+ sage: list(AlternatingSignMatrices(1))
140
+ [[1]]
141
+ sage: list(AlternatingSignMatrices(2))
142
+ [
143
+ [1 0] [0 1]
144
+ [0 1], [1 0]
145
+ ]
146
+
147
+ Sage example in ./sol/combinat.tex, line 361::
148
+
149
+ sage: list(AlternatingSignMatrices(3))
150
+ [
151
+ [1 0 0] [0 1 0] [1 0 0] [ 0 1 0] [0 0 1] [0 1 0] [0 0 1]
152
+ [0 1 0] [1 0 0] [0 0 1] [ 1 -1 1] [1 0 0] [0 0 1] [0 1 0]
153
+ [0 0 1], [0 0 1], [0 1 0], [ 0 1 0], [0 1 0], [1 0 0], [1 0 0]
154
+ ]
155
+
156
+ Sage example in ./sol/combinat.tex, line 383::
157
+
158
+ sage: GF(2)^5
159
+ Vector space of dimension 5 over Finite Field of size 2
160
+ sage: _.cardinality()
161
+ 32
162
+
163
+ Sage example in ./sol/combinat.tex, line 400::
164
+
165
+ sage: (2^3-2^0)*(2^3-2^1)*(2^3-2^2)
166
+ 168
167
+
168
+ Sage example in ./sol/combinat.tex, line 406::
169
+
170
+ sage: GL(3,2)
171
+ General Linear Group of degree 3 over Finite Field of size 2
172
+ sage: _.cardinality()
173
+ 168
174
+
175
+ Sage example in ./sol/combinat.tex, line 423::
176
+
177
+ sage: from sage.combinat.q_analogues import q_factorial
178
+ sage: q = 2; n = 3
179
+ sage: q^(n*(n-1)/2) * (q-1)^n * q_factorial(n,q)
180
+ 168
181
+ sage: q = 3; n = 5
182
+ sage: GL(n, q).cardinality()
183
+ 475566474240
184
+ sage: q^(n*(n-1)/2) * (q-1)^n * q_factorial(n,q)
185
+ 475566474240
186
+
187
+ Sage example in ./sol/combinat.tex, line 537::
188
+
189
+ sage: def C(n):
190
+ ....: if n == 1:
191
+ ....: yield BinaryTree()
192
+ ....: elif n > 1:
193
+ ....: for k in range(1,n):
194
+ ....: for t1 in C(k):
195
+ ....: for t2 in C(n-k):
196
+ ....: yield BinaryTree([t1,t2])
197
+
198
+ Sage example in ./sol/combinat.tex, line 549::
199
+
200
+ sage: list(C(1))
201
+ [.]
202
+ sage: list(C(2))
203
+ [[., .]]
204
+ sage: list(C(3))
205
+ [[., [., .]],
206
+ [[., .], .]]
207
+ sage: list(C(4))
208
+ [[., [., [., .]]],
209
+ [., [[., .], .]],
210
+ [[., .], [., .]],
211
+ [[., [., .]], .],
212
+ [[[., .], .], .]]
213
+
214
+ Sage example in ./sol/combinat.tex, line 566::
215
+
216
+ sage: [len(list(C(n))) for n in range(9)]
217
+ [0, 1, 1, 2, 5, 14, 42, 132, 429]
218
+ """
@@ -0,0 +1,60 @@
1
+ # sage_setup: distribution = sagemath-repl
2
+ # sage.doctest: needs sage.symbolic
3
+ """
4
+ This file (./sol/domaines_doctest.sage) was *autogenerated* from ./sol/domaines.tex,
5
+ with sagetex.sty version 2011/05/27 v2.3.1.
6
+ It contains the contents of all the sageexample environments from this file.
7
+ You should be able to doctest this file with:
8
+ sage -t ./sol/domaines_doctest.sage
9
+ It is always safe to delete this file; it is not used in typesetting your
10
+ document.
11
+
12
+ Sage example in ./sol/domaines.tex, line 4::
13
+
14
+ sage: def ndigits(x): return x.ndigits()
15
+ sage: o = 720; ndigits(o)
16
+ 3
17
+
18
+ Sage example in ./sol/domaines.tex, line 28::
19
+
20
+ sage: a = Reals(17)(pi); b = Reals(42)(pi)
21
+ sage: type(a) == type(b)
22
+ True
23
+ sage: parent(a), parent(b)
24
+ (Real Field with 17 bits of precision, Real Field with 42 bits of precision)
25
+
26
+ Sage example in ./sol/domaines.tex, line 46::
27
+
28
+ sage: a = 0.1; b = 0.1*1
29
+ sage: type(a), type(b)
30
+ (<... 'sage.rings.real_mpfr.RealLiteral'>, <... 'sage.rings.real_mpfr.RealNumber'>)
31
+ sage: parent(a) == parent(b)
32
+ True
33
+
34
+ Sage example in ./sol/domaines.tex, line 70::
35
+
36
+ sage: Reals(100)(a)-1/10
37
+ 0.00000000000000000000000000000
38
+ sage: Reals(100)(b)-1/10
39
+ 5.5511151231257629805955278152e-18
40
+
41
+ Sage example in ./sol/domaines.tex, line 80::
42
+
43
+ sage: E = CombinatorialFreeModule(QQ, [1,2,3])
44
+ sage: H = Hom(E,E); H.rename('H')
45
+ sage: C = E.category(); C
46
+ Category of finite dimensional vector spaces with basis over Rational Field
47
+ sage: phi1 = E.module_morphism(on_basis=lambda i: E.term(i), codomain=E)
48
+ sage: phi2 = E.module_morphism(on_basis=lambda i: E.term(i),
49
+ ....: triangular='lower', codomain=E)
50
+ sage: phi3 = E.module_morphism(diagonal=lambda i: 1, codomain=E,
51
+ ....: category=C)
52
+ sage: phi1.parent() == phi2.parent() == phi3.parent() == H
53
+ True
54
+ sage: type(phi1)
55
+ <class 'sage.modules.with_basis.morphism.ModuleMorphismByLinearity_with_category'>
56
+ sage: type(phi2)
57
+ <class 'sage.modules.with_basis.morphism.TriangularModuleMorphismByLinearity_with_category'>
58
+ sage: type(phi3)
59
+ <class 'sage.modules.with_basis.morphism.DiagonalModuleMorphism_with_category'>
60
+ """
@@ -0,0 +1,142 @@
1
+ # sage_setup: distribution = sagemath-repl
2
+ # sage.doctest: needs sage.symbolic
3
+ """
4
+ This file (./sol/float_doctest.sage) was *autogenerated* from ./sol/float.tex,
5
+ with sagetex.sty version 2011/05/27 v2.3.1.
6
+ It contains the contents of all the sageexample environments from this file.
7
+ You should be able to doctest this file with:
8
+ sage -t ./sol/float_doctest.sage
9
+ It is always safe to delete this file; it is not used in typesetting your
10
+ document.
11
+
12
+ Sage example in ./sol/float.tex, line 17::
13
+
14
+ sage: R100=RealField(100)
15
+ sage: x=R100(10^30)
16
+ sage: x>2^99
17
+ True
18
+ sage: x<2^100
19
+ True
20
+
21
+ Sage example in ./sol/float.tex, line 48::
22
+
23
+ sage: e=2^100
24
+ sage: s1=10^30
25
+ sage: significand=[]
26
+ sage: nbdigits=0 # number of significant digits
27
+ sage: while s1>0:
28
+ ....: e/=2
29
+ ....: if e<=s1:
30
+ ....: significand.append(1)
31
+ ....: s1-=e
32
+ ....: else:
33
+ ....: significand.append(0)
34
+ ....: nbdigits+=1
35
+ sage: print(significand)
36
+ [1, 1, 0, 0, 1, 0, 0, 1, 1, 1, 1, 1, 0, 0, 1, 0, 1, 1, 0, 0,
37
+ 1, 0, 0, 1, 1, 1, 0, 0, 1, 1, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0,
38
+ 0, 1, 1, 0, 0, 1, 1, 1, 0, 1, 0, 0, 1, 1, 1, 0, 1, 1, 0, 1,
39
+ 1, 1, 1, 0, 1, 0, 1, 0, 0, 1]
40
+ sage: print("number of significant digits: " + str(nbdigits))
41
+ number of significant digits: 70
42
+
43
+ Sage example in ./sol/float.tex, line 86::
44
+
45
+ sage: R100=RealField(100)
46
+ sage: x=R100(10^30)
47
+ sage: s,m,e = x.sign_mantissa_exponent()
48
+ sage: s,m,e
49
+ (1, 1000000000000000000000000000000, 0)
50
+
51
+ Sage example in ./sol/float.tex, line 126::
52
+
53
+ sage: var("u0 u1 u2 alpha beta gamma n")
54
+ (u0, u1, u2, alpha, beta, gamma, n)
55
+ sage: recurrence = lambda a,b: 111-1130/a+3000/(a*b)
56
+ sage: gener1 = lambda n: (alpha*100^n+beta*6^n+gamma*5^n)
57
+ sage: solGen = lambda n: gener1(n+1)/gener1(n)
58
+
59
+ Sage example in ./sol/float.tex, line 137::
60
+
61
+ sage: u2 = recurrence(u1,u0)
62
+ sage: s = [u2==solGen(2),u1==solGen(1),u0==solGen(0)]
63
+ sage: t = [s[i].substitute(u0=2,u1=-4) for i in range(0,3)]
64
+
65
+ Sage example in ./sol/float.tex, line 143::
66
+
67
+ sage: solve(t,alpha,beta,gamma)
68
+ [[alpha == 0, beta == -3/4*r1, gamma == r1]]
69
+
70
+ Sage example in ./sol/float.tex, line 157::
71
+
72
+ sage: alpha=0
73
+ sage: beta = -3/4*gamma
74
+ sage: final=solGen(n)-recurrence(solGen(n-1),solGen(n-2))
75
+ sage: final.simplify_full()
76
+ 0
77
+
78
+ Sage example in ./sol/float.tex, line 179::
79
+
80
+ sage: def recur(x1, x0):
81
+ ....: return 111 - 1130/x1 + 3000/(x0*x1)
82
+
83
+ Sage example in ./sol/float.tex, line 190::
84
+
85
+ sage: u0 = 2.
86
+ sage: u1 = -4.
87
+ sage: for i in range(1,25):
88
+ ....: x = recur(u1,u0)
89
+ ....: print((i, x))
90
+ ....: u0 = u1
91
+ ....: u1 = x
92
+ (1, 18.5000000000000)
93
+ (2, 9.37837837837838)
94
+ (3, 7.80115273775217)
95
+ (4, 7.15441448097533)
96
+ (5, 6.80678473692481)
97
+ (6, 6.59263276872179)
98
+ ..................
99
+ (23, 99.9999986592167)
100
+ (24, 99.9999999193218)
101
+
102
+ Sage example in ./sol/float.tex, line 229::
103
+
104
+ sage: var("x")
105
+ x
106
+ sage: solve(x==recurrence(x,x),x)
107
+ [x == 100, x == 5, x == 6]
108
+
109
+ Sage example in ./sol/float.tex, line 256::
110
+
111
+ sage: RL = RealField(5000)
112
+ sage: u0 = RL(2)
113
+ sage: u1 = RL(-4)
114
+ sage: for i in range(1,2500):
115
+ ....: x = recur(u1,u0)
116
+ ....: u0 = u1
117
+ ....: u1= x
118
+ sage: x
119
+ 100.00000000000000000000000000000000000000000000000000000...
120
+
121
+ Sage example in ./sol/float.tex, line 281::
122
+
123
+ sage: u0 = 2
124
+ sage: u1 = -4
125
+ sage: for i in range(1,2500):
126
+ ....: x = recur(u1,u0)
127
+ ....: u0 = u1
128
+ ....: u1 = x
129
+ sage: float(x)
130
+ 6.0
131
+
132
+ Sage example in ./sol/float.tex, line 325::
133
+
134
+ sage: f = lambda x: x^2
135
+ sage: g = lambda x: x*x
136
+ sage: sage.rings.real_mpfi.printing_style = 'brackets'
137
+ sage: I = RIF(-1,1)
138
+ sage: f(I)
139
+ [0.0000000000000000 .. 1.0000000000000000]
140
+ sage: g(I)
141
+ [-1.0000000000000000 .. 1.0000000000000000]
142
+ """
@@ -0,0 +1,106 @@
1
+ # sage_setup: distribution = sagemath-repl
2
+ # sage.doctest: needs sage.symbolic
3
+ """
4
+ This file (./sol/graphique_doctest.sage) was *autogenerated* from ./sol/graphique.tex,
5
+ with sagetex.sty version 2011/05/27 v2.3.1.
6
+ It contains the contents of all the sageexample environments from this file.
7
+ You should be able to doctest this file with:
8
+ sage -t ./sol/graphique_doctest.sage
9
+ It is always safe to delete this file; it is not used in typesetting your
10
+ document.
11
+
12
+ Sage example in ./sol/graphique.tex, line 3::
13
+
14
+ sage: reset()
15
+
16
+ Sage example in ./sol/graphique.tex, line 10::
17
+
18
+ sage: t = var('t'); liste = [a + cos(t) for a in srange(0, 2, 0.1)]
19
+ sage: g = polar_plot(liste, (t, 0, 2 * pi)); g.show(aspect_ratio = 1)
20
+
21
+ Sage example in ./sol/graphique.tex, line 38::
22
+
23
+ sage: f = lambda x: abs(x**2 - 1/4)
24
+ sage: def liste_pts(u0, n):
25
+ ....: u = u0; liste = [[u0,0]]
26
+ ....: for k in range(n):
27
+ ....: v, u = u, f(u)
28
+ ....: liste.extend([[v,u], [u,u]])
29
+ ....: return(liste)
30
+ sage: g = line(liste_pts(1.1, 8), rgbcolor = (.9,0,0))
31
+ sage: g += line(liste_pts(-.4, 8), rgbcolor = (.01,0,0))
32
+ sage: g += line(liste_pts(1.3, 3), rgbcolor = (.5,0,0))
33
+ sage: g += plot(f, -1, 3, rgbcolor = 'blue')
34
+ sage: g += plot(x, -1, 3, rgbcolor = 'green')
35
+ sage: g.show(aspect_ratio = 1, ymin = -.2, ymax = 3)
36
+
37
+ Sage example in ./sol/graphique.tex, line 78::
38
+
39
+ sage: x = var('x'); y = function('y')
40
+ sage: DE = x^2 * diff(y(x), x) - y(x) == 0
41
+ sage: desolve(DE, y(x))
42
+ _C*e^(-1/x)
43
+ sage: g = plot([c*e^(-1/x) for c in srange(-8, 8, 0.4)], (x, -3, 3))
44
+ sage: y = var('y')
45
+ sage: g += plot_vector_field((x^2, y), (x,-3,3), (y,-5,5))
46
+ sage: g.show() # not tested, known bug, see :issue:`32657`
47
+
48
+ Sage example in ./sol/graphique.tex, line 124::
49
+
50
+ sage: from sage.calculus.desolvers import desolve_system_rk4
51
+ sage: f = lambda x, y: [a*x-b*x*y,-c*y+d*b*x*y]
52
+ sage: x, y, t = var('x, y, t')
53
+ sage: a, b, c, d = 1., 0.1, 1.5, 0.75
54
+ sage: P = desolve_system_rk4(f(x,y), [x,y],\
55
+ ....: ics=[0,10,5], ivar=t, end_points=15)
56
+ sage: Ql = [[i,j] for i,j,k in P]; p = line(Ql, color='red')
57
+ sage: p += text("Rabbits", (12,37), fontsize=10, color='red')
58
+ sage: Qr = [[i,k] for i,j,k in P]; p += line(Qr, color='blue')
59
+ sage: p += text("Foxes", (12,7), fontsize=10, color='blue')
60
+ sage: p.axes_labels(["time", "population"])
61
+ sage: p.show(gridlines = True)
62
+
63
+ Sage example in ./sol/graphique.tex, line 154::
64
+
65
+ sage: n = 10; L = srange(6, 18, 12 / n); R = srange(3, 9, 6 / n)
66
+ sage: def g(x, y): v = vector(f(x, y)); return v / v.norm()
67
+ sage: q = plot_vector_field(g(x, y), (x, 0, 60), (y, 0, 36))
68
+ sage: for j in range(n):
69
+ ....: P = desolve_system_rk4(f(x,y), [x,y],
70
+ ....: ics=[0,L[j],R[j]], ivar=t, end_points=15)
71
+ ....: Q = [[j,k] for i,j,k in P]
72
+ ....: q += line(Q, color=hue(.8-j/(2*n)))
73
+ sage: q.axes_labels(["rabbits", "foxes"]); q.show()
74
+
75
+ Sage example in ./sol/graphique.tex, line 185::
76
+
77
+ sage: from scipy import integrate
78
+ sage: def dX_dt(X, t=0): return [X[1], 0.5*X[1] - X[0] - X[1]^3]
79
+ sage: t = srange(0, 40, 0.01); x0 = srange(-2, 2, 0.1); y0 = 2.5
80
+ sage: CI = [[i, y0] for i in x0] + [[i, -y0] for i in x0]
81
+ sage: def g(x, y): v = vector(dX_dt([x, y])); return v / v.norm()
82
+ sage: x, y = var('x, y'); n = len(CI)
83
+ sage: q = plot_vector_field(g(x, y), (x, -3, 3), (y, -y0, y0))
84
+ sage: for j in range(n): # long time
85
+ ....: X = integrate.odeint(dX_dt, CI[j], t)
86
+ ....: q += line(X, color=(1.7*j/(4*n),1.5*j/(4*n),1-3*j/(8*n)))
87
+ sage: X = integrate.odeint(dX_dt, [0.01,0], t)
88
+ sage: q += line(X, color = 'red'); q.show()
89
+
90
+ Sage example in ./sol/graphique.tex, line 234::
91
+
92
+ sage: from scipy import integrate
93
+ sage: t = srange(0, 40, 0.2)
94
+ sage: n = 35; CI_cart = [[4, .2 * i] for i in range(n)]
95
+ sage: CI = list(map(lambda x: [sqrt(x[0]^2+x[1]^2),
96
+ ....: pi - arctan(x[1]/x[0])], CI_cart))
97
+ sage: for alpha in [0.1, 0.5, 1, 1.25]: # long time
98
+ ....: dX_dt = lambda X, t=0: [cos(X[1])*(1-1/X[0]^2),
99
+ ....: -sin(X[1]) * (1/X[0]+1/X[0]^3) + 2*alpha/X[0]^2]
100
+ ....: q = circle((0, 0), 1, fill=True, rgbcolor='purple')
101
+ ....: for j in range(n):
102
+ ....: X = integrate.odeint(dX_dt, CI[j], t)
103
+ ....: Y = [[u[0]*cos(u[1]), u[0]*sin(u[1])] for u in X]
104
+ ....: q += line(Y, xmin = -4, xmax = 4, color='blue')
105
+ ....: q.show(aspect_ratio = 1, axes = False)
106
+ """
@@ -0,0 +1,54 @@
1
+ # sage_setup: distribution = sagemath-repl
2
+ # sage.doctest: needs sage.graphs
3
+ """
4
+ This file (./sol/graphtheory_doctest.sage) was *autogenerated* from ./sol/graphtheory.tex,
5
+ with sagetex.sty version 2011/05/27 v2.3.1.
6
+ It contains the contents of all the sageexample environments from this file.
7
+ You should be able to doctest this file with:
8
+ sage -t ./sol/graphtheory_doctest.sage
9
+ It is always safe to delete this file; it is not used in typesetting your
10
+ document.
11
+
12
+ Sage example in ./sol/graphtheory.tex, line 5::
13
+
14
+ sage: def circulant(n, d):
15
+ ....: g = Graph(n)
16
+ ....: for u in range(n):
17
+ ....: for c in range(d):
18
+ ....: g.add_edge(u,(u+c)%n)
19
+ ....: return g
20
+
21
+ Sage example in ./sol/graphtheory.tex, line 19::
22
+
23
+ sage: def kneser(n, k):
24
+ ....: g = Graph()
25
+ ....: g.add_vertices(Subsets(n,k))
26
+ ....: for u in g:
27
+ ....: for v in g:
28
+ ....: if not u & v:
29
+ ....: g.add_edge(u,v)
30
+ ....: return g
31
+
32
+ Sage example in ./sol/graphtheory.tex, line 33::
33
+
34
+ sage: def kneser(n, k):
35
+ ....: g = Graph()
36
+ ....: sommets = Set(range(n))
37
+ ....: g.add_vertices(Subsets(sommets,k))
38
+ ....: for u in g:
39
+ ....: for v in Subsets(sommets - u,k):
40
+ ....: g.add_edge(u,v)
41
+ ....: return g
42
+
43
+ Sage example in ./sol/graphtheory.tex, line 59::
44
+
45
+ sage: g = graphs.PetersenGraph()
46
+ sage: def optimal_order(g):
47
+ ....: order = []
48
+ ....: for color_class in sorted(g.coloring()):
49
+ ....: for v in color_class:
50
+ ....: order.append(v)
51
+ ....: return order
52
+ sage: optimal_order(g)
53
+ [0, 2, 6, 1, 3, 5, 9, 4, 7, 8]
54
+ """
@@ -0,0 +1,57 @@
1
+ # sage_setup: distribution = sagemath-repl
2
+ # sage.doctest: needs sage.symbolic
3
+ """
4
+ This file (./sol/integration_doctest.sage) was *autogenerated* from ./sol/integration.tex,
5
+ with sagetex.sty version 2011/05/27 v2.3.1.
6
+ It contains the contents of all the sageexample environments from this file.
7
+ You should be able to doctest this file with:
8
+ sage -t ./sol/integration_doctest.sage
9
+ It is always safe to delete this file; it is not used in typesetting your
10
+ document.
11
+
12
+ Sage example in ./sol/integration.tex, line 22::
13
+
14
+ sage: x = var('x')
15
+ sage: def NCRule(n):
16
+ ....: P = prod([x - j for j in range(n)])
17
+ ....: return [integrate(P / (x-i), x, 0, n-1) \
18
+ ....: / (P/(x-i)).subs(x=i) for i in range(n)]
19
+
20
+ Sage example in ./sol/integration.tex, line 35::
21
+
22
+ sage: def QuadNC(f, a, b, n):
23
+ ....: W = NCRule(n)
24
+ ....: ret = 0
25
+ ....: for i in range(n):
26
+ ....: ret += f(a + (b-a)/(n-1)*i) * W[i]
27
+ ....: return (b-a)/(n-1)*ret
28
+
29
+ Sage example in ./sol/integration.tex, line 49::
30
+
31
+ sage: QuadNC(lambda u: 1, 0, 1, 12)
32
+ 1
33
+ sage: N(QuadNC(sin, 0, pi, 10))
34
+ 1.99999989482634
35
+
36
+ Sage example in ./sol/integration.tex, line 59::
37
+
38
+ sage: numerical_integral(x * log(1+x), 0, 1)
39
+ (0.25, 2.7755575615628914e-15)
40
+ sage: N(QuadNC(lambda x: x * log(1+x), 0, 1, 19)) # abs tol 2e-14
41
+ 0.250000000000001
42
+ sage: numerical_integral(sqrt(1-x^2), 0, 1) # abs tol 2e-14
43
+ (0.7853981677264822, 9.042725224536535e-07)
44
+ sage: N(pi/4)
45
+ 0.785398163397448
46
+ sage: N(QuadNC(lambda x: sqrt(1-x^2), 0, 1, 20))
47
+ 0.784586419900198
48
+
49
+ Sage example in ./sol/integration.tex, line 74::
50
+
51
+ sage: [N(QuadNC(lambda x: x * log(1+x), 0, 1, n) - 1/4) # abs tol 3e-16
52
+ ....: for n in [2, 8, 16]]
53
+ [0.0965735902799726, 1.17408932933522e-7, 2.13449050101566e-13]
54
+ sage: [N(QuadNC(lambda x: sqrt(1-x^2), 0, 1, n) - pi/4) # abs tol 1e-13
55
+ ....: for n in [2, 8, 16]]
56
+ [-0.285398163397448, -0.00524656673640445, -0.00125482109302663]
57
+ """
@@ -0,0 +1,57 @@
1
+ # sage_setup: distribution = sagemath-repl
2
+ # sage.doctest: needs numpy sage.libs.pari sage.modules
3
+ """
4
+ This file (./sol/linalg_doctest.sage) was *autogenerated* from ./sol/linalg.tex,
5
+ with sagetex.sty version 2011/05/27 v2.3.1.
6
+ It contains the contents of all the sageexample environments from this file.
7
+ You should be able to doctest this file with:
8
+ sage -t ./sol/linalg_doctest.sage
9
+ It is always safe to delete this file; it is not used in typesetting your
10
+ document.
11
+
12
+ Sage example in ./sol/linalg.tex, line 89::
13
+
14
+ sage: A = matrix(GF(7),[[0,0,3,0,0],[1,0,6,0,0],[0,1,5,0,0],
15
+ ....: [0,0,0,0,5],[0,0,0,1,5]])
16
+ sage: P = A.minpoly(); P
17
+ x^5 + 4*x^4 + 3*x^2 + 3*x + 1
18
+ sage: P.factor()
19
+ (x^2 + 2*x + 2) * (x^3 + 2*x^2 + x + 4)
20
+
21
+ Sage example in ./sol/linalg.tex, line 100::
22
+
23
+ sage: e1 = identity_matrix(GF(7),5)[0]
24
+ sage: e4 = identity_matrix(GF(7),5)[3]
25
+ sage: A.transpose().maxspin(e1)
26
+ [(1, 0, 0, 0, 0), (0, 1, 0, 0, 0), (0, 0, 1, 0, 0)]
27
+ sage: A.transpose().maxspin(e4)
28
+ [(0, 0, 0, 1, 0), (0, 0, 0, 0, 1)]
29
+ sage: A.transpose().maxspin(e1 + e4)
30
+ [(1, 0, 0, 1, 0), (0, 1, 0, 0, 1), (0, 0, 1, 5, 5),
31
+ (3, 6, 5, 4, 2), (1, 5, 3, 3, 0)]
32
+
33
+ Sage example in ./sol/linalg.tex, line 168::
34
+
35
+ sage: def Similar(A, B):
36
+ ....: F1, U1 = A.frobenius_form(2)
37
+ ....: F2, U2 = B.frobenius_form(2)
38
+ ....: if F1 == F2:
39
+ ....: return True, ~U2*U1
40
+ ....: else:
41
+ ....: return False, F1 - F2
42
+ sage: B = matrix(ZZ, [[0,1,4,0,4],[4,-2,0,-4,-2],[0,0,0,2,1],
43
+ ....: [-4,2,2,0,-1],[-4,-2,1,2,0]])
44
+ sage: U = matrix(ZZ, [[3,3,-9,-14,40],[-1,-2,4,2,1],[2,4,-7,-1,-13],
45
+ ....: [-1,0,1,4,-15],[-4,-13,26,8,30]])
46
+ sage: A = (U^-1 * B * U).change_ring(ZZ)
47
+ sage: ok, V = Similar(A, B); ok
48
+ True
49
+ sage: V
50
+ [ 1 2824643/1601680 -6818729/1601680 -43439399/11211760 73108601/11211760]
51
+ [ 0 342591/320336 -695773/320336 -2360063/11211760 -10291875/2242352]
52
+ [ 0 -367393/640672 673091/640672 -888723/4484704 15889341/4484704]
53
+ [ 0 661457/3203360 -565971/3203360 13485411/22423520 -69159661/22423520]
54
+ [ 0 -4846439/3203360 7915157/3203360 -32420037/22423520 285914347/22423520]
55
+ sage: ok, V = Similar(2*A, B); ok
56
+ False
57
+ """