Ask Your Question

Revision history [back]

Instead of thinking exp as a symbolic expression with the symbol q, you should define it as a polynomial on the field F with undeterminate q, and then work modulo q^14-1. So, you can do:

sage: K.<xi> = CyclotomicField(7)
sage: R.<q> = PolynomialRing(K)
sage: P = q^16*xi^5 + (q^325 - 12*q^235)*xi^2
sage: P
xi^2*q^325 - 12*xi^2*q^235 + xi^5*q^16
sage: P.parent()
Univariate Polynomial Ring in q over Cyclotomic Field of order 7 and degree 6
sage: P.mod(q^14-1)
-12*xi^2*q^11 + xi^2*q^3 + xi^5*q^2

You can also work in the quotient ring defined by the ideal generated by (q^14-1) if necessary:

sage: I = R.ideal(q^14-1)
sage: Q = R.quotient(I)
sage: Q
Univariate Quotient Polynomial Ring in qbar over Cyclotomic Field of order 7 and degree 6 with modulus q^14 - 1
sage: Q(P)
-12*xi^2*qbar^11 + xi^2*qbar^3 + xi^5*qbar^2

Instead of thinking exp as a symbolic expression with the symbol q, on which you pus assumptions, you should define it as a polynomial on the field F with undeterminate q, and then work modulo q^14-1. So, you can do:

sage: K.<xi> = CyclotomicField(7)
sage: R.<q> = PolynomialRing(K)
sage: P = q^16*xi^5 + (q^325 - 12*q^235)*xi^2
sage: P
xi^2*q^325 - 12*xi^2*q^235 + xi^5*q^16
sage: P.parent()
Univariate Polynomial Ring in q over Cyclotomic Field of order 7 and degree 6
sage: P.mod(q^14-1)
-12*xi^2*q^11 + xi^2*q^3 + xi^5*q^2

You can also work in the quotient ring defined by the ideal generated by (q^14-1) if necessary:

sage: I = R.ideal(q^14-1)
sage: Q = R.quotient(I)
sage: Q
Univariate Quotient Polynomial Ring in qbar over Cyclotomic Field of order 7 and degree 6 with modulus q^14 - 1
sage: Q(P)
-12*xi^2*qbar^11 + xi^2*qbar^3 + xi^5*qbar^2

Instead of thinking exp as a symbolic expression with the symbol q on which you pus assumptions, you should define it as a polynomial on the field F with undeterminate indeterminate q, and then work modulo q^14-1. So, you can do:

sage: K.<xi> = CyclotomicField(7)
sage: R.<q> = PolynomialRing(K)
sage: P = q^16*xi^5 + (q^325 - 12*q^235)*xi^2
sage: P
xi^2*q^325 - 12*xi^2*q^235 + xi^5*q^16
sage: P.parent()
Univariate Polynomial Ring in q over Cyclotomic Field of order 7 and degree 6
sage: P.mod(q^14-1)
-12*xi^2*q^11 + xi^2*q^3 + xi^5*q^2

You can also work in the quotient ring defined by the ideal generated by (q^14-1) if necessary:

sage: I = R.ideal(q^14-1)
sage: Q = R.quotient(I)
sage: Q
Univariate Quotient Polynomial Ring in qbar over Cyclotomic Field of order 7 and degree 6 with modulus q^14 - 1
sage: Q(P)
-12*xi^2*qbar^11 + xi^2*qbar^3 + xi^5*qbar^2