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,560 @@
|
|
1
|
+
# sage_setup: distribution = sagemath-repl
|
2
|
+
r"""
|
3
|
+
This file (./mpoly_doctest.sage) was *autogenerated* from ./mpoly.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 ./mpoly_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 ./mpoly.tex, line 65::
|
12
|
+
|
13
|
+
sage: R = PolynomialRing(QQ, 'x,y,z')
|
14
|
+
sage: x,y,z = R.gens() # gives the tuples of indeterminates
|
15
|
+
|
16
|
+
Sage example in ./mpoly.tex, line 78::
|
17
|
+
|
18
|
+
sage: R = PolynomialRing(QQ, 'x', 10)
|
19
|
+
|
20
|
+
Sage example in ./mpoly.tex, line 84::
|
21
|
+
|
22
|
+
sage: x = R.gens()
|
23
|
+
sage: sum(x[i] for i in range(5))
|
24
|
+
x0 + x1 + x2 + x3 + x4
|
25
|
+
|
26
|
+
Sage example in ./mpoly.tex, line 96::
|
27
|
+
|
28
|
+
sage: def test_poly(ring, deg=3):
|
29
|
+
....: monomials = Subsets(
|
30
|
+
....: flatten([(x,)*deg for x in (1,) + ring.gens()]),
|
31
|
+
....: deg, submultiset=True)
|
32
|
+
....: return add(mul(m) for m in monomials)
|
33
|
+
|
34
|
+
Sage example in ./mpoly.tex, line 103::
|
35
|
+
|
36
|
+
sage: test_poly(QQ['x,y'])
|
37
|
+
x^3 + x^2*y + x*y^2 + y^3 + x^2 + x*y + y^2 + x + y + 1
|
38
|
+
sage: test_poly(QQ['y,x'])
|
39
|
+
y^3 + y^2*x + y*x^2 + x^3 + y^2 + y*x + x^2 + y + x + 1
|
40
|
+
sage: test_poly(QQ['x,y']) == test_poly(QQ['y,x'])
|
41
|
+
True
|
42
|
+
|
43
|
+
Sage example in ./mpoly.tex, line 127::
|
44
|
+
|
45
|
+
sage: test_poly(PolynomialRing(QQ, 'x,y', order='deglex'))
|
46
|
+
x^3 + x^2*y + x*y^2 + y^3 + x^2 + x*y + y^2 + x + y + 1
|
47
|
+
|
48
|
+
Sage example in ./mpoly.tex, line 230::
|
49
|
+
|
50
|
+
sage: R.<x,y> = InfinitePolynomialRing(ZZ, order='lex')
|
51
|
+
sage: p = mul(x[k] - y[k] for k in range(2)); p
|
52
|
+
x_1*x_0 - x_1*y_0 - x_0*y_1 + y_1*y_0
|
53
|
+
sage: p + x[100]
|
54
|
+
x_100 + x_1*x_0 - x_1*y_0 - x_0*y_1 + y_1*y_0
|
55
|
+
|
56
|
+
Sage example in ./mpoly.tex, line 343::
|
57
|
+
|
58
|
+
sage: R.<x,y,z> = QQ[]
|
59
|
+
sage: p = 7*y^2*x^2 + 3*y*x^2 + 2*y*z + x^3 + 6
|
60
|
+
sage: p.lt()
|
61
|
+
7*x^2*y^2
|
62
|
+
|
63
|
+
Sage example in ./mpoly.tex, line 358::
|
64
|
+
|
65
|
+
sage: p[x^2*y] == p[(2,1,0)] == p[2,1,0] == 3
|
66
|
+
True
|
67
|
+
|
68
|
+
Sage example in ./mpoly.tex, line 366::
|
69
|
+
|
70
|
+
sage: p(0, 3, -1)
|
71
|
+
0
|
72
|
+
sage: p.subs(x = 1, z = x^2+1)
|
73
|
+
2*x^2*y + 7*y^2 + 5*y + 7
|
74
|
+
|
75
|
+
Sage example in ./mpoly.tex, line 381::
|
76
|
+
|
77
|
+
sage: print("total={d} (in x)={dx} partial={ds}"
|
78
|
+
....: .format(d=p.degree(), dx=p.degree(x), ds=p.degrees()))
|
79
|
+
total=4 (in x)=3 partial=(3, 2, 1)
|
80
|
+
|
81
|
+
Sage example in ./mpoly.tex, line 441::
|
82
|
+
|
83
|
+
sage: R.<x,y> = QQ[]; p = x^2 + y^2; q = x + y
|
84
|
+
sage: print("({quo})*({q}) + ({rem}) == {p}".format(
|
85
|
+
....: quo=p//q, q=q, rem=p%q, p=p//q*q+p%q))
|
86
|
+
(-x + y)*(x + y) + (2*x^2) == x^2 + y^2
|
87
|
+
sage: p.mod(q) # is NOT equivalent to p%q
|
88
|
+
2*y^2
|
89
|
+
|
90
|
+
Sage example in ./mpoly.tex, line 459::
|
91
|
+
|
92
|
+
sage: R.<x,y> = QQ[exp(2*I*pi/5)][]
|
93
|
+
sage: (x^10 + y^5).gcd(x^4 - y^2)
|
94
|
+
x^2 + y
|
95
|
+
sage: (x^10 + y^5).factor()
|
96
|
+
(x^2 + y) * (x^2 + a*y) * (x^2 + (a^2)*y) * (x^2 + (-a^3 - a^2 - a - 1)*y) * (x^2 + (a^3)*y)
|
97
|
+
|
98
|
+
Sage example in ./mpoly.tex, line 564::
|
99
|
+
|
100
|
+
sage: R.<x,y,z> = QQ[]
|
101
|
+
sage: J = R.ideal(x^2 * y * z - 18,
|
102
|
+
....: x * y^3 * z - 24,
|
103
|
+
....: x * y * z^4 - 6)
|
104
|
+
|
105
|
+
Sage example in ./mpoly.tex, line 575::
|
106
|
+
|
107
|
+
sage: J.dimension()
|
108
|
+
0
|
109
|
+
|
110
|
+
Sage example in ./mpoly.tex, line 584::
|
111
|
+
|
112
|
+
sage: J.variety()
|
113
|
+
[{z: 1, y: 2, x: 3}]
|
114
|
+
|
115
|
+
Sage example in ./mpoly.tex, line 596::
|
116
|
+
|
117
|
+
sage: V = J.variety(QQbar)
|
118
|
+
sage: len(V)
|
119
|
+
17
|
120
|
+
|
121
|
+
Sage example in ./mpoly.tex, line 603::
|
122
|
+
|
123
|
+
sage: sorted(V, key=str)[-3:]
|
124
|
+
[{z: 0.9324722294043558? + 0.3612416661871530?*I,
|
125
|
+
y: -1.700434271459229? - 1.052864325754712?*I,
|
126
|
+
x: 1.337215067329615? + 2.685489874065187?*I},
|
127
|
+
{z: 0.9324722294043558? - 0.3612416661871530?*I,
|
128
|
+
y: -1.700434271459229? + 1.052864325754712?*I,
|
129
|
+
x: 1.337215067329615? - 2.685489874065187?*I},
|
130
|
+
{z: 1, y: 2, x: 3}]
|
131
|
+
|
132
|
+
Sage example in ./mpoly.tex, line 619::
|
133
|
+
|
134
|
+
sage: (xx, yy, zz) = QQbar['x,y,z'].gens()
|
135
|
+
sage: sorted([pt[xx].degree() for pt in V])
|
136
|
+
[1, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16, 16,
|
137
|
+
16, 16]
|
138
|
+
|
139
|
+
Sage example in ./mpoly.tex, line 640::
|
140
|
+
|
141
|
+
sage: Set(tuple(abs(pt[i]) for i in (xx,yy,zz)) for pt in V)
|
142
|
+
{(3, 2, 1)}
|
143
|
+
|
144
|
+
Sage example in ./mpoly.tex, line 662::
|
145
|
+
|
146
|
+
sage: w = QQbar.zeta(17); w # primitive root of 1
|
147
|
+
0.9324722294043558? + 0.3612416661871530?*I
|
148
|
+
sage: Set(pt[zz] for pt in V) == Set(w^i for i in range(17))
|
149
|
+
True
|
150
|
+
|
151
|
+
Sage example in ./mpoly.tex, line 690::
|
152
|
+
|
153
|
+
sage: set(pt[zz].minpoly() for pt in sorted(V, key=str)[:-1])
|
154
|
+
{x^16 + x^15 + x^14 + x^13 + x^12 + x^11 + x^10 + x^9 + x^8 + x^7 + x^6 + x^5 + x^4 + x^3 + x^2 + x + 1}
|
155
|
+
|
156
|
+
Sage example in ./mpoly.tex, line 706::
|
157
|
+
|
158
|
+
sage: def polar_form(z):
|
159
|
+
....: rho = z.abs(); rho.simplify()
|
160
|
+
....: theta = 2 * pi * z.rational_argument()
|
161
|
+
....: return (SR(rho) * exp(I*theta))
|
162
|
+
sage: sorted([tuple(polar_form(pt[i]) for i in [xx,yy,zz])
|
163
|
+
....: for pt in sorted(V, key=str)[-3:]])
|
164
|
+
[(3*e^(6/17*I*pi), 2*e^(-14/17*I*pi), e^(2/17*I*pi)),
|
165
|
+
(3*e^(-6/17*I*pi), 2*e^(14/17*I*pi), e^(-2/17*I*pi)),
|
166
|
+
(3, 2, 1)]
|
167
|
+
|
168
|
+
Sage example in ./mpoly.tex, line 733::
|
169
|
+
|
170
|
+
sage: J.triangular_decomposition()
|
171
|
+
[Ideal (z^17 - 1, y - 2*z^10, x - 3*z^3) of Multivariate
|
172
|
+
Polynomial Ring in x, y, z over Rational Field]
|
173
|
+
sage: J.transformed_basis()
|
174
|
+
[z^17 - 1, -3/4*y^2 + x, -2*z^10 + y]
|
175
|
+
|
176
|
+
Sage example in ./mpoly.tex, line 909::
|
177
|
+
|
178
|
+
sage: R.<x,y> = QQ[]
|
179
|
+
sage: J = R.ideal(x^2 + y^2 - 1, 16*x^2*y^2 - 1)
|
180
|
+
|
181
|
+
Sage example in ./mpoly.tex, line 917::
|
182
|
+
|
183
|
+
sage: ybar2 = R.quo(J)(y^2)
|
184
|
+
sage: [ybar2^i for i in range(3)]
|
185
|
+
[1, ybar^2, ybar^2 - 1/16]
|
186
|
+
sage: ((ybar2 + 1)^2).lift()
|
187
|
+
3*y^2 + 15/16
|
188
|
+
|
189
|
+
Sage example in ./mpoly.tex, line 958::
|
190
|
+
|
191
|
+
sage: u = (16*y^4 - 16*y^2 + 1).lift(J); u
|
192
|
+
[16*y^2, -1]
|
193
|
+
sage: u[0]*J.0 + u[1]*J.1
|
194
|
+
16*y^4 - 16*y^2 + 1
|
195
|
+
|
196
|
+
Sage example in ./mpoly.tex, line 968::
|
197
|
+
|
198
|
+
sage: (y^4).mod(J)
|
199
|
+
y^2 - 1/16
|
200
|
+
|
201
|
+
Sage example in ./mpoly.tex, line 978::
|
202
|
+
|
203
|
+
sage: (y^4).reduce([x^2 + y^2 - 1, 16*x^2*y^2 - 1])
|
204
|
+
y^4
|
205
|
+
|
206
|
+
Sage example in ./mpoly.tex, line 1047::
|
207
|
+
|
208
|
+
sage: 1 in ideal(x^2+y^2-1, (x-4)^2+y^2-1)
|
209
|
+
False
|
210
|
+
|
211
|
+
Sage example in ./mpoly.tex, line 1056::
|
212
|
+
|
213
|
+
sage: R(1).lift(ideal(x^2+y^2-1, (x-4)^2+y^2-1, x-y))
|
214
|
+
[-1/28*y + 1/14, 1/28*y + 1/14, -1/7*x + 1/7*y + 4/7]
|
215
|
+
|
216
|
+
Sage example in ./mpoly.tex, line 1079::
|
217
|
+
|
218
|
+
sage: J1 = (x^2 + y^2 - 1, 16*x^2*y^2 - 1)*R
|
219
|
+
sage: J2 = (x^2 + y^2 - 1, 4*x^2*y^2 - 1)*R
|
220
|
+
sage: J1.radical() == J1
|
221
|
+
True
|
222
|
+
sage: J2.radical()
|
223
|
+
Ideal (2*y^2 - 1, 2*x^2 - 1) of Multivariate Polynomial
|
224
|
+
Ring in x, y over Rational Field
|
225
|
+
sage: 2*y^2 - 1 in J2
|
226
|
+
False
|
227
|
+
|
228
|
+
Sage example in ./mpoly.tex, line 1122::
|
229
|
+
|
230
|
+
sage: C = ideal(x^2 + y^2 - 1); H = ideal(16*x^2*y^2 - 1)
|
231
|
+
sage: C + H == J1
|
232
|
+
True
|
233
|
+
|
234
|
+
Sage example in ./mpoly.tex, line 1151::
|
235
|
+
|
236
|
+
sage: CH = C.intersection(H).quotient(ideal(4*x*y-1)); CH
|
237
|
+
Ideal (4*x^3*y + 4*x*y^3 + x^2 - 4*x*y + y^2 - 1) of
|
238
|
+
Multivariate Polynomial Ring in x, y over Rational Field
|
239
|
+
sage: CH.gen(0).factor()
|
240
|
+
(4*x*y + 1) * (x^2 + y^2 - 1)
|
241
|
+
|
242
|
+
Sage example in ./mpoly.tex, line 1161::
|
243
|
+
|
244
|
+
sage: H.quotient(C) == H
|
245
|
+
True
|
246
|
+
|
247
|
+
Sage example in ./mpoly.tex, line 1184::
|
248
|
+
|
249
|
+
sage: [J.dimension() for J in [J1, J2, C, H, H*J2, J1+J2]]
|
250
|
+
[0, 0, 1, 1, 1, -1]
|
251
|
+
|
252
|
+
Sage example in ./mpoly.tex, line 1285::
|
253
|
+
|
254
|
+
sage: R.<x,y,z> = QQ[]
|
255
|
+
sage: J = ideal(2*x+y-2*z, 2*x+2*y+z-1)
|
256
|
+
sage: J.elimination_ideal(x)
|
257
|
+
Ideal (y + 3*z - 1) of Multivariate Polynomial Ring in x, y, z
|
258
|
+
over Rational Field
|
259
|
+
sage: J.elimination_ideal([x,y])
|
260
|
+
Ideal (0) of Multivariate Polynomial Ring in x, y, z over Rational Field
|
261
|
+
|
262
|
+
Sage example in ./mpoly.tex, line 1312::
|
263
|
+
|
264
|
+
sage: R.<x,y> = QQ[]
|
265
|
+
sage: J1 = ideal(x^2 + y^2 - 1, 16*x^2*y^2 - 1)
|
266
|
+
|
267
|
+
Sage example in ./mpoly.tex, line 1328::
|
268
|
+
|
269
|
+
sage: g = J1.elimination_ideal(y).gens(); g
|
270
|
+
[16*x^4 - 16*x^2 + 1]
|
271
|
+
sage: SR(g[0]).solve(SR(x)) # solves by radicals
|
272
|
+
[x == -1/2*sqrt(sqrt(3) + 2), x == 1/2*sqrt(sqrt(3) + 2),
|
273
|
+
x == -1/2*sqrt(-sqrt(3) + 2), x == 1/2*sqrt(-sqrt(3) + 2)]
|
274
|
+
|
275
|
+
Sage example in ./mpoly.tex, line 1351::
|
276
|
+
|
277
|
+
sage: C.elimination_ideal(y).gens()
|
278
|
+
[0]
|
279
|
+
sage: H.elimination_ideal(y).gens()
|
280
|
+
[0]
|
281
|
+
|
282
|
+
Sage example in ./mpoly.tex, line 1431::
|
283
|
+
|
284
|
+
sage: R.<x,y,t> = QQ[]
|
285
|
+
sage: Param = R.ideal((1-t^2)-(1+t^2)*x, 2*t-(1+t^2)*y)
|
286
|
+
|
287
|
+
Sage example in ./mpoly.tex, line 1437::
|
288
|
+
|
289
|
+
sage: Param.elimination_ideal(t).gens()
|
290
|
+
[x^2 + y^2 - 1]
|
291
|
+
|
292
|
+
Sage example in ./mpoly.tex, line 1469::
|
293
|
+
|
294
|
+
sage: R.<x,y,t> = QQ[]
|
295
|
+
sage: eq = x^2 + (y-t)^2 - 1/2*(t^2+1)
|
296
|
+
sage: fig = add((eq(t=k/5)*QQ[x,y]).plot() for k in (-15..15))
|
297
|
+
sage: fig.show(aspect_ratio=1, xmin=-2, xmax=2, ymin=-3, ymax=3)
|
298
|
+
|
299
|
+
Sage example in ./mpoly.tex, line 1494::
|
300
|
+
|
301
|
+
sage: env = ideal(eq, eq.derivative(t)).elimination_ideal(t)
|
302
|
+
sage: env.gens()
|
303
|
+
[2*x^2 - 2*y^2 - 1]
|
304
|
+
|
305
|
+
Sage example in ./mpoly.tex, line 1502::
|
306
|
+
|
307
|
+
sage: env.change_ring(QQ[x,y]).plot((x,-2,2),(y,-3,3))
|
308
|
+
Graphics object consisting of 1 graphics primitive
|
309
|
+
|
310
|
+
Sage example in ./mpoly.tex, line 1538::
|
311
|
+
|
312
|
+
sage: R.<x,y,t> = QQ[]
|
313
|
+
sage: J = (y-t*x, y-t*(1-x))*R
|
314
|
+
sage: (x^2+y^2) - ((1-x)^2+y^2) in J
|
315
|
+
False
|
316
|
+
|
317
|
+
Sage example in ./mpoly.tex, line 1553::
|
318
|
+
|
319
|
+
sage: R.<x,y,t,u> = QQ[]
|
320
|
+
sage: J = (y-t*x, y-t*(1-x), t*u-1)*R
|
321
|
+
sage: (x^2+y^2) - ((1-x)^2+y^2) in J
|
322
|
+
True
|
323
|
+
|
324
|
+
Sage example in ./mpoly.tex, line 1615::
|
325
|
+
|
326
|
+
sage: R.<x,y,t> = QQ[]
|
327
|
+
|
328
|
+
Sage example in ./mpoly.tex, line 1618::
|
329
|
+
|
330
|
+
sage: eq.derivative(t).resultant(eq, t)
|
331
|
+
x^2 - y^2 - 1/2
|
332
|
+
|
333
|
+
Sage example in ./mpoly.tex, line 1636::
|
334
|
+
|
335
|
+
sage: R.<x,y> = QQ[]
|
336
|
+
sage: p = y^2 - x; q = y^2 + x
|
337
|
+
sage: p.resultant(q, y)
|
338
|
+
4*x^2
|
339
|
+
sage: ideal(p, q).elimination_ideal(y)
|
340
|
+
Ideal (x) of Multivariate Polynomial Ring in x, y over Rational Field
|
341
|
+
|
342
|
+
Sage example in ./mpoly.tex, line 1665::
|
343
|
+
|
344
|
+
sage: R.<x,y> = QQ[]
|
345
|
+
sage: ((x^2 + y^2)*(x^2 + y^2 + 1)*R).dimension()
|
346
|
+
1
|
347
|
+
|
348
|
+
Sage example in ./mpoly.tex, line 1690::
|
349
|
+
|
350
|
+
sage: R.<x,y> = QQ[]
|
351
|
+
sage: J1 = (x^2 + y^2 - 1, 16*x^2*y^2 - 1)*R
|
352
|
+
sage: J1.variety()
|
353
|
+
[]
|
354
|
+
|
355
|
+
Sage example in ./mpoly.tex, line 1705::
|
356
|
+
|
357
|
+
sage: J1.variety(QQbar)[0:2]
|
358
|
+
[{y: -0.9659258262890683?, x: -0.2588190451025208?},
|
359
|
+
{y: -0.9659258262890683?, x: 0.2588190451025208?}]
|
360
|
+
|
361
|
+
Sage example in ./mpoly.tex, line 1759::
|
362
|
+
|
363
|
+
sage: R.<x,y> = PolynomialRing(QQ, order='lex')
|
364
|
+
sage: C = ideal(x^2+y^2-1)
|
365
|
+
sage: D = ideal((x+y-1)*(x+y+1))
|
366
|
+
sage: J = C + D
|
367
|
+
|
368
|
+
Sage example in ./mpoly.tex, line 1786::
|
369
|
+
|
370
|
+
sage: J.triangular_decomposition()
|
371
|
+
[Ideal (y, x^2 - 1) of Multivariate Polynomial Ring in x, y
|
372
|
+
over Rational Field,
|
373
|
+
Ideal (y^2 - 1, x) of Multivariate Polynomial Ring in x, y
|
374
|
+
over Rational Field]
|
375
|
+
|
376
|
+
Sage example in ./mpoly.tex, line 1840::
|
377
|
+
|
378
|
+
sage: D = ideal((x+2*y-1)*(x+2*y+1)); J = C + D
|
379
|
+
sage: J.variety()
|
380
|
+
[{y: 0, x: 1}, {y: 0, x: -1}, {y: 4/5, x: -3/5}, {y: -4/5, x: 3/5}]
|
381
|
+
sage: [T.gens() for T in J.triangular_decomposition()]
|
382
|
+
[[y, x^2 - 1], [25*y^2 - 16, 4*x + 3*y]]
|
383
|
+
|
384
|
+
Sage example in ./mpoly.tex, line 1855::
|
385
|
+
|
386
|
+
sage: Jy = J.elimination_ideal(x); Jy.gens()
|
387
|
+
[25*y^3 - 16*y]
|
388
|
+
|
389
|
+
Sage example in ./mpoly.tex, line 1863::
|
390
|
+
|
391
|
+
sage: ys = QQ['y'](Jy.0).roots(); ys
|
392
|
+
[(4/5, 1), (0, 1), (-4/5, 1)]
|
393
|
+
sage: QQ['x'](J.1(y=ys[0][0])).roots()
|
394
|
+
[(-3/5, 1), (-13/5, 1)]
|
395
|
+
|
396
|
+
Sage example in ./mpoly.tex, line 1882::
|
397
|
+
|
398
|
+
sage: ys = CDF['y'](Jy.0).roots(); ys # abs tol 2e-15
|
399
|
+
[(-0.8, 1), (0.0, 1), (0.8, 1)]
|
400
|
+
sage: [CDF['x'](p(y=ys[0][0])).roots() for p in J.gens()] # abs tol 2e-15
|
401
|
+
[[(-0.5999999999999999, 1), (0.6000000000000001, 1)], [(0.6000000000000001, 1), (2.600000000000001, 1)]]
|
402
|
+
|
403
|
+
Sage example in ./mpoly.tex, line 1911::
|
404
|
+
|
405
|
+
sage: R.<x,y> = QQ[]; J = ideal([ x^7-(100*x-1)^2, y-x^7+1 ])
|
406
|
+
sage: J.variety(RealField(51)) # random
|
407
|
+
[{y: 396340.890166545, x: -14.1660266425312}]
|
408
|
+
|
409
|
+
Sage example in ./mpoly.tex, line 1923::
|
410
|
+
|
411
|
+
sage: J.variety(AA)
|
412
|
+
[{y: -0.999999999999990?, x: 0.00999999900000035?},
|
413
|
+
{y: -0.999999999999990?, x: 0.01000000100000035?},
|
414
|
+
{y: 396340.8901665450?, x: 6.305568998641385?}]
|
415
|
+
|
416
|
+
Sage example in ./mpoly.tex, line 1983::
|
417
|
+
|
418
|
+
sage: len(J2.variety(QQbar)), J2.vector_space_dimension()
|
419
|
+
(4, 8)
|
420
|
+
|
421
|
+
Sage example in ./mpoly.tex, line 1993::
|
422
|
+
|
423
|
+
sage: J2.normal_basis()
|
424
|
+
[x*y^3, y^3, x*y^2, y^2, x*y, y, x, 1]
|
425
|
+
|
426
|
+
Sage example in ./mpoly.tex, line 2187::
|
427
|
+
|
428
|
+
sage: R.<x,y,z,t> = PolynomialRing(QQ, order='lex')
|
429
|
+
|
430
|
+
Sage example in ./mpoly.tex, line 2243::
|
431
|
+
|
432
|
+
sage: ((x+y+z)^2).reduce([x-t, y-t^2, z^2-t])
|
433
|
+
2*z*t^2 + 2*z*t + t^4 + 2*t^3 + t^2 + t
|
434
|
+
|
435
|
+
Sage example in ./mpoly.tex, line 2298::
|
436
|
+
|
437
|
+
sage: R.<x,y> = PolynomialRing(QQ, order='lex')
|
438
|
+
sage: (g, h) = (x-y, x-y^2); p = x*y - x
|
439
|
+
sage: p.reduce([g, h]) # two reductions by h
|
440
|
+
y^3 - y^2
|
441
|
+
sage: p.reduce([h, g]) # two reductions by g
|
442
|
+
y^2 - y
|
443
|
+
|
444
|
+
Sage example in ./mpoly.tex, line 2311::
|
445
|
+
|
446
|
+
sage: p - y*g + h
|
447
|
+
0
|
448
|
+
|
449
|
+
Sage example in ./mpoly.tex, line 2575::
|
450
|
+
|
451
|
+
sage: R.<x,y> = PolynomialRing(QQ, order='lex')
|
452
|
+
sage: R.ideal(x*y^4, x^2*y^3, x^4*y, x^5).basis_is_groebner()
|
453
|
+
True
|
454
|
+
|
455
|
+
Sage example in ./mpoly.tex, line 2584::
|
456
|
+
|
457
|
+
sage: R.ideal(x^2+y^2-1, 16*x^2*y^2-1).basis_is_groebner()
|
458
|
+
False
|
459
|
+
|
460
|
+
Sage example in ./mpoly.tex, line 2610::
|
461
|
+
|
462
|
+
sage: R.ideal(x^2+y^2-1, 16*x^2*y^2-1).groebner_basis()
|
463
|
+
[x^2 + y^2 - 1, y^4 - y^2 + 1/16]
|
464
|
+
|
465
|
+
Sage example in ./mpoly.tex, line 2618::
|
466
|
+
|
467
|
+
sage: R.ideal(16*x^2*y^2-1).groebner_basis()
|
468
|
+
[x^2*y^2 - 1/16]
|
469
|
+
|
470
|
+
Sage example in ./mpoly.tex, line 2626::
|
471
|
+
|
472
|
+
sage: R.ideal(x^2+y^2-1, (x+y)^2-1).groebner_basis()
|
473
|
+
[x^2 + y^2 - 1, x*y, y^3 - y]
|
474
|
+
|
475
|
+
Sage example in ./mpoly.tex, line 2636::
|
476
|
+
|
477
|
+
sage: R_lex.<x,y> = PolynomialRing(QQ, order='lex')
|
478
|
+
sage: J_lex = (x*y+x+y^2+1, x^2*y+x*y^2+1)*R_lex; J_lex.gens()
|
479
|
+
[x*y + x + y^2 + 1, x^2*y + x*y^2 + 1]
|
480
|
+
sage: J_lex.groebner_basis()
|
481
|
+
[x - 1/2*y^3 + y^2 + 3/2, y^4 - y^3 - 3*y - 1]
|
482
|
+
|
483
|
+
Sage example in ./mpoly.tex, line 2644::
|
484
|
+
|
485
|
+
sage: R_invlex = PolynomialRing(QQ, 'x,y', order='invlex')
|
486
|
+
sage: J_invlex = J_lex.change_ring(R_invlex); J_invlex.gens()
|
487
|
+
[y^2 + x*y + x + 1, x*y^2 + x^2*y + 1]
|
488
|
+
sage: J_invlex.groebner_basis()
|
489
|
+
[y^2 + x*y + x + 1, x^2 + x - 1]
|
490
|
+
|
491
|
+
Sage example in ./mpoly.tex, line 2651::
|
492
|
+
|
493
|
+
sage: R_drl = PolynomialRing(QQ, 'x,y', order='degrevlex')
|
494
|
+
sage: J_drl = J_lex.change_ring(R_drl); J_drl.gens()
|
495
|
+
[x*y + y^2 + x + 1, x^2*y + x*y^2 + 1]
|
496
|
+
sage: J_drl.groebner_basis()
|
497
|
+
[y^3 - 2*y^2 - 2*x - 3, x^2 + x - 1, x*y + y^2 + x + 1]
|
498
|
+
|
499
|
+
Sage example in ./mpoly.tex, line 2719::
|
500
|
+
|
501
|
+
sage: p = (x + y)^5
|
502
|
+
sage: J_lex.reduce(p)
|
503
|
+
17/2*y^3 - 12*y^2 + 4*y - 49/2
|
504
|
+
|
505
|
+
Sage example in ./mpoly.tex, line 2726::
|
506
|
+
|
507
|
+
sage: p.reduce(J_lex.groebner_basis())
|
508
|
+
17/2*y^3 - 12*y^2 + 4*y - 49/2
|
509
|
+
|
510
|
+
Sage example in ./mpoly.tex, line 2732::
|
511
|
+
|
512
|
+
sage: R_lex.quo(J_lex)(p)
|
513
|
+
17/2*ybar^3 - 12*ybar^2 + 4*ybar - 49/2
|
514
|
+
|
515
|
+
Sage example in ./mpoly.tex, line 2738::
|
516
|
+
|
517
|
+
sage: R_drl.quo(J_drl)(p)
|
518
|
+
5*ybar^2 + 17*xbar + 4*ybar + 1
|
519
|
+
|
520
|
+
Sage example in ./mpoly.tex, line 2751::
|
521
|
+
|
522
|
+
sage: J_lex.normal_basis()
|
523
|
+
[y^3, y^2, y, 1]
|
524
|
+
sage: J_invlex.normal_basis()
|
525
|
+
[x*y, y, x, 1]
|
526
|
+
sage: J_drl.normal_basis()
|
527
|
+
[y^2, y, x, 1]
|
528
|
+
|
529
|
+
Sage example in ./mpoly.tex, line 2775::
|
530
|
+
|
531
|
+
sage: ideal(16*x^2*y^2-1).dimension()
|
532
|
+
1
|
533
|
+
|
534
|
+
Sage example in ./mpoly.tex, line 2851::
|
535
|
+
|
536
|
+
sage: R.<t,x,y,z> = PolynomialRing(QQ, order='lex')
|
537
|
+
sage: J = R.ideal(t+x+y+z-1, t^2-x^2-y^2-z^2-1, t-x*y)
|
538
|
+
sage: [u.polynomial(u.variable(0)) for u in J.groebner_basis()]
|
539
|
+
[t + x + y + z - 1,
|
540
|
+
(y + 1)*x + y + z - 1,
|
541
|
+
(z - 2)*x + y*z - 2*y - 2*z + 1,
|
542
|
+
(z - 2)*y^2 + (-2*z + 1)*y - z^2 + z - 1]
|
543
|
+
|
544
|
+
Sage example in ./mpoly.tex, line 2970::
|
545
|
+
|
546
|
+
sage: from sage.rings.ideal import Cyclic
|
547
|
+
sage: Cyclic(QQ['x,y,z'])
|
548
|
+
Ideal (x + y + z, x*y + x*z + y*z, x*y*z - 1) of
|
549
|
+
Multivariate Polynomial Ring in x, y, z over Rational Field
|
550
|
+
|
551
|
+
Sage example in ./mpoly.tex, line 2980::
|
552
|
+
|
553
|
+
sage: def C(R, n): return Cyclic(PolynomialRing(R, 'x', n))
|
554
|
+
|
555
|
+
Sage example in ./mpoly.tex, line 3010::
|
556
|
+
|
557
|
+
sage: p = previous_prime(2^30)
|
558
|
+
sage: len(C(GF(p), 6).groebner_basis())
|
559
|
+
45
|
560
|
+
"""
|