Hi,

1. (On Sage syntax):
For the record, there are some reasons why ZZ in Fields doesn't
(and perhaps shouldn't) make sense:  Fields is a function not the
category it returns:

sage: Fields
<class 'sage.categories.fields.Fields'>
sage: Fields()
Category of fields

I think a student learning Sage should have a first session in which
they learn that every function takes parentheses, and that there are
some pre-defined objects at their disposal.

The ring ZZ and field QQ are pre-defined for the ease of the user,
and are not the same beasts.  Is is true that ZZ(n) is valid, but is
meant to create an integer, e.g. ZZ(1).  For empty argument it
defaults to ZZ(0), which allows '5/1 in ZZ()' to give an error in a
confusing place.  This should not be confused with the category
constructors VectorSpaces, Fields, etc.

In the same vane as pre-defining ZZ and QQ, one could pre-define
some defaults Flds = Fields() and Vect = VectorSpaces() globally,
but unlike ZZ, QQ, RR, and CC, I think the naive or first-time user
does not  usually need to have these categories at hand or need
to know anything about categories to use Sage.

Doing some magic to make 'QQ^2 in VectorSpaces' work
might just do injustice to first-time users, since it defers
the realization that they just made a typo -- unless
VectorSpaces is no longer a Python class:

sage: VectorSpaces
<class 'sage.categories.vector_spaces.VectorSpaces'>

rather an instance of the category of vector spaces.

2. (On is_Name):
Regarding is_PrimeField(F) and ilk -- remove them:
instead the syntax F.is_prime_field() is (or should be)
implemented:

sage: F = FiniteField(2)
sage: F.is_prime_field()
True
sage: F.<a> = FiniteField(8)
sage: F.is_prime_field()
False

for all fields.  Where is is not, or incorrect (!):

sage: K.<a> = NumberField(x-2/3)
sage: K.is_prime_field()
False

this should be fixed.  And someone should
certainly create a trac item to for this bug.

--David



On Mar 28, 11:00 am, Keshav Kini <keshav.k...@gmail.com> wrote:
> Florent Hivert <florent.hiv...@lri.fr> writes:
> >>     sage: ZZ in Fields
> >>     False
> >>     sage: ZZ in Fields()
> >>     False
> >>     sage: QQ in Fields
> >>     True
> >>     sage: QQ in Fields()
> >>     True
>
> >> I don't pretend to understand why this is the case :) But maybe it's
> >> better if we tell new users to use `ZZ in Fields` instead of `ZZ in
> >> Fields()`, to minimize confusion...? Or maybe doing so would be
> >> misleading in ways I haven't realized?
>
> > It works because Nicolas did the work (Ticket #9469 Category membership,
> > without arguments, Merged in: sage-5.0.beta6).
>
> Awesome! :D Thanks, Nicolas!
>
>
>
>
>
>
>
>
>
> > I think you are right
> > saying that we should teach "QQ in Fields" to beginner rather than
> > "QQ in Fields()", except that if I remember correctly, there is a 
> > performance
> > issue for the short notation. Also they don't have the exact same meaning. 
> > The
> > difference is apparent in
>
> >     sage: QQ^2 in VectorSpaces(QQ)
> >     True
> >     sage: QQ^2 in VectorSpaces
> >     True
> >     sage: QQ^2 in VectorSpaces(CC)
> >     False
>
> > Note that they are still some mathematically surprising answers:
>
> >     sage: QQ in VectorSpaces(QQ)      # bootstrap problem
> >     False
> >     sage: QQbar in VectorSpaces(QQ)
> >     False
>
> Interesting...
>
> > So the answer is: thinks are going better in each new Sage release.
>
> That is all one can hope for :)
>
> -Keshav
>
> ----
> Join us in #sagemath on irc.freenode.net !

-- 
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

Reply via email to