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
alexjbest
changed the title
reading multivariate polynomials from strings stack overflows
reading multivariate polynomials from strings hits RecursionError
Mar 21, 2024
So unless we do our own parsing with a buffer stack (which this comment suggests that it's actively avoided, though someone can definitely take on this task...) this should be unavoidable.
Yes I would think we should replace eval with something more direct at least in some cases, it feels quite ugly to use eval for this to me, I assume that comment means it's just for simplicity / genericity. In this case the polynomial is already in a normal form with no brackets so we can for example split the string on + and - and then polynomialize each piece and then sum them. I think implementing a procedure like this would cover many use cases (and importantly would cover the case of parsing polynomials coming from external systems, e.g. via sage's msolve wrapper).
edit: actually one would need more than this in order for this mwe to work. But the fact that univariate polynomials handle this ok to me seems something must be possible, and to me it seems worth having
Steps To Reproduce
Expected Behavior
10000*x
Actual Behavior
Additional Information
works ok for single variable polynomials
Environment
Checklist
The text was updated successfully, but these errors were encountered: