Skip to content

Commit 266e4e0

Browse files
author
Matthias Koeppe
committed
sage.rings.polynomial: Update from #35095
1 parent c7625ab commit 266e4e0

File tree

5 files changed

+29
-21
lines changed

5 files changed

+29
-21
lines changed

src/sage/rings/polynomial/multi_polynomial_element.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1090,7 +1090,7 @@ def global_height(self, prec=None):
10901090
from sage.categories.number_fields import NumberFields
10911091

10921092
K = self.base_ring()
1093-
if K in NumberFields() or isinstance(K, (sage.rings.abc.Order, IntegerRing_class)):
1093+
if K in NumberFields() or isinstance(K, (sage.rings.abc.Order, sage.rings.integer_ring.IntegerRing_class)):
10941094
from sage.schemes.projective.projective_space import ProjectiveSpace
10951095
Pr = ProjectiveSpace(K, self.number_of_terms()-1)
10961096
return Pr.point(self.coefficients()).global_height(prec=prec)

src/sage/rings/polynomial/multi_polynomial_ideal.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4650,10 +4650,10 @@ def groebner_basis(self, algorithm='', deg_bound=None, mult_bound=None, prot=Fal
46504650
if not algorithm:
46514651
try:
46524652
gb = self._groebner_basis_libsingular("groebner", deg_bound=deg_bound, mult_bound=mult_bound, *args, **kwds)
4653-
except (TypeError, NameError): # conversion to Singular not supported
4653+
except (TypeError, NameError, ImportError): # conversion to Singular not supported
46544654
try:
46554655
gb = self._groebner_basis_singular("groebner", deg_bound=deg_bound, mult_bound=mult_bound, *args, **kwds)
4656-
except (TypeError, NameError, NotImplementedError): # conversion to Singular not supported
4656+
except (TypeError, NameError, NotImplementedError, ImportError): # conversion to Singular not supported
46574657
R = self.ring()
46584658
B = R.base_ring()
46594659
if R.ngens() == 0:

src/sage/rings/polynomial/ore_polynomial_element.pyx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1290,7 +1290,8 @@ cdef class OrePolynomial(AlgebraElement):
12901290
sage: a.left_gcd(b)
12911291
Traceback (most recent call last):
12921292
...
1293-
NotImplementedError: inversion of the twisting morphism Ring endomorphism of Fraction Field of Univariate Polynomial Ring in t over Rational Field
1293+
NotImplementedError: inversion of the twisting morphism Ring endomorphism
1294+
of Fraction Field of Univariate Polynomial Ring in t over Rational Field
12941295
Defn: t |--> t^2
12951296
"""
12961297
if self.base_ring() not in _Fields:

src/sage/rings/polynomial/polynomial_element.pyx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7946,7 +7946,9 @@ cdef class Polynomial(CommutativePolynomial):
79467946
(-0.1666666666666667? + 0.552770798392567?*I, 1),
79477947
(0.1812324444698754? + 1.083954101317711?*I, 2)]
79487948
sage: p.roots(ring=CIF)
7949-
[(-0.1666666666666667? - 0.552770798392567?*I, 1), (-0.1666666666666667? + 0.552770798392567?*I, 1), (0.1812324444698754? + 1.083954101317711?*I, 2)]
7949+
[(-0.1666666666666667? - 0.552770798392567?*I, 1),
7950+
(-0.1666666666666667? + 0.552770798392567?*I, 1),
7951+
(0.1812324444698754? + 1.083954101317711?*I, 2)]
79507952
79517953
In some cases, it is possible to isolate the roots of polynomials over
79527954
complex ball fields::
@@ -8294,7 +8296,8 @@ cdef class Polynomial(CommutativePolynomial):
82948296
sage: K.<a> = Qq(3).extension(x^2 + 1) # needs sage.rings.padics
82958297
sage: (x^2 + 1).roots(K) # needs sage.rings.padics
82968298
[(a + O(3^20), 1),
8297-
(2*a + 2*a*3 + 2*a*3^2 + 2*a*3^3 + 2*a*3^4 + 2*a*3^5 + 2*a*3^6 + 2*a*3^7 + 2*a*3^8 + 2*a*3^9 + 2*a*3^10 + 2*a*3^11 + 2*a*3^12 + 2*a*3^13 + 2*a*3^14 + 2*a*3^15 + 2*a*3^16 + 2*a*3^17 + 2*a*3^18 + 2*a*3^19 + O(3^20),
8299+
(2*a + 2*a*3 + 2*a*3^2 + 2*a*3^3 + 2*a*3^4 + 2*a*3^5 + 2*a*3^6 + 2*a*3^7 + 2*a*3^8 + 2*a*3^9 + 2*a*3^10
8300+
+ 2*a*3^11 + 2*a*3^12 + 2*a*3^13 + 2*a*3^14 + 2*a*3^15 + 2*a*3^16 + 2*a*3^17 + 2*a*3^18 + 2*a*3^19 + O(3^20),
82988301
1)]
82998302
83008303
Check that :trac:`31710` is fixed::

src/sage/rings/polynomial/polynomial_ring.py

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -391,7 +391,7 @@ def _element_constructor_(self, x=None, check=True, is_gen=False,
391391
Throw a TypeError if any of the coefficients cannot be coerced
392392
into the base ring (:trac:`6777`)::
393393
394-
sage: RealField(300)['x']( [ 1, ComplexField(300).gen(), 0 ]) # optional - sage.rings.real_mpfr
394+
sage: RealField(300)['x']( [ 1, ComplexField(300).gen(), 0 ]) # needs sage.rings.real_mpfr
395395
Traceback (most recent call last):
396396
...
397397
TypeError: unable to convert '1.00...00*I' to a real number
@@ -884,7 +884,7 @@ def _magma_init_(self, magma):
884884
885885
sage: k.<a> = GF(9) # needs sage.rings.finite_rings
886886
sage: R.<x> = k[] # needs sage.rings.finite_rings
887-
sage: magma(a^2*x^3 + (a+1)*x + a) # optional - magma, needs sage.rings.finite_rings
887+
sage: magma(a^2*x^3 + (a+1)*x + a) # optional - magma # needs sage.rings.finite_rings
888888
a^2*x^3 + a^2*x + a
889889
"""
890890
B = magma(self.base_ring())
@@ -1185,6 +1185,7 @@ def cyclotomic_polynomial(self, n):
11851185
x^4 + 1
11861186
sage: R.cyclotomic_polynomial(12)
11871187
x^4 - x^2 + 1
1188+
11881189
sage: S = PolynomialRing(FiniteField(7), 'x')
11891190
sage: S.cyclotomic_polynomial(12)
11901191
x^4 + 6*x^2 + 1
@@ -2066,15 +2067,15 @@ def __init__(self, base_ring, name="x", sparse=False, implementation=None,
20662067
Sparse Univariate Polynomial Ring in x over Rational Field
20672068
sage: type(R.gen())
20682069
<class 'sage.rings.polynomial.polynomial_ring.PolynomialRing_field_with_category.element_class'>
2069-
sage: R = PRing(CC, 'x'); R # optional - sage.rings.real_mpfr
2070+
sage: R = PRing(CC, 'x'); R # needs sage.rings.real_mpfr
20702071
Univariate Polynomial Ring in x over Complex Field with 53 bits of precision
2071-
sage: type(R.gen()) # optional - sage.rings.real_mpfr
2072+
sage: type(R.gen()) # needs sage.rings.real_mpfr
20722073
<class 'sage.rings.polynomial.polynomial_ring.PolynomialRing_field_with_category.element_class'>
20732074
20742075
Demonstrate that :trac:`8762` is fixed::
20752076
20762077
sage: R.<x> = PolynomialRing(GF(next_prime(10^20)), sparse=True) # needs sage.rings.finite_rings
2077-
sage: x^(10^20) # this should be fast # needs sage.rings.finite_rings
2078+
sage: x^(10^20) # this should be fast # needs sage.rings.finite_rings
20782079
x^100000000000000000000
20792080
"""
20802081
def _element_class():
@@ -2655,6 +2656,7 @@ def _roth_ruckenstein(self, p, degree_bound, precision):
26552656
26562657
EXAMPLES::
26572658
2659+
sage: # needs sage.rings.finite_rings
26582660
sage: F = GF(17)
26592661
sage: Px.<x> = F[]
26602662
sage: Pxy.<y> = Px[]
@@ -3281,11 +3283,11 @@ def residue_field(self, ideal, names=None):
32813283
Traceback (most recent call last):
32823284
...
32833285
ArithmeticError: ideal is not maximal
3284-
sage: R.residue_field(0) # needs sage.rings.finite_rings
3286+
sage: R.residue_field(0)
32853287
Traceback (most recent call last):
32863288
...
32873289
ArithmeticError: ideal is not maximal
3288-
sage: R.residue_field(1) # needs sage.rings.finite_rings
3290+
sage: R.residue_field(1)
32893291
Traceback (most recent call last):
32903292
...
32913293
ArithmeticError: ideal is not maximal
@@ -3311,12 +3313,13 @@ def __init__(self, base_ring, name="x", implementation=None, element_class=None,
33113313
sage: from sage.rings.polynomial.polynomial_ring import PolynomialRing_dense_mod_p
33123314
sage: P = PolynomialRing_dense_mod_p(GF(5), 'x'); P
33133315
Univariate Polynomial Ring in x over Finite Field of size 5
3314-
sage: type(P.gen()) # needs sage.rings.finite_rings
3316+
sage: type(P.gen()) # needs sage.libs.flint
33153317
<class 'sage.rings.polynomial.polynomial_zmod_flint.Polynomial_zmod_flint'>
33163318
3317-
sage: P = PolynomialRing_dense_mod_p(GF(5), 'x', implementation='NTL'); P # needs sage.rings.finite_rings
3319+
sage: # needs sage.libs.ntl
3320+
sage: P = PolynomialRing_dense_mod_p(GF(5), 'x', implementation='NTL'); P
33183321
Univariate Polynomial Ring in x over Finite Field of size 5 (using NTL)
3319-
sage: type(P.gen()) # needs sage.rings.finite_rings
3322+
sage: type(P.gen())
33203323
<class 'sage.rings.polynomial.polynomial_modn_dense_ntl.Polynomial_dense_mod_p'>
33213324
33223325
sage: P = PolynomialRing_dense_mod_p(GF(9223372036854775837), 'x'); P # needs sage.libs.ntl sage.rings.finite_rings
@@ -3326,12 +3329,13 @@ def __init__(self, base_ring, name="x", implementation=None, element_class=None,
33263329
33273330
This caching bug was fixed in :trac:`24264`::
33283331
3332+
sage: # needs sage.rings.finite_rings
33293333
sage: p = 2^64 + 13
3330-
sage: A = GF(p^2) # needs sage.rings.finite_rings
3331-
sage: B = GF(p^3) # needs sage.rings.finite_rings
3332-
sage: R = A.modulus().parent() # needs sage.rings.finite_rings
3333-
sage: S = B.modulus().parent() # needs sage.rings.finite_rings
3334-
sage: R is S # needs sage.rings.finite_rings
3334+
sage: A = GF(p^2)
3335+
sage: B = GF(p^3)
3336+
sage: R = A.modulus().parent()
3337+
sage: S = B.modulus().parent()
3338+
sage: R is S
33353339
True
33363340
"""
33373341
if element_class is None:

0 commit comments

Comments
 (0)