Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

If you ask about computing multiplicative inverse modulo an irreducible polynomial, then this can be done by defining a corresponding quotient ring. For example, the following code inverts $x+1$ modulo $x^4+x+1$ over the field $GF(2)$:

R.<x> = PolynomialRing(GF(2))
K.<a> = R.quotient_ring(x^4+x+1)
print( (a+1)^(-1) )

Here a stands for a zero of $x^4+x+1$, which also may be thought of as the image of $x$ in the quotient ring.