# Multiplication over a cyclotomic field in terms of polynomials over the generators.

I'm currently experimenting with multiplication over cyclotomic fields with SageMath. Say we take the example $K=\mathbb{Q}(\zeta_8)$. Then taking the generator of the field as $z$, we define this in Sage as

sage: K.<z>=CyclotomicField(8)


If I take linear combinations of polynomials over the generator $z$ for specific numbers, Sage will perform the multiplication and output a polynomial in terms of the $z$-basis, e.g.

sage: 4*(1+z)
4*z + 4
sage: (1-z)*(4+z^2)
-z^3 + 5*z + 6


However, when using symbolic variables Sage will perform multiplication over the general complex domain instead of outputting the answer in terms of the $z$-basis. For example:

sage: var('x0 x1 x2 x3')
(x0, x1, x2, x3)
sage: x1*z
(1/2*I + 1/2)*sqrt(2)*x1


I have tried forcing Sage to assume the symbols are rationals but this doesn't seem to work. Maybe I'm just being stupid, but how do I get Sage to perform multiplication over symbolic variables in terms of the basis for the field?

• Have you tried defining the polynomial ring over $K$? as here? Jun 27, 2018 at 17:20
• @sharding4 thanks for the response! I just tried the polynomial ring mod the corresponding cyclotomic polynomial for the field and tried performing arithmetic with symbolic variables again, the error I got was "TypeError: unsupported operand parent(s) for *: 'Symbolic Ring' and 'Univariate Quotient Polynomial Ring in y over Rational Field with modulus x^18 + x^9 + 1'" Jun 27, 2018 at 21:47
• @sharding4 I was using the 27th cyclotomic field, and I used the symbol $y$ as the generator for the polynomial FYI. Jun 27, 2018 at 21:50

Try something like

K.=CyclotomicField(8)

R=PolynomialRing(K,'t')

t=R.0

(z*t)^8

I get t^8 for the answer.

• How would I go about defining multiple symbolic variables over the ring? e.g.$(x +yz)*wz^3, x,y,w$ symbolic variables? Jun 27, 2018 at 22:14
• S=PolynomialRing(K,3,"x") # here, 3 = number of variables x0=S.0 x1=S.1 x2=S.2 Jun 27, 2018 at 22:18
• Or maybe S = K['x,y,z']. x=S.0 y=S.1 z=S.2 Jun 27, 2018 at 22:21
• Spot on - thanks a lot! Jun 27, 2018 at 22:24