Ask Your Question

Revision history [back]

There are at least three options:

  • "one over"
  • unary division with "tilda" in prefix notation
  • the inverse_of_unit method of ring elements

Illustration:

sage: K = GF(7)
sage: a = K(5)

sage: 1 / a
3

sage: K.one() / a
3

sage: ~a
3

sage: sage: a.inverse_of_unit()
3

In many other settings, objects that can be inverted also have a method called inverse.

That is however not the case here:

sage: a.inverse()
Traceback (most recent call last)
...
AttributeError: 'sage.rings.finite_rings.integer_mod.IntegerMod_int'
object has no attribute 'inverse'

Maybe such a method could be added for finite field elements.