I have an issue with the reconstruction of a polynomial using FromDigits.
The documentation of the function CoefficientList says:
Fold the operation for multivariate polynomials:
CoefficientList[(x + 2 y)^3, {x, y}]
{{0, 0, 0, 8}, {0, 0, 12, 0}, {0, 6, 0, 0}, {1, 0, 0, 0}}
Fold[FromDigits[Reverse[#1], #2] &, %, {x, y}]
x^3 + 6 x^2 y + y^2 (12 x + 8 y)
Now remove the third power and try this minimal example:
CoefficientList[x + 2 y, {x, y}]
{{0, 2}, {1, 0}}
Fold[FromDigits[Reverse[#1], #2] &, %, {x, y}]
1/x + x y
I'm pretty sure I am missing something here, maybe something with small order polynomials as adding anything higher than first order solves the issue.
However in my problem I need to reconstruct a polynomial of order one in one of its variables...
Sorry if this is very simple but I did google it and read through the documentation several times...
In[236]:= FromDigits[{{1, 0}, 0}, x] Out[236]= 1/xis probably not what you are anticipating for the behavior. Now make that second0into the list{0,2}and you get the behavior you are seeing. Again, not what you had wanted. MappingFromDigitsseems like a viable way to go. $\endgroup$