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

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/d5c11f89-8813-44a9-994c-5d7ee0f346d1n%40googlegroups.com.

Reply via email to