You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sage: P.<a> = InfinitePolynomialRing(QQ)
sage: c = a[0]/(a[0] + 1)
sage: c
a_0/(a_0 + 1)
sage: c.subs({a[0]: 1})
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In [90], line 1
----> 1 c.subs({a[Integer(0)]: Integer(1)})
File ~/sage-trac/src/sage/structure/element.pyx:822, in sage.structure.element.Element.subs()
820 for i in range(ngens):
821 gen = parent.gen(i)
--> 822 if str(gen) in kwds:
823 variables.append(kwds[str(gen)])
824 elif in_dict and gen in in_dict:
File ~/sage-trac/src/sage/structure/sage_object.pyx:221, in sage.structure.sage_object.SageObject.__repr__()
219 except AttributeError:
220 return super().__repr__()
--> 221 return reprfunc()
222
223 def _ascii_art_(self):
File ~/sage-trac/src/sage/rings/fraction_field_element.pyx:478, in sage.rings.fraction_field_element.FractionFieldElement._repr_()
476 '1/x'
477 """
--> 478 if self.is_zero():
479 return "0"
480 s = "%s" % self._numerator
File ~/sage-trac/src/sage/rings/fraction_field_element.pyx:1017, in sage.rings.fraction_field_element.FractionFieldElement.is_zero()
1015 True
1016 """
-> 1017 return self._numerator.is_zero()
1018
1019 def is_one(self):
AttributeError: 'InfinitePolynomialGen' object has no attribute 'is_zero'
Expected Behavior
It should return the result of the substitution.
Actual Behavior
A cryptic error is raised.
Additional Information
The problem is that the fraction field inherits subs from Element. This tries to access the i-th generator of the ring. However, in the InfinitePolynomialRing, the i-the generator actually corresponds to the i-th family of generators. For example:
sage: P.gen(0)
a_*
Note that, for example, symmetric functions do not have gens at all, so Element.subs does nothing and this bug does not surface there.
Environment
irrelevant.
Checklist
I have searched the existing issues for a bug report that matches the one I want to file, without success.
I have read the documentation and troubleshoot guide
The text was updated successfully, but these errors were encountered:
Steps To Reproduce
Expected Behavior
It should return the result of the substitution.
Actual Behavior
A cryptic error is raised.
Additional Information
The problem is that the fraction field inherits
subs
fromElement
. This tries to access thei
-th generator of the ring. However, in theInfinitePolynomialRing
, thei
-the generator actually corresponds to thei
-th family of generators. For example:Note that, for example, symmetric functions do not have
gens
at all, soElement.subs
does nothing and this bug does not surface there.Environment
Checklist
The text was updated successfully, but these errors were encountered: