-
-
Notifications
You must be signed in to change notification settings - Fork 482
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
silently wrong result in coercion between InfinitePolynomialRing and LazyPowerSeriesRing #37756
Comments
In the end, the bug boils down to:
and within
|
@nbruin, help greatly appreciated, of course. |
Making The
I'm not sure what to do about that. Note that this is exactly the coercion from |
I forgot to realize (:-) that this has little to do with the
|
I think the patch below might do the trick. I now get:
However, I get an interesting error message here:
Any ideas what's going on? diff --git a/src/sage/rings/polynomial/infinite_polynomial_element.py b/src/sage/rings/polynomial/infinite_polynomial_element.py
index 76bb926c17..87225b4804 100644
--- a/src/sage/rings/polynomial/infinite_polynomial_element.py
+++ b/src/sage/rings/polynomial/infinite_polynomial_element.py
@@ -560,6 +560,14 @@ class InfinitePolynomial(CommutativePolynomial, metaclass=InheritComparisonClass
"""
return self._p.is_nilpotent()
+ def numerator(self):
+ P = self.parent()
+ return InfinitePolynomial(P, self._p.numerator())
+
+ def denominator(self):
+ P = self.parent()
+ return InfinitePolynomial(P, self._p.denominator())
+
@cached_method
def variables(self):
"""
diff --git a/src/sage/rings/polynomial/infinite_polynomial_ring.py b/src/sage/rings/polynomial/infinite_polynomial_ring.py
index a23b038731..169978acf9 100644
--- a/src/sage/rings/polynomial/infinite_polynomial_ring.py
+++ b/src/sage/rings/polynomial/infinite_polynomial_ring.py
@@ -922,7 +922,7 @@ class InfinitePolynomialRing_sparse(CommutativeRing):
if isinstance(self._base, MPolynomialRing_polydict):
x = sage_eval(repr(), next(self.gens_dict()))
else:
- x = self._base(x)
+ x = self._base.coerce(x)
# remark: Conversion to self._P (if applicable)
# is done in InfinitePolynomial()
return InfinitePolynomial(self, x) |
Fix sagemath#37756 URL: sagemath#37761 Reported by: Martin Rubey Reviewer(s): Martin Rubey, Travis Scrimshaw
Steps To Reproduce
Expected Behavior
The result should either be
a[0]
(ideally with parentLazyPowerSeriesRing(InfinitePolynomialRing(QQ))
) or an error should be raised.Actual Behavior
A nonsense result,
Additional Information
The parent is explained as follows:
It is unclear to me, why we would want to have
The text was updated successfully, but these errors were encountered: