Ask Your Question

Revision history [back]

You will find your inverse if you work over the rationals, that is if $ R = \mathbb{Q}[x] /(x^7 -1)$. There, you can do:

sage: R.<x> = QQ[]
sage: RR = R.quotient(x^7 - 1)
sage: f = RR(x^6-x^4+x^3+x^2-1)
sage: g = f^(-1)
sage: g
16/43*xbar^6 + 11/43*xbar^5 + 21/43*xbar^4 + 1/43*xbar^3 - 2/43*xbar^2 + 4/43*xbar - 8/43
sage: g*f
1
sage: f*g
1

You will find your inverse if you work over the rationals, that is if $ R = \mathbb{Q}[x] /(x^7 -1)$. There, you can do:

sage: R.<x> = QQ[]
sage: RR = R.quotient(x^7 - 1)
sage: f = RR(x^6-x^4+x^3+x^2-1)
sage: g = f^(-1)
sage: g
16/43*xbar^6 + 11/43*xbar^5 + 21/43*xbar^4 + 1/43*xbar^3 - 2/43*xbar^2 + 4/43*xbar - 8/43
sage: g*f
1
sage: f*g

EDIT answers to the further questions asked in comment:

If you want to work on $ R = (\mathbb{Z} /7 \mathbb{Z}) /(x^7 -1)$, this is very similar:

sage: Zmod(7)
Ring of integers modulo 7
sage: R.<x> = Zmod(7)[]
sage: R
Univariate Polynomial Ring in x over Ring of integers modulo 7
sage: RR = R.quotient(x^7 - 1)
sage: RR
Univariate Quotient Polynomial Ring in xbar over Ring of integers modulo 7 with modulus x^7 + 6
sage: f = RR(x^6-x^4+x^3+x^2-1)
sage: f
xbar^6 + 6*xbar^4 + xbar^3 + xbar^2 + 6
sage: g = f^(-1)
sage: g
2*xbar^6 + 4*xbar^5 + xbar^3 + 5*xbar^2 + 4*xbar + 6
sage: g.parent()
Univariate Quotient Polynomial Ring in xbar over Ring of integers modulo 7 with modulus x^7 + 6
sage: g*f
1
sage: f*g
1

As for your second question, when i write R.<x>=... i define both the polynomial ring R and its undeterminate x, so x^6-x^4+x^3+x^2-1 is an element of R. when i write RR(x^6-x^4+x^3+x^2-1), i make a conversion of x^6-x^4+x^3+x^2-1 into the quotient ring RR, you can have a look at : http://doc.sagemath.org/html/en/tutorial/tour_coercion.html to learn more.