On Sat, Mar 20, 2010 at 03:50:43PM +0000, John Cremona wrote:
> There are surely many other similar situations, for example when
> constructing a commutative ring it might be expensive to determine
> whether or not it is an Integral Domain.

Yup.

> I would always use GF(p) rather than IntegerMod(p) for when I know p
> is prime.  it is is vital in teaching primality tests and the like
> that one can form IntegerModRing(n) without knowing (or automatically
> testing behind the scenes) whether or not n is prime.

Here is a typical situation where this feature could be desirable:

Imagine that, in some deep construction, you construct internally a
Z/nZ, without knowing in advance whether n is prime or not; then later
on, you build some module M over it, and do some intensive linear
algebra over it. Then you would want the linear algebra to
automatically make use of the fact that M is a vector space for faster
calculations.

The first option is for the caller to do the primality test himself;
but I find this a bit invasive (I need to know something about Z/nZ to
do this); there might be similar situations where the test to be used
could be less trivial.

Another option is something like:

        IntegerModRing(n, category="best_possible")

Alternatively, since it was pointed out that, given the name, it could
be surprising for IntegerModRing to return a field (unless asked for
explicitly), an option would be to leave IntegerModRing as is, and on
the other hand, to have the current:

        Integers(5)

return GF(5) automatically.

(which exploits the optimized Givaro implementation)

Best,
                                Nicolas
--
Nicolas M. ThiƩry "Isil" <nthi...@users.sf.net>
http://Nicolas.Thiery.name/

-- 
To post to this group, send an email to sage-devel@googlegroups.com
To unsubscribe from this group, send an email to 
sage-devel+unsubscr...@googlegroups.com
For more options, visit this group at http://groups.google.com/group/sage-devel
URL: http://www.sagemath.org

To unsubscribe from this group, send email to 
sage-devel+unsubscribegooglegroups.com or reply to this email with the words 
"REMOVE ME" as the subject.

Reply via email to