# Revision history [back]

Coincidentally, something like this was the first thing I did with SAGE. Glad I can help you. It's really magic, but here's how it goes. Try to copy this in a SAGE notebook cell:

R=PolynomialRing(ZZ,'x,a,b,c,d')
x,a,b,c,d=R.gens()
S=R.quotient(1+x+x^2+x^3+x^4,'g,a,b,c,d')
g,a,b,c,d=S.gens()


Just to make sure, evaluate

g^5-1


(it should work out to 0). Then evaluate

(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)


and sure enough, the answer follows:

a^4 - a^3*b + a^2*b^2 - a*b^3 + b^4 - a^3*c + 2*a^2*b*c - 3*a*b^2*c -
b^3*c + a^2*c^2 + 2*a*b*c^2 + b^2*c^2 - a*c^3 - b*c^3 + c^4 - a^3*d +
2*a^2*b*d + 2*a*b^2*d - b^3*d - 3*a^2*c*d - a*b*c*d + 2*b^2*c*d +
2*a*c^2*d - 3*b*c^2*d - c^3*d + a^2*d^2 - 3*a*b*d^2 + b^2*d^2 +
2*a*c*d^2 + 2*b*c*d^2 + c^2*d^2 - a*d^3 - b*d^3 - c*d^3 + d^4