I have to characterize a very large polynomial expression of many variables (x1,x2,....,xn) as follow:
- the power of each of the monomial terms forms an ordered tuple which will be saved as the keys of a dictionary.
- the coefficient of that monomic expression is saved as the value of that particular key.
Example: if p=Poly(3*x1**2 - x1*x2 + 5*x2 +7)
dic={"(2,0)":3 , "(1,1)":-1 , "(0,1)": 5 , "(0,0)": 7}
It is very important that the first component of the tuple always be the power associated with x1 and if I run the same code again with a new poly with no x1 variable, it put a zero in its first component.