Skip to content

Commit 6f03124

Browse files
author
Matthias Koeppe
committed
./sage -fixdoctests --distribution sagemath-categories --only-tags --probe sage.rings.finite_rings src/sage/rings/polynomial
1 parent 8af9b87 commit 6f03124

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+3835
-3632
lines changed

src/sage/rings/polynomial/cyclotomic.pyx

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -74,9 +74,9 @@ def cyclotomic_coeffs(nn, sparse=None):
7474
7575
Check that it has the right degree::
7676
77-
sage: euler_phi(30) # optional - sage.libs.pari
77+
sage: euler_phi(30) # needs sage.libs.pari
7878
8
79-
sage: R(cyclotomic_coeffs(14)).factor() # optional - sage.libs.pari
79+
sage: R(cyclotomic_coeffs(14)).factor() # needs sage.libs.pari
8080
x^6 - x^5 + x^4 - x^3 + x^2 - x + 1
8181
8282
The coefficients are not always +/-1::
@@ -253,9 +253,9 @@ def cyclotomic_value(n, x):
253253
254254
sage: elements = [-1, 0, 1, 2, 1/2, Mod(3, 8), Mod(3,11)]
255255
sage: R.<x> = QQ[]; elements += [x^2 + 2]
256-
sage: K.<i> = NumberField(x^2 + 1); elements += [i] # optional - sage.rings.number_fields
257-
sage: elements += [GF(9,'a').gen()] # optional - sage.rings.finite_rings
258-
sage: elements += [Zp(3)(54)] # optional - sage.rings.padics
256+
sage: K.<i> = NumberField(x^2 + 1); elements += [i] # needs sage.rings.number_fields
257+
sage: elements += [GF(9,'a').gen()] # needs sage.rings.finite_rings
258+
sage: elements += [Zp(3)(54)] # needs sage.rings.padics
259259
sage: for y in elements:
260260
....: for n in [1..60]:
261261
....: val1 = cyclotomic_value(n, y)
@@ -265,29 +265,29 @@ def cyclotomic_value(n, x):
265265
....: if val1.parent() is not val2.parent():
266266
....: print("Wrong parent for cyclotomic_value(%s, %s) in %s"%(n,y,parent(y)))
267267
268-
sage: cyclotomic_value(20, I) # optional - sage.symbolic
268+
sage: cyclotomic_value(20, I) # needs sage.symbolic
269269
5
270270
sage: a = cyclotomic_value(10, mod(3, 11)); a
271271
6
272272
sage: a.parent()
273273
Ring of integers modulo 11
274274
sage: cyclotomic_value(30, -1.0)
275275
1.00000000000000
276-
sage: S.<t> = R.quotient(R.cyclotomic_polynomial(15)) # optional - sage.libs.pari
277-
sage: cyclotomic_value(15, t) # optional - sage.libs.pari
276+
sage: S.<t> = R.quotient(R.cyclotomic_polynomial(15)) # needs sage.libs.pari
277+
sage: cyclotomic_value(15, t) # needs sage.libs.pari
278278
0
279-
sage: cyclotomic_value(30, t) # optional - sage.libs.pari
279+
sage: cyclotomic_value(30, t) # needs sage.libs.pari
280280
2*t^7 - 2*t^5 - 2*t^3 + 2*t
281-
sage: S.<t> = R.quotient(x^10) # optional - sage.libs.pari
282-
sage: cyclotomic_value(2^128 - 1, t) # optional - sage.libs.pari
281+
sage: S.<t> = R.quotient(x^10) # needs sage.libs.pari
282+
sage: cyclotomic_value(2^128 - 1, t) # needs sage.libs.pari
283283
-t^7 - t^6 - t^5 + t^2 + t + 1
284284
sage: cyclotomic_value(10, mod(3,4))
285285
1
286286
287287
Check that the issue with symbolic element in :trac:`14982` is fixed::
288288
289-
sage: a = cyclotomic_value(3, I) # optional - sage.rings.number_fields
290-
sage: parent(a) # optional - sage.rings.number_fields
289+
sage: a = cyclotomic_value(3, I) # needs sage.rings.number_fields
290+
sage: parent(a) # needs sage.rings.number_fields
291291
Number Field in I with defining polynomial x^2 + 1 with I = 1*I
292292
"""
293293
n = ZZ(n)
@@ -394,7 +394,7 @@ def bateman_bound(nn):
394394
EXAMPLES::
395395
396396
sage: from sage.rings.polynomial.cyclotomic import bateman_bound
397-
sage: bateman_bound(2**8 * 1234567893377) # optional - sage.libs.pari
397+
sage: bateman_bound(2**8 * 1234567893377) # needs sage.libs.pari
398398
66944986927
399399
"""
400400
_, n = nn.val_unit(2)

src/sage/rings/polynomial/flatten.py

Lines changed: 21 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -112,36 +112,36 @@ def __init__(self, domain):
112112
::
113113
114114
sage: x = polygen(ZZ, 'x')
115-
sage: K.<v> = NumberField(x^3 - 2) # optional - sage.rings.number_field
116-
sage: R = K['x','y']['a','b'] # optional - sage.rings.number_field
115+
sage: K.<v> = NumberField(x^3 - 2) # needs sage.rings.number_field
116+
sage: R = K['x','y']['a','b'] # needs sage.rings.number_field
117117
sage: from sage.rings.polynomial.flatten import FlatteningMorphism
118-
sage: f = FlatteningMorphism(R) # optional - sage.rings.number_field
119-
sage: f(R('v*a*x^2 + b^2 + 1/v*y')) # optional - sage.rings.number_field
118+
sage: f = FlatteningMorphism(R) # needs sage.rings.number_field
119+
sage: f(R('v*a*x^2 + b^2 + 1/v*y')) # needs sage.rings.number_field
120120
v*x^2*a + b^2 + (1/2*v^2)*y
121121
122122
::
123123
124-
sage: R = QQbar['x','y']['a','b'] # optional - sage.rings.number_field
124+
sage: R = QQbar['x','y']['a','b'] # needs sage.rings.number_field
125125
sage: from sage.rings.polynomial.flatten import FlatteningMorphism
126-
sage: f = FlatteningMorphism(R) # optional - sage.rings.number_field
127-
sage: f(R('QQbar(sqrt(2))*a*x^2 + b^2 + QQbar(I)*y')) # optional - sage.rings.number_field sage.symbolic
126+
sage: f = FlatteningMorphism(R) # needs sage.rings.number_field
127+
sage: f(R('QQbar(sqrt(2))*a*x^2 + b^2 + QQbar(I)*y')) # needs sage.rings.number_field sage.symbolic
128128
1.414213562373095?*x^2*a + b^2 + I*y
129129
130130
::
131131
132-
sage: R.<z> = PolynomialRing(QQbar, 1) # optional - sage.rings.number_field
132+
sage: R.<z> = PolynomialRing(QQbar, 1) # needs sage.rings.number_field
133133
sage: from sage.rings.polynomial.flatten import FlatteningMorphism
134-
sage: f = FlatteningMorphism(R) # optional - sage.rings.number_field
135-
sage: f.domain(), f.codomain() # optional - sage.rings.number_field
134+
sage: f = FlatteningMorphism(R) # needs sage.rings.number_field
135+
sage: f.domain(), f.codomain() # needs sage.rings.number_field
136136
(Multivariate Polynomial Ring in z over Algebraic Field,
137137
Multivariate Polynomial Ring in z over Algebraic Field)
138138
139139
::
140140
141-
sage: R.<z> = PolynomialRing(QQbar) # optional - sage.rings.number_field
141+
sage: R.<z> = PolynomialRing(QQbar) # needs sage.rings.number_field
142142
sage: from sage.rings.polynomial.flatten import FlatteningMorphism
143-
sage: f = FlatteningMorphism(R) # optional - sage.rings.number_field
144-
sage: f.domain(), f.codomain() # optional - sage.rings.number_field
143+
sage: f = FlatteningMorphism(R) # needs sage.rings.number_field
144+
sage: f.domain(), f.codomain() # needs sage.rings.number_field
145145
(Univariate Polynomial Ring in z over Algebraic Field,
146146
Univariate Polynomial Ring in z over Algebraic Field)
147147
@@ -376,8 +376,8 @@ def _call_(self, p):
376376
377377
sage: from sage.rings.polynomial.flatten import FlatteningMorphism
378378
sage: rings = [ZZ['x']['y']['a,b,c']]
379-
sage: rings += [GF(4)['x','y']['a','b']] # optional - sage.rings.finite_rings
380-
sage: rings += [AA['x']['a','b']['y'], QQbar['a1','a2']['t']['X','Y']] # optional - sage.rings.number_field
379+
sage: rings += [GF(4)['x','y']['a','b']] # needs sage.rings.finite_rings
380+
sage: rings += [AA['x']['a','b']['y'], QQbar['a1','a2']['t']['X','Y']] # needs sage.rings.number_field
381381
sage: for R in rings:
382382
....: f = FlatteningMorphism(R)
383383
....: g = f.section()
@@ -487,11 +487,12 @@ def __init__(self, domain, D):
487487
The following was fixed in :trac:`23811`::
488488
489489
sage: R.<c> = RR[]
490-
sage: P.<z> = AffineSpace(R, 1)
491-
sage: H = End(P)
492-
sage: f = H([z^2 + c])
493-
sage: f.specialization({c:1})
494-
Scheme endomorphism of Affine Space of dimension 1 over Real Field with 53 bits of precision
490+
sage: P.<z> = AffineSpace(R, 1) # needs sage.modules
491+
sage: H = End(P) # needs sage.modules
492+
sage: f = H([z^2 + c]) # needs sage.modules
493+
sage: f.specialization({c:1}) # needs sage.modules
494+
Scheme endomorphism of
495+
Affine Space of dimension 1 over Real Field with 53 bits of precision
495496
Defn: Defined on coordinates by sending (z) to
496497
(z^2 + 1.00000000000000)
497498
"""

src/sage/rings/polynomial/groebner_fan.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1274,13 +1274,13 @@ def render(self, file=None, larger=False, shift=0, rgbcolor=(0, 0, 0),
12741274
12751275
sage: R.<x,y,z> = PolynomialRing(QQ,3)
12761276
sage: G = R.ideal([y^3 - x^2, y^2 - 13*x,z]).groebner_fan()
1277-
sage: test_render = G.render() # optional - sage.plot
1277+
sage: test_render = G.render() # needs sage.plot
12781278
12791279
::
12801280
12811281
sage: R.<x,y,z> = PolynomialRing(QQ,3)
12821282
sage: G = R.ideal([x^2*y - z, y^2*z - x, z^2*x - y]).groebner_fan()
1283-
sage: test_render = G.render(larger=True) # optional - sage.plot
1283+
sage: test_render = G.render(larger=True) # needs sage.plot
12841284
12851285
TESTS:
12861286
@@ -1290,7 +1290,7 @@ def render(self, file=None, larger=False, shift=0, rgbcolor=(0, 0, 0),
12901290
::
12911291
12921292
sage: R.<x,y> = PolynomialRing(QQ, 2)
1293-
sage: R.ideal([y^3 - x^2, y^2 - 13*x]).groebner_fan().render() # optional - sage.plot
1293+
sage: R.ideal([y^3 - x^2, y^2 - 13*x]).groebner_fan().render() # needs sage.plot
12941294
Traceback (most recent call last):
12951295
...
12961296
NotImplementedError
@@ -1460,7 +1460,7 @@ def render3d(self, verbose=False):
14601460
14611461
sage: R4.<w,x,y,z> = PolynomialRing(QQ,4)
14621462
sage: gf = R4.ideal([w^2-x,x^2-y,y^2-z,z^2-x]).groebner_fan()
1463-
sage: three_d = gf.render3d() # optional - sage.plot
1463+
sage: three_d = gf.render3d() # needs sage.plot
14641464
14651465
TESTS:
14661466
@@ -1470,7 +1470,7 @@ def render3d(self, verbose=False):
14701470
::
14711471
14721472
sage: P.<a,b,c> = PolynomialRing(QQ, 3, order="lex")
1473-
sage: sage.rings.ideal.Katsura(P, 3).groebner_fan().render3d() # optional - sage.plot
1473+
sage: sage.rings.ideal.Katsura(P, 3).groebner_fan().render3d() # needs sage.plot
14741474
Traceback (most recent call last):
14751475
...
14761476
NotImplementedError

src/sage/rings/polynomial/ideal.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ def residue_field(self, names=None, check=True):
4646
EXAMPLES::
4747
4848
sage: R.<t> = GF(17)[]; P = R.ideal(t^3 + 2*t + 9)
49-
sage: k.<a> = P.residue_field(); k # optional - sage.rings.finite_rings
49+
sage: k.<a> = P.residue_field(); k # needs sage.rings.finite_rings
5050
Residue field in a of Principal ideal (t^3 + 2*t + 9) of
5151
Univariate Polynomial Ring in t over Finite Field of size 17
5252
"""
@@ -75,11 +75,11 @@ def groebner_basis(self, algorithm=None):
7575
7676
sage: R.<x> = QQ[]
7777
sage: I = R.ideal([x^2 - 1, x^3 - 1])
78-
sage: G = I.groebner_basis(); G # optional - sage.libs.singular
78+
sage: G = I.groebner_basis(); G # needs sage.libs.singular
7979
[x - 1]
80-
sage: type(G) # optional - sage.libs.singular
80+
sage: type(G) # needs sage.libs.singular
8181
<class 'sage.rings.polynomial.multi_polynomial_sequence.PolynomialSequence_generic'>
82-
sage: list(G) # optional - sage.libs.singular
82+
sage: list(G) # needs sage.libs.singular
8383
[x - 1]
8484
"""
8585
gb = self.gens_reduced()

src/sage/rings/polynomial/infinite_polynomial_element.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -440,13 +440,14 @@ def subs(self, fixed=None, **kwargs):
440440
441441
The substitution can also handle matrices::
442442
443-
sage: M = matrix([[1,0], [0,2]]) # needs sage.modules
444-
sage: N = matrix([[0,3], [4,0]]) # needs sage.modules
445-
sage: g = x[0]^2 + 3*x[1] # needs sage.modules
446-
sage: g.subs({'x_0': M}) # needs sage.modules
443+
sage: # needs sage.modules
444+
sage: M = matrix([[1,0], [0,2]])
445+
sage: N = matrix([[0,3], [4,0]])
446+
sage: g = x[0]^2 + 3*x[1]
447+
sage: g.subs({'x_0': M})
447448
[3*x_1 + 1 0]
448449
[ 0 3*x_1 + 4]
449-
sage: g.subs({x[0]: M, x[1]: N}) # needs sage.modules
450+
sage: g.subs({x[0]: M, x[1]: N})
450451
[ 1 9]
451452
[12 4]
452453

0 commit comments

Comments
 (0)