Skip to content

Commit 48952fb

Browse files
author
Release Manager
committed
Trac #34789: fixes in normal_basis
remove deprecation from #29543 and makes sure that the code works to get the full basis in presence of weights. URL: https://trac.sagemath.org/34789 Reported by: chapoton Ticket author(s): Frédéric Chapoton Reviewer(s): Christoph Sorger
2 parents a510047 + dafcbff commit 48952fb

File tree

1 file changed

+10
-14
lines changed

1 file changed

+10
-14
lines changed

src/sage/rings/polynomial/multi_polynomial_ideal.py

Lines changed: 10 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3093,12 +3093,21 @@ def _normal_basis_libsingular(self, degree, weights=None):
30933093
sage: I = R.ideal(x^2-2*x*z+5, x*y^2+y*z+1, 3*y^2-8*x*z)
30943094
sage: I._normal_basis_libsingular(5)
30953095
[]
3096+
3097+
Check what happens with weights but no degree (:trac:`34789`)::
3098+
3099+
sage: TO = TermOrder('wdegrevlex', (2,))
3100+
sage: R = PolynomialRing(QQ, 1, ['k'], order=TO)
3101+
sage: k = R.gen()
3102+
sage: I = R.ideal([k**2])
3103+
sage: I.normal_basis()
3104+
[k, 1]
30963105
"""
30973106
from sage.rings.polynomial.multi_polynomial_ideal_libsingular import kbase_libsingular
30983107
from sage.rings.polynomial.multi_polynomial_sequence import PolynomialSequence
30993108
gb = self._groebner_basis_libsingular()
31003109
J = self.ring().ideal(gb)
3101-
if weights is None:
3110+
if weights is None or degree is None:
31023111
res = kbase_libsingular(J, degree)
31033112
else:
31043113
from sage.libs.singular.function_factory import ff
@@ -3180,21 +3189,8 @@ def normal_basis(self, degree=None, algorithm='libsingular',
31803189
sage: S.<x,y,z> = PolynomialRing(GF(2), order=T)
31813190
sage: S.ideal(x^6 + y^3 + z^2).normal_basis(6, algorithm='singular')
31823191
[x^4*y, x^2*y^2, y^3, x^3*z, x*y*z, z^2]
3183-
3184-
Check the deprecation::
3185-
3186-
sage: R.<x,y> = PolynomialRing(QQ)
3187-
sage: _ = R.ideal(x^2+y^2, x*y+2*y).normal_basis('singular')
3188-
doctest:...: DeprecationWarning: "algorithm" should be used as keyword argument
3189-
See https://trac.sagemath.org/29543 for details.
31903192
"""
31913193
from sage.rings.polynomial.multi_polynomial_sequence import PolynomialSequence
3192-
if isinstance(degree, str):
3193-
from sage.misc.superseded import deprecation
3194-
deprecation(29543,
3195-
'"algorithm" should be used as keyword argument')
3196-
algorithm = degree
3197-
degree = None
31983194

31993195
weights = tuple(x.degree() for x in self.ring().gens())
32003196
if all(w == 1 for w in weights):

0 commit comments

Comments
 (0)