2013/10/8 Peter Bruin <pjbr...@gmail.com>

> sage: Mod(2,6)==Mod(4,8)
>
True
>


> sage: Mod(1,3)==Mod(2,4)
> False
>

Wow, that's because the first two are compared in the common quotient
Zmod(2) of Zmod(6) and Zmod(8), but a special case was made to disallow
using the common quotient Zmod(1) of Zmod(3) and Zmod(4):

sage: (Mod(2,6)-Mod(4,8)).parent() # This is a mathematically reasonable
answer, and explains the "True" above.
Ring of integers modulo 2
sage: sage.categories.pushout.pushout(Zmod(8), Zmod(6))
Ring of integers modulo 2
sage: (Mod(1,3)-Mod(2,4)).parent() # And here is the reason for the "False"
above.
TypeError: unsupported operand parent(s) for '-': 'Ring of integers modulo
3' and 'Ring of integers modulo 4'
sage: sage.categories.pushout.pushout(Zmod(4), Zmod(3)) # And here is the
reason for the TypeError above:
CoercionException: Trivial quotient intersection.

So it seems that sage.categories.pushout.pushout(Zmod(m), Zmod(n)) is
Zmod(gcd(m,n)) unless m and n are coprime, in which case it raises an error.

This looks like a rather inconsistent choice to me.



>
> Unfortunately it is hard to think of a simple rule that gives the desired
> behaviour in all of the following cases:
>
> sage: Mod(1, 3) == ZZ(1)
> True  # current behaviour; certainly OK
> sage: Mod(1, 3) == QQ(1)
> False  # current behaviour; probably OK, but True wouldn't be completely
> wrong
> sage: Mod(1, 3) == Mod(1, 4)
> False  # current behaviour; certainly OK
> sage: Mod(1,3) == Mod(1, 6)
> True  # current behaviour; probably OK, but False wouldn't be completely
> wrong
> sage: Mod(2, 6)==Mod(4, 8)
> False  # currently yields True
> sage: 2/1 in ZZ
> True
> sage: Mod(3, 5) in ZZ
> False  # currently yields True
> sage: Mod(1,3) in Zmod(6)
> False  # currently yields True
> sage: Mod(2,4) in Zmod(6)
> False  # currently yields True
>
> Peter
>
>  --
> 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 http://groups.google.com/group/sage-devel.
> For more options, visit https://groups.google.com/groups/opt_out.
>

-- 
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 http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to