# Revision history [back]

### Simplification of expression with exponentials.

Hello,

I am looking at expanding the product:

(a+b*g+c*g^2+d*g^3)*(a+b*g^2+c*g^4+d*g)*(a+b*g^3+c*g+d*g^4)*(a+b*g^4+c*g^3+d*g^2)

where $g=e^{2\pi i /5}$ is a fifth root of unity. The problem is, after expanding, and telling sage the value of $g$, it does not collect terms according to the rule $1+g+g^2+g^3+g^4=0$ so there are over 5 times too many terms.

Is there any way to make this simplification automatic? For degrees higher then $5$ going through manually will not be an option. (It is almost faster to multiply everything myself then figure out the collection of the terms)

Thank you very much for any help on this, I have been stuck for the last while