Dear all,

How should be defined division in non-integral domains like Zmod(6)? The
following looks a bit incoherent to me

  sage: Z6 = Zmod(6)
  sage: a = Z6(4)
  sage: b = Z6(2)
  sage: b.divides(a)
  True
  sage: a // b
  Traceback (most recent call last):
  ...
  ZeroDivisionError: Inverse does not exist.

The reason for the ZeroDivisionError is because the algorithm tries
to invert b and perform a multiplication.

Reading [wiki] the division is well defined when it is unique. So
raising an error seems appropriate. But I would like to ask what
is the most appropriate

 1. do not change anything

 2. raise a more meaningful error (eg an ArithmeticError or
   ValueError with better message)

 3. return an actual quotient

I would vote for 2 and add a method to obtain one quotient or all
possible quotients.

Best
Vincent

[wiki]
https://en.wikipedia.org/wiki/Division_(mathematics)#Abstract_algebra


PS: Maple somehow agrees with [wiki] as it does not define division in Zmod(6)

> with(Domains);
> show(Zmod(6), operations);

`     Signatures for constructor Zmod`
`     note: operations prefixed by  --  are not available`

`      * : (Zmod,Zmod*) -> Zmod`
`      * : (Integers,Zmod) -> Zmod`
`      + : (Zmod,Zmod*) -> Zmod`
`      - : Zmod -> Zmod`
`      - : (Zmod,Zmod) -> Zmod`
`      0 : Zmod`
`      1 : Zmod`
`      <> : (Zmod,Zmod) -> Boolean`
`      = : (Zmod,Zmod) -> Boolean`
`  --  Characteristic : Integers`
`      Coerce : Integers -> Zmod`
`      Index : Integers -> Zmod`
`      Input : Expression -> Union(Zmod,FAIL)`
`      Inv : Zmod -> Union(Zmod,FAIL)`
`      Lookup : Zmod -> Integers`
`      Output : Zmod -> Expression`
`      Random : () -> Zmod`
`      Size : Integers`
`      Type : Expression -> Boolean`
`      Universe : () -> Zmod*`
`      ^ : (Zmod,Integers) -> Zmod`

PPS: people with access to magma are welcome to report!

--
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.

Reply via email to