<< Previous exercise (2.91) | Index | Next exercise (2.93) >>
emm, although I don't code as much as above, I think that we should't just set x's value as 1. Instead, we should sort them lexicographically, so that we can solve more complex situation, such as ((3y+4z)x) add ((3y+4z)x), because the coefficient of x, 3y+4z), is also sorted so we avoid the problem when add (3y+4z) and (3y+4z)
Here is my answer. It gives x a value of 1, and all other variables are 0. So everything will be "raised" to a polynomial in x. I have also implemented mixed operation of polynomials with all the other types used in the chapter.