Skip to content

Commit 8049b4d

Browse files
author
Release Manager
committed
gh-39059: Make multivariate ideal reduce() work on integer Fixes #38560. ### 📝 Checklist <!-- Put an `x` in all the boxes that apply. --> - [x] The title is concise and informative. - [x] The description explains in detail what this PR is about. - [x] I have linked a relevant issue or discussion. - [x] I have created tests covering the changes. - [ ] I have updated the documentation and checked the documentation preview. URL: #39059 Reported by: user202729 Reviewer(s): Travis Scrimshaw, user202729
2 parents c3c001f + b643931 commit 8049b4d

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/sage/rings/polynomial/multi_polynomial_ideal.py

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -248,6 +248,7 @@
248248
from sage.rings.integer_ring import ZZ
249249
from sage.rings.noncommutative_ideals import Ideal_nc
250250
from sage.rings.qqbar_decorators import handle_AA_and_QQbar
251+
from sage.structure.element import parent
251252
from sage.structure.richcmp import (op_EQ, op_GE, op_GT, op_LE, op_LT, op_NE,
252253
rich_to_bool, richcmp_method)
253254
from sage.structure.sequence import Sequence
@@ -4965,6 +4966,23 @@ def reduce(self, f):
49654966
49664967
Requires computation of a Groebner basis, which can be a
49674968
very expensive operation.
4969+
4970+
TESTS:
4971+
4972+
Check for :issue:`38560`::
4973+
4974+
sage: I.reduce(1)
4975+
1
4976+
sage: I.reduce(1r)
4977+
1
4978+
sage: I.reduce(pi.n())
4979+
Traceback (most recent call last):
4980+
...
4981+
TypeError: no canonical coercion from Real Field with 53 bits of precision to Multivariate Polynomial Ring in x, y over Rational Field
4982+
sage: I.reduce(float(pi.n()))
4983+
Traceback (most recent call last):
4984+
...
4985+
TypeError: no canonical coercion from <class 'float'> to Multivariate Polynomial Ring in x, y over Rational Field
49684986
"""
49694987
try:
49704988
strat = self._groebner_strategy()
@@ -4973,6 +4991,7 @@ def reduce(self, f):
49734991
pass
49744992

49754993
gb = self.groebner_basis()
4994+
f = self.ring().coerce(f)
49764995
return f.reduce(gb)
49774996

49784997
def _contains_(self, f):

0 commit comments

Comments
 (0)