1
$\begingroup$

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?

$\endgroup$
3
  • $\begingroup$ Have you tried defining the polynomial ring over $K$? as here? $\endgroup$
    – sharding4
    Jun 27, 2018 at 17:20
  • $\begingroup$ @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'" $\endgroup$
    – Chris
    Jun 27, 2018 at 21:47
  • $\begingroup$ @sharding4 I was using the 27th cyclotomic field, and I used the symbol $y$ as the generator for the polynomial FYI. $\endgroup$
    – Chris
    Jun 27, 2018 at 21:50

1 Answer 1

1
$\begingroup$

Try something like

K.=CyclotomicField(8)

R=PolynomialRing(K,'t')

t=R.0

(z*t)^8

I get t^8 for the answer.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.