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,405 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-repl
|
2
|
+
"""
|
3
|
+
This file (./polynomes_doctest.sage) was *autogenerated* from ./polynomes.tex,
|
4
|
+
with sagetex.sty version 2011/05/27 v2.3.1.
|
5
|
+
It contains the contents of all the sageexample environments from this file.
|
6
|
+
You should be able to doctest this file with:
|
7
|
+
sage -t ./polynomes_doctest.sage
|
8
|
+
It is always safe to delete this file; it is not used in typesetting your
|
9
|
+
document.
|
10
|
+
|
11
|
+
Sage example in ./polynomes.tex, line 97::
|
12
|
+
|
13
|
+
sage: x = var('x'); p = (2*x+1)*(x+2)*(x^4-1)
|
14
|
+
sage: print("{} is of degree {}".format(p, p.degree(x)))
|
15
|
+
(x^4 - 1)*(2*x + 1)*(x + 2) is of degree 6
|
16
|
+
|
17
|
+
Sage example in ./polynomes.tex, line 123::
|
18
|
+
|
19
|
+
sage: x = polygen(QQ, 'x'); p = (2*x+1)*(x+2)*(x^4-1)
|
20
|
+
sage: print("{} is of degree {}".format(p, p.degree()))
|
21
|
+
2*x^6 + 5*x^5 + 2*x^4 - 2*x^2 - 5*x - 2 is of degree 6
|
22
|
+
|
23
|
+
Sage example in ./polynomes.tex, line 167::
|
24
|
+
|
25
|
+
sage: R = PolynomialRing(QQ, 'x')
|
26
|
+
sage: x = R.gen()
|
27
|
+
|
28
|
+
Sage example in ./polynomes.tex, line 182::
|
29
|
+
|
30
|
+
sage: x.parent()
|
31
|
+
Univariate Polynomial Ring in x over Rational Field
|
32
|
+
|
33
|
+
Sage example in ./polynomes.tex, line 223::
|
34
|
+
|
35
|
+
sage: x = polygen(QQ, 'y'); y = polygen(QQ, 'x')
|
36
|
+
|
37
|
+
Sage example in ./polynomes.tex, line 226::
|
38
|
+
|
39
|
+
sage: x^2 + 1
|
40
|
+
y^2 + 1
|
41
|
+
sage: (y^2 + 1).parent()
|
42
|
+
Univariate Polynomial Ring in x over Rational Field
|
43
|
+
|
44
|
+
Sage example in ./polynomes.tex, line 233::
|
45
|
+
|
46
|
+
sage: Q.<x> = QQ[]; p = x + 1; x = 2; p = p + x
|
47
|
+
|
48
|
+
Sage example in ./polynomes.tex, line 268::
|
49
|
+
|
50
|
+
sage: R.<x,y,z,t> = QQ[]; p = (x+y+z*t)^2
|
51
|
+
sage: p.polynomial(t).reverse()
|
52
|
+
(x^2 + 2*x*y + y^2)*t^2 + (2*x*z + 2*y*z)*t + z^2
|
53
|
+
|
54
|
+
Sage example in ./polynomes.tex, line 281::
|
55
|
+
|
56
|
+
sage: x = polygen(QQ); y = polygen(QQ[x], 'y')
|
57
|
+
sage: p = x^3 + x*y + y + y^2; p
|
58
|
+
y^2 + (x + 1)*y + x^3
|
59
|
+
sage: q = QQ['x,y'](p); q
|
60
|
+
x^3 + x*y + y^2 + y
|
61
|
+
sage: QQ['x']['y'](q)
|
62
|
+
y^2 + (x + 1)*y + x^3
|
63
|
+
|
64
|
+
Sage example in ./polynomes.tex, line 355::
|
65
|
+
|
66
|
+
sage: def rook_polynomial(n, var='x'):
|
67
|
+
....: return ZZ[var]([binomial(n, k)^2 * factorial(k)
|
68
|
+
....: for k in (0..n) ])
|
69
|
+
|
70
|
+
Sage example in ./polynomes.tex, line 452::
|
71
|
+
|
72
|
+
sage: x = polygen(QQ)
|
73
|
+
sage: p = x^2 - 16*x + 3
|
74
|
+
sage: p.factor()
|
75
|
+
x^2 - 16*x + 3
|
76
|
+
sage: p.change_ring(RDF).factor() # abs tol 2e-15
|
77
|
+
(x - 15.810249675906654) * (x - 0.18975032409334563)
|
78
|
+
|
79
|
+
Sage example in ./polynomes.tex, line 476::
|
80
|
+
|
81
|
+
sage: p.change_ring(GF(3))
|
82
|
+
x^2 + 2*x
|
83
|
+
|
84
|
+
Sage example in ./polynomes.tex, line 511::
|
85
|
+
|
86
|
+
sage: QQi.<myI> = QQ[I] # myI is the i of QQi, I that of SR
|
87
|
+
sage: R.<x> = QQi[]; p = (x + 2*myI)^3; p
|
88
|
+
x^3 + 6*I*x^2 - 12*x - 8*I
|
89
|
+
sage: p.map_coefficients(lambda z: z.conjugate())
|
90
|
+
x^3 - 6*I*x^2 - 12*x + 8*I
|
91
|
+
|
92
|
+
Sage example in ./polynomes.tex, line 536::
|
93
|
+
|
94
|
+
sage: list(GF(2)['x'].polynomials(of_degree=2))
|
95
|
+
[x^2, x^2 + 1, x^2 + x, x^2 + x + 1]
|
96
|
+
|
97
|
+
Sage example in ./polynomes.tex, line 551::
|
98
|
+
|
99
|
+
sage: A = QQ['x']
|
100
|
+
sage: A in Rings() and A.is_noetherian()
|
101
|
+
True
|
102
|
+
|
103
|
+
Sage example in ./polynomes.tex, line 559::
|
104
|
+
|
105
|
+
sage: ZZ.is_subring(A)
|
106
|
+
True
|
107
|
+
sage: [n for n in range(20)
|
108
|
+
....: if Integers(n)['x'].is_integral_domain()]
|
109
|
+
[0, 2, 3, 5, 7, 11, 13, 17, 19]
|
110
|
+
|
111
|
+
Sage example in ./polynomes.tex, line 646::
|
112
|
+
|
113
|
+
sage: R.<t> = Integers(42)[]; (t^20-1) % (t^5+8*t+7)
|
114
|
+
22*t^4 + 14*t^3 + 14*t + 6
|
115
|
+
|
116
|
+
Sage example in ./polynomes.tex, line 666::
|
117
|
+
|
118
|
+
sage: ((t^2+t)//t).parent()
|
119
|
+
Univariate Polynomial Ring in t over Ring of integers modulo 42
|
120
|
+
sage: (t^2+t)/t
|
121
|
+
Traceback (most recent call last):
|
122
|
+
...
|
123
|
+
TypeError: unsupported operand parent(s) for /: 'Univariate Polynomial Ring in t over Ring of integers modulo 42' and 'Univariate Polynomial Ring in t over Ring of integers modulo 42'
|
124
|
+
|
125
|
+
Sage example in ./polynomes.tex, line 685::
|
126
|
+
|
127
|
+
sage: x = polygen(QQ); [chebyshev_T(n, x) for n in (0..4)]
|
128
|
+
[1, x, 2*x^2 - 1, 4*x^3 - 3*x, 8*x^4 - 8*x^2 + 1]
|
129
|
+
|
130
|
+
Sage example in ./polynomes.tex, line 712::
|
131
|
+
|
132
|
+
sage: S.<x> = ZZ[]; p = 2*(x^10-1)*(x^8-1)
|
133
|
+
sage: p.gcd(p.derivative())
|
134
|
+
2*x^2 - 2
|
135
|
+
|
136
|
+
Sage example in ./polynomes.tex, line 736::
|
137
|
+
|
138
|
+
sage: R.<x> = QQ[]; p = x^5-1; q = x^3-1
|
139
|
+
sage: print("the gcd is %s = (%s)*p + (%s)*q" % p.xgcd(q))
|
140
|
+
the gcd is x - 1 = (-x)*p + (x^3 + 1)*q
|
141
|
+
|
142
|
+
Sage example in ./polynomes.tex, line 773::
|
143
|
+
|
144
|
+
sage: R.<x> = QQ[]
|
145
|
+
sage: J1 = (x^2 - 2*x + 1, 2*x^2 + x - 3)*R; J1
|
146
|
+
Principal ideal (x - 1) of Univariate Polynomial Ring in x
|
147
|
+
over Rational Field
|
148
|
+
|
149
|
+
Sage example in ./polynomes.tex, line 782::
|
150
|
+
|
151
|
+
sage: J2 = R.ideal(x^5 + 2)
|
152
|
+
sage: ((3*x+5)*J1*J2).reduce(x^10)
|
153
|
+
421/81*x^6 - 502/81*x^5 + 842/81*x - 680/81
|
154
|
+
|
155
|
+
Sage example in ./polynomes.tex, line 800::
|
156
|
+
|
157
|
+
sage: B = R.quo((3*x+5)*J1*J2) # quo automatically names 'xbar' which is
|
158
|
+
sage: B(x^10) # the generator of B image of x
|
159
|
+
421/81*xbar^6 - 502/81*xbar^5 + 842/81*xbar - 680/81
|
160
|
+
sage: B(x^10).lift()
|
161
|
+
421/81*x^6 - 502/81*x^5 + 842/81*x - 680/81
|
162
|
+
|
163
|
+
Sage example in ./polynomes.tex, line 920::
|
164
|
+
|
165
|
+
sage: R.<x> = QQ[]; p = 3*x^2 - 6
|
166
|
+
sage: p.is_irreducible(), p.change_ring(ZZ).is_irreducible()
|
167
|
+
(True, False)
|
168
|
+
|
169
|
+
Sage example in ./polynomes.tex, line 976::
|
170
|
+
|
171
|
+
sage: x = polygen(ZZ); p = 54*x^4+36*x^3-102*x^2-72*x-12
|
172
|
+
sage: p.factor()
|
173
|
+
2 * 3 * (3*x + 1)^2 * (x^2 - 2)
|
174
|
+
|
175
|
+
Sage example in ./polynomes.tex, line 997::
|
176
|
+
|
177
|
+
sage: for A in [QQ, ComplexField(16), GF(5), QQ[sqrt(2)]]:
|
178
|
+
....: print(str(A) + ":")
|
179
|
+
....: print(A['x'](p).factor())
|
180
|
+
Rational Field:
|
181
|
+
(54) * (x + 1/3)^2 * (x^2 - 2)
|
182
|
+
Complex Field with 16 bits of precision:
|
183
|
+
(54.00) * (x - 1.414) * (x + 0.3333)^2 * (x + 1.414)
|
184
|
+
Finite Field of size 5:
|
185
|
+
(4) * (x + 2)^2 * (x^2 + 3)
|
186
|
+
Number Field in sqrt2 with defining polynomial x^2 - 2 with sqrt2 = 1.414213562373095?:
|
187
|
+
(54) * (x - sqrt2) * (x + sqrt2) * (x + 1/3)^2
|
188
|
+
|
189
|
+
Sage example in ./polynomes.tex, line 1100::
|
190
|
+
|
191
|
+
sage: R.<x> = ZZ[]; p = (2*x^2-5*x+2)^2 * (x^4-7); p.roots()
|
192
|
+
[(2, 2)]
|
193
|
+
|
194
|
+
Sage example in ./polynomes.tex, line 1113::
|
195
|
+
|
196
|
+
sage: p.roots(QQ)
|
197
|
+
[(2, 2), (1/2, 2)]
|
198
|
+
sage: p.roots(Zp(19, print_max_terms=3))
|
199
|
+
[(7 + 16*19 + 17*19^2 + ... + O(19^20), 1),
|
200
|
+
(12 + 2*19 + 19^2 + ... + O(19^20), 1),
|
201
|
+
(10 + 9*19 + 9*19^2 + ... + O(19^20), 2),
|
202
|
+
(2 + O(19^20), 2)]
|
203
|
+
|
204
|
+
Sage example in ./polynomes.tex, line 1137::
|
205
|
+
|
206
|
+
sage: roots = p.roots(AA); roots
|
207
|
+
[(-1.626576561697786?, 1), (0.500000000000000?, 2),
|
208
|
+
(1.626576561697786?, 1), (2.000000000000000?, 2)]
|
209
|
+
|
210
|
+
Sage example in ./polynomes.tex, line 1153::
|
211
|
+
|
212
|
+
sage: a = roots[0][0]^4; a.simplify(); a
|
213
|
+
7
|
214
|
+
|
215
|
+
Sage example in ./polynomes.tex, line 1208::
|
216
|
+
|
217
|
+
sage: x = polygen(ZZ); (x-12).resultant(x-20)
|
218
|
+
-8
|
219
|
+
|
220
|
+
Sage example in ./polynomes.tex, line 1295::
|
221
|
+
|
222
|
+
sage: R.<a,b,c,d> = QQ[]; x = polygen(R); p = a*x^2+b*x+c
|
223
|
+
sage: p.resultant(p.derivative())
|
224
|
+
-a*b^2 + 4*a^2*c
|
225
|
+
sage: p.discriminant()
|
226
|
+
b^2 - 4*a*c
|
227
|
+
sage: (a*x^3 + b*x^2 + c*x + d).discriminant()
|
228
|
+
b^2*c^2 - 4*a*c^3 - 4*b^3*d + 18*a*b*c*d - 27*a^2*d^2
|
229
|
+
|
230
|
+
Sage example in ./polynomes.tex, line 1399::
|
231
|
+
|
232
|
+
sage: x = polygen(RR); r = (1 + x)/(1 - x^2); r.parent()
|
233
|
+
Fraction Field of Univariate Polynomial Ring in x over Real
|
234
|
+
Field with 53 bits of precision
|
235
|
+
sage: r
|
236
|
+
(x + 1.00000000000000)/(-x^2 + 1.00000000000000)
|
237
|
+
|
238
|
+
Sage example in ./polynomes.tex, line 1416::
|
239
|
+
|
240
|
+
% for the doctests
|
241
|
+
sage: r.reduce(); repr(r) in ['1.00000000000000/(-x + 1.00000000000000)', '-1.00000000000000/(x - 1.00000000000000)']
|
242
|
+
True
|
243
|
+
|
244
|
+
Sage example in ./polynomes.tex, line 1492::
|
245
|
+
|
246
|
+
sage: R.<x> = QQ[]; r = x^10 / ((x^2-1)^2 * (x^2+3))
|
247
|
+
sage: poly, parts = r.partial_fraction_decomposition()
|
248
|
+
sage: poly
|
249
|
+
x^4 - x^2 + 6
|
250
|
+
sage: for part in parts: part.factor()
|
251
|
+
(17/32) * (x - 1)^-1
|
252
|
+
(1/16) * (x - 1)^-2
|
253
|
+
(-17/32) * (x + 1)^-1
|
254
|
+
(1/16) * (x + 1)^-2
|
255
|
+
(-243/16) * (x^2 + 3)^-1
|
256
|
+
|
257
|
+
Sage example in ./polynomes.tex, line 1531::
|
258
|
+
|
259
|
+
sage: C = ComplexField(15)
|
260
|
+
sage: Frac(C['x'])(r).partial_fraction_decomposition() #abs tol 2e-4
|
261
|
+
(x^4 - x^2 + 6.000, [0.5312/(x - 1.000), 0.06250/(x^2 - 2.000*x + 1.000),
|
262
|
+
4.385*I/(x - 1.732*I), (-4.385*I)/(x + 1.732*I),
|
263
|
+
(-0.5312)/(x + 1.000), 0.06250/(x^2 + 2.000*x + 1.000)])
|
264
|
+
|
265
|
+
Sage example in ./polynomes.tex, line 1600::
|
266
|
+
|
267
|
+
sage: A = Integers(101); R.<x> = A[]
|
268
|
+
sage: f6 = sum( (i+1)^2 * x^i for i in (0..5) ); f6
|
269
|
+
36*x^5 + 25*x^4 + 16*x^3 + 9*x^2 + 4*x + 1
|
270
|
+
sage: num, den = f6.rational_reconstruction(x^6, 1, 3); num/den
|
271
|
+
(100*x + 100)/(x^3 + 98*x^2 + 3*x + 100)
|
272
|
+
|
273
|
+
Sage example in ./polynomes.tex, line 1611::
|
274
|
+
|
275
|
+
sage: S = PowerSeriesRing(A, 'x', 7); S(num)/S(den)
|
276
|
+
1 + 4*x + 9*x^2 + 16*x^3 + 25*x^4 + 36*x^5 + 49*x^6 + O(x^7)
|
277
|
+
|
278
|
+
Sage example in ./polynomes.tex, line 1672::
|
279
|
+
|
280
|
+
sage: x = var('x'); s = tan(x).taylor(x, 0, 20)
|
281
|
+
sage: p = previous_prime(2^30); ZpZx = Integers(p)['x']
|
282
|
+
sage: Qx = QQ['x']
|
283
|
+
|
284
|
+
Sage example in ./polynomes.tex, line 1677::
|
285
|
+
|
286
|
+
sage: num, den = ZpZx(s).rational_reconstruction(ZpZx(x)^10,4,5)
|
287
|
+
sage: num/den
|
288
|
+
(1073741779*x^3 + 105*x)/(x^4 + 1073741744*x^2 + 105)
|
289
|
+
|
290
|
+
Sage example in ./polynomes.tex, line 1685::
|
291
|
+
|
292
|
+
sage: def lift_sym(a):
|
293
|
+
....: m = a.parent().defining_ideal().gen()
|
294
|
+
....: n = a.lift()
|
295
|
+
....: if n <= m // 2: return n
|
296
|
+
....: else: return n - m
|
297
|
+
|
298
|
+
Sage example in ./polynomes.tex, line 1694::
|
299
|
+
|
300
|
+
sage: Qx(list(map(lift_sym, num)))/Qx(list(map(lift_sym, den)))
|
301
|
+
(-10*x^3 + 105*x)/(x^4 - 45*x^2 + 105)
|
302
|
+
|
303
|
+
Sage example in ./polynomes.tex, line 1713::
|
304
|
+
|
305
|
+
sage: def mypade(pol, n, k):
|
306
|
+
....: x = ZpZx.gen();
|
307
|
+
....: n,d = ZpZx(pol).rational_reconstruction(x^n, k-1, n-k)
|
308
|
+
....: return Qx(list(map(lift_sym, n)))/Qx(list(map(lift_sym, d)))
|
309
|
+
|
310
|
+
Sage example in ./polynomes.tex, line 1813::
|
311
|
+
|
312
|
+
sage: R.<x> = PowerSeriesRing(QQ)
|
313
|
+
|
314
|
+
Sage example in ./polynomes.tex, line 1845::
|
315
|
+
|
316
|
+
sage: R.<x> = QQ[[]]
|
317
|
+
sage: f = 1 + x + O(x^2); g = x + 2*x^2 + O(x^4)
|
318
|
+
sage: f + g
|
319
|
+
1 + 2*x + O(x^2)
|
320
|
+
sage: f * g
|
321
|
+
x + 3*x^2 + O(x^3)
|
322
|
+
|
323
|
+
Sage example in ./polynomes.tex, line 1857::
|
324
|
+
|
325
|
+
sage: (1 + x^3).prec()
|
326
|
+
+Infinity
|
327
|
+
|
328
|
+
Sage example in ./polynomes.tex, line 1865::
|
329
|
+
|
330
|
+
sage: R.<x> = PowerSeriesRing(Reals(24), default_prec=4)
|
331
|
+
sage: 1/(1 + RR.pi() * x)^2
|
332
|
+
1.00000 - 6.28319*x + 29.6088*x^2 - 124.025*x^3 + O(x^4)
|
333
|
+
|
334
|
+
Sage example in ./polynomes.tex, line 1877::
|
335
|
+
|
336
|
+
sage: R.<x> = QQ[[]]
|
337
|
+
sage: 1 + x + O(x^2) == 1 + x + x^2 + O(x^3)
|
338
|
+
True
|
339
|
+
|
340
|
+
Sage example in ./polynomes.tex, line 1893::
|
341
|
+
|
342
|
+
sage: (1/(1+x)).sqrt().integral().exp() / x^2 + O(x^4)
|
343
|
+
x^-2 + x^-1 + 1/4 + 1/24*x - 1/192*x^2 + 11/1920*x^3 + O(x^4)
|
344
|
+
|
345
|
+
Sage example in ./polynomes.tex, line 1940::
|
346
|
+
|
347
|
+
sage: (1+x^2).sqrt().solve_linear_de(prec=6, b=x.exp())
|
348
|
+
1 + 2*x + 3/2*x^2 + 5/6*x^3 + 1/2*x^4 + 7/30*x^5 + O(x^6)
|
349
|
+
|
350
|
+
Sage example in ./polynomes.tex, line 1957::
|
351
|
+
|
352
|
+
sage: S.<x> = PowerSeriesRing(QQ, default_prec=5)
|
353
|
+
sage: f = S(1)
|
354
|
+
sage: for i in range(5):
|
355
|
+
....: f = (x*f).exp()
|
356
|
+
....: print(f)
|
357
|
+
1 + x + 1/2*x^2 + 1/6*x^3 + 1/24*x^4 + O(x^5)
|
358
|
+
1 + x + 3/2*x^2 + 5/3*x^3 + 41/24*x^4 + O(x^5)
|
359
|
+
1 + x + 3/2*x^2 + 8/3*x^3 + 101/24*x^4 + O(x^5)
|
360
|
+
1 + x + 3/2*x^2 + 8/3*x^3 + 125/24*x^4 + O(x^5)
|
361
|
+
1 + x + 3/2*x^2 + 8/3*x^3 + 125/24*x^4 + O(x^5)
|
362
|
+
|
363
|
+
Sage example in ./polynomes.tex, line 2028::
|
364
|
+
|
365
|
+
sage: L.<x> = LazyPowerSeriesRing(QQ)
|
366
|
+
sage: lazy_exp = x.exp(); lazy_exp
|
367
|
+
1 + x + 1/2*x^2 + 1/6*x^3 + 1/24*x^4 + 1/120*x^5 + 1/720*x^6 + O(x^7)
|
368
|
+
|
369
|
+
Sage example in ./polynomes.tex, line 2039::
|
370
|
+
|
371
|
+
sage: lazy_exp[5]
|
372
|
+
1/120
|
373
|
+
sage: lazy_exp
|
374
|
+
1 + x + 1/2*x^2 + 1/6*x^3 + 1/24*x^4 + 1/120*x^5 + 1/720*x^6 + O(x^7)
|
375
|
+
|
376
|
+
Sage example in ./polynomes.tex, line 2062::
|
377
|
+
|
378
|
+
sage: f = L(1) # the constant lazy series 1
|
379
|
+
sage: for i in range(5):
|
380
|
+
....: f = (x*f).exp()
|
381
|
+
....: print(f) # of the first coefficients
|
382
|
+
1 + x + 1/2*x^2 + 1/6*x^3 + 1/24*x^4 + 1/120*x^5 + 1/720*x^6 + O(x^7)
|
383
|
+
1 + x + 3/2*x^2 + 5/3*x^3 + 41/24*x^4 + 49/30*x^5 + 1057/720*x^6 + O(x^7)
|
384
|
+
1 + x + 3/2*x^2 + 8/3*x^3 + 101/24*x^4 + 63/10*x^5 + 6607/720*x^6 + O(x^7)
|
385
|
+
1 + x + 3/2*x^2 + 8/3*x^3 + 125/24*x^4 + 49/5*x^5 + 12847/720*x^6 + O(x^7)
|
386
|
+
1 + x + 3/2*x^2 + 8/3*x^3 + 125/24*x^4 + 54/5*x^5 + 16087/720*x^6 + O(x^7)
|
387
|
+
|
388
|
+
Sage example in ./polynomes.tex, line 2091::
|
389
|
+
|
390
|
+
sage: f[7]
|
391
|
+
28673/630
|
392
|
+
|
393
|
+
Sage example in ./polynomes.tex, line 2105::
|
394
|
+
|
395
|
+
sage: f = L.undefined(valuation=0)
|
396
|
+
sage: f.define((x*f).exp())
|
397
|
+
sage: f[:8]
|
398
|
+
[1, 1, 3/2, 8/3, 125/24, 54/5, 16807/720, 16384/315]
|
399
|
+
|
400
|
+
Sage example in ./polynomes.tex, line 2158::
|
401
|
+
|
402
|
+
sage: R = PolynomialRing(ZZ, 'x', sparse=True)
|
403
|
+
sage: p = R.cyclotomic_polynomial(2^50); p, p.derivative()
|
404
|
+
(x^562949953421312 + 1, 562949953421312*x^562949953421311)
|
405
|
+
"""
|
@@ -0,0 +1,180 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-repl
|
2
|
+
"""
|
3
|
+
This file (./premierspas_doctest.sage) was *autogenerated* from ./premierspas.tex,
|
4
|
+
with sagetex.sty version 2011/05/27 v2.3.1.
|
5
|
+
It contains the contents of all the sageexample environments from this file.
|
6
|
+
You should be able to doctest this file with:
|
7
|
+
sage -t ./premierspas_doctest.sage
|
8
|
+
It is always safe to delete this file; it is not used in typesetting your
|
9
|
+
document.
|
10
|
+
|
11
|
+
Sage example in ./premierspas.tex, line 589::
|
12
|
+
|
13
|
+
sage: 1+1
|
14
|
+
2
|
15
|
+
|
16
|
+
Sage example in ./premierspas.tex, line 645::
|
17
|
+
|
18
|
+
sage: ( 1 + 2 * (3 + 5) ) * 2
|
19
|
+
34
|
20
|
+
|
21
|
+
Sage example in ./premierspas.tex, line 656::
|
22
|
+
|
23
|
+
sage: 2^3
|
24
|
+
8
|
25
|
+
sage: 2**3
|
26
|
+
8
|
27
|
+
|
28
|
+
Sage example in ./premierspas.tex, line 664::
|
29
|
+
|
30
|
+
sage: 20/6
|
31
|
+
10/3
|
32
|
+
|
33
|
+
Sage example in ./premierspas.tex, line 700::
|
34
|
+
|
35
|
+
sage: 20.0 / 14
|
36
|
+
1.42857142857143
|
37
|
+
|
38
|
+
Sage example in ./premierspas.tex, line 724::
|
39
|
+
|
40
|
+
sage: numerical_approx(20/14, digits=60)
|
41
|
+
1.42857142857142857142857142857142857142857142857142857142857
|
42
|
+
|
43
|
+
Sage example in ./premierspas.tex, line 792::
|
44
|
+
|
45
|
+
sage: 20 // 6
|
46
|
+
3
|
47
|
+
sage: 20 % 6
|
48
|
+
2
|
49
|
+
|
50
|
+
Sage example in ./premierspas.tex, line 818::
|
51
|
+
|
52
|
+
sage: factor(2^(2^5)+1)
|
53
|
+
641 * 6700417
|
54
|
+
|
55
|
+
Sage example in ./premierspas.tex, line 952::
|
56
|
+
|
57
|
+
sage: sin(pi)
|
58
|
+
0
|
59
|
+
sage: tan(pi/3)
|
60
|
+
sqrt(3)
|
61
|
+
sage: arctan(1)
|
62
|
+
1/4*pi
|
63
|
+
sage: exp(2 * I * pi)
|
64
|
+
1
|
65
|
+
|
66
|
+
Sage example in ./premierspas.tex, line 967::
|
67
|
+
|
68
|
+
sage: arccos(sin(pi/3))
|
69
|
+
arccos(1/2*sqrt(3))
|
70
|
+
sage: sqrt(2)
|
71
|
+
sqrt(2)
|
72
|
+
sage: exp(I*pi/7)
|
73
|
+
e^(1/7*I*pi)
|
74
|
+
|
75
|
+
Sage example in ./premierspas.tex, line 987::
|
76
|
+
|
77
|
+
sage: simplify(arccos(sin(pi/3)))
|
78
|
+
1/6*pi
|
79
|
+
|
80
|
+
Sage example in ./premierspas.tex, line 1000::
|
81
|
+
|
82
|
+
sage: numerical_approx(6*arccos(sin(pi/3)), digits=60)
|
83
|
+
3.14159265358979323846264338327950288419716939937510582097494
|
84
|
+
sage: numerical_approx(sqrt(2), digits=60)
|
85
|
+
1.41421356237309504880168872420969807856967187537694807317668
|
86
|
+
|
87
|
+
Sage example in ./premierspas.tex, line 1139::
|
88
|
+
|
89
|
+
sage: y = 1 + 2
|
90
|
+
|
91
|
+
Sage example in ./premierspas.tex, line 1144::
|
92
|
+
|
93
|
+
sage: y
|
94
|
+
3
|
95
|
+
sage: (2 + y) * y
|
96
|
+
15
|
97
|
+
|
98
|
+
Sage example in ./premierspas.tex, line 1156::
|
99
|
+
|
100
|
+
sage: y = 1 + 2; y
|
101
|
+
3
|
102
|
+
|
103
|
+
Sage example in ./premierspas.tex, line 1168::
|
104
|
+
|
105
|
+
sage: y = 3 * y + 1; y
|
106
|
+
10
|
107
|
+
sage: y = 3 * y + 1; y
|
108
|
+
31
|
109
|
+
sage: y = 3 * y + 1; y
|
110
|
+
94
|
111
|
+
|
112
|
+
Sage example in ./premierspas.tex, line 1208::
|
113
|
+
|
114
|
+
sage: pi = -I/2
|
115
|
+
sage: exp(2*I*pi)
|
116
|
+
e
|
117
|
+
|
118
|
+
Sage example in ./premierspas.tex, line 1217::
|
119
|
+
|
120
|
+
sage: from sage.symbolic.constants import pi
|
121
|
+
|
122
|
+
Sage example in ./premierspas.tex, line 1224::
|
123
|
+
|
124
|
+
sage: restore()
|
125
|
+
|
126
|
+
Sage example in ./premierspas.tex, line 1267::
|
127
|
+
|
128
|
+
sage: z = SR.var('z')
|
129
|
+
sage: 2*z + 3
|
130
|
+
2*z + 3
|
131
|
+
|
132
|
+
Sage example in ./premierspas.tex, line 1290::
|
133
|
+
|
134
|
+
sage: y = SR.var('z')
|
135
|
+
sage: 2*y + 3
|
136
|
+
2*z + 3
|
137
|
+
|
138
|
+
Sage example in ./premierspas.tex, line 1306::
|
139
|
+
|
140
|
+
sage: c = 2 * y + 3
|
141
|
+
sage: z = 1
|
142
|
+
sage: 2*y + 3
|
143
|
+
2*z + 3
|
144
|
+
sage: c
|
145
|
+
2*z + 3
|
146
|
+
|
147
|
+
Sage example in ./premierspas.tex, line 1318::
|
148
|
+
|
149
|
+
sage: x = SR.var('x')
|
150
|
+
sage: expr = sin(x); expr
|
151
|
+
sin(x)
|
152
|
+
sage: expr(x=1)
|
153
|
+
sin(1)
|
154
|
+
|
155
|
+
Sage example in ./premierspas.tex, line 1332::
|
156
|
+
|
157
|
+
sage: u = SR.var('u')
|
158
|
+
sage: u = u+1
|
159
|
+
sage: u = u+1
|
160
|
+
sage: u
|
161
|
+
u + 2
|
162
|
+
|
163
|
+
Sage example in ./premierspas.tex, line 1347::
|
164
|
+
|
165
|
+
sage: x = SR.var('x', 100)
|
166
|
+
sage: (x[0] + x[1])*x[99]
|
167
|
+
(x0 + x1)*x99
|
168
|
+
|
169
|
+
Sage example in ./premierspas.tex, line 1357::
|
170
|
+
|
171
|
+
sage: var('a, b, c, x, y')
|
172
|
+
(a, b, c, x, y)
|
173
|
+
sage: a * x + b * y + c
|
174
|
+
a*x + b*y + c
|
175
|
+
|
176
|
+
Sage example in ./premierspas.tex, line 1380::
|
177
|
+
|
178
|
+
sage: var('bla')
|
179
|
+
bla
|
180
|
+
"""
|