Problem with InfinitePolynomialRing

60 views
Skip to first unread message

Martin R

unread,
Apr 2, 2024, 8:17:19 AM4/2/24
to sage-devel
The following is giving me a headache.  In a fresh session, do

sage: R.<a> = InfinitePolynomialRing(SR)
sage: p = a[0].polynomial()
sage: R(p)
...
RuntimeError: Symbolic Ring still using old coercion framework

I tried all day to make sense of the element_constructor of the InfinitePolynomialRIng (which uses sage_eval to interpret the repr), but I failed.

Martin

julian...@fsfe.org

unread,
Apr 10, 2024, 10:10:13 AM4/10/24
to sage-devel
Hi Martin,

On Tuesday, April 2, 2024 at 3:17:19 PM UTC+3 Martin R wrote:
I tried all day to make sense of the element_constructor of the InfinitePolynomialRIng (which uses sage_eval to interpret the repr), but I failed.

That string eval is quite curious. I have no clue why it's necessary. However, isn't the underlying issue that the symbolic ring has no gens (and no ngens, and no gens_dict)?  I have no clue what the correct implementation could look like but all these just throwing a RuntimeError looks quite wrong to me. Any other implementation seems to improve the situation:

sage: class SR_(sage.symbolic.ring.SymbolicRing):
....:     def gens_dict(self): return {}
....:
sage: SR = SR_()

sage: R.<a> = InfinitePolynomialRing(SR)
sage: p = a[0].polynomial()
sage: R(p)
a_0

Alternatively,

sage: class SR_(sage.symbolic.ring.SymbolicRing):
....:     def gens_dict(self): raise ValueError() # caught by the infinite polynomial ring
[...]
sage: R(p)
ValueError: cannot convert a_0 into an element of Infinite polynomial ring in a over Symbolic Ring - no conversion into underlying polynomial ring

I'm also no expert when it comes to the symbolic ring. But I'm on Zulip if you want to investigate together what's going on.

julian
Reply all
Reply to author
Forward
0 new messages