On Mar 20, 2010, at 10:38 AM, Rob Beezer wrote:
I wonder if the category infrastructure would support a pervasive
command like
R=IntegerModRing(7)
R.promote(Fields(), with_check=True)
R.category()
Category of fields
with the construction doing no extra work, and the promote method
having defaults and exceptions consistent with John and Nick's
"explicit is better" philosophy?
I had though about is_field doing the upgrade, but I think these sort
of side-effects are confusing.
Side effects are confusing in general, especially with cached parents.
I would rather have a change_category method that returns a new object
with the updated category, like
sage: R=IntegerModRing(7)
sage: R.change_category(Fields()).is_field()
True
For the record, I'm also -1 to automatic primality checking
(especially inconsistently depending on n), but like the idea of being
able to specify a category.
- Robert
On Mar 20, 10:07 am, Nick Alexander <ncalexan...@gmail.com> wrote:
On 20-Mar-10, at 8:50 AM, John Cremona wrote:
I would say that you should never test for primality unless
specifically required, e.g. if the user asks is_field() (after which
the category could be upgraded? I don't know if that is possible).
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.
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.
+1, I agree with John: no primality testing unless I ask for it, and
even then I would like to be able to specify the category and
override
it.
Nick
--
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.
--
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.