[sage-support] Re: int / Integer question

2008-01-23 Thread William Stein
On Jan 23, 2008 5:33 AM, mabshoff <[EMAIL PROTECTED]> wrote: > > > > On Jan 23, 2:29 pm, "William Stein" <[EMAIL PROTECTED]> wrote: > > On Jan 22, 2008 11:48 PM, Paul Zimmermann <[EMAIL PROTECTED]> wrote: > > > > > > I guess 'long' is based on GMP too, does it make sense to have two > > > concur

[sage-support] Re: int / Integer question

2008-01-23 Thread mabshoff
On Jan 23, 2:29 pm, "William Stein" <[EMAIL PROTECTED]> wrote: > On Jan 22, 2008 11:48 PM, Paul Zimmermann <[EMAIL PROTECTED]> wrote: > > I guess 'long' is based on GMP too, does it make sense to have two > > concurrent > > interfaces to GMP integers? > > Paul Zimmermann > > long is _not_ ba

[sage-support] Re: int / Integer question

2008-01-23 Thread William Stein
On Jan 22, 2008 11:48 PM, Paul Zimmermann <[EMAIL PROTECTED]> wrote: > thank you for your explanations. > > > The 'int' (and its bignum counterpart, 'long') are native Python > > types. As far as I know, we don't modify Python at all; removing > > 'int' would be major surgery, and we're not going

[sage-support] Re: int / Integer question

2008-01-23 Thread pgdoyle
On Jan 22, 2:17 pm, Carl Witty <[EMAIL PROTECTED]> wrote: > 'Integer' is a Sage type. This means it has lots of useful > mathematical convenience methods (like .is_square()), it participates > in the coercion model, etc. Also, 'Integer' is implemented with GMP, > and 'long' is not, so 'Intege

[sage-support] Re: int / Integer question

2008-01-22 Thread Paul Zimmermann
Dear Carl, thank you for your explanations. > The 'int' (and its bignum counterpart, 'long') are native Python > types. As far as I know, we don't modify Python at all; removing > 'int' would be major surgery, and we're not going to do it. > > 'Integer' is a Sage type. This means it ha

[sage-support] Re: int / Integer question

2008-01-22 Thread John Cremona
thanks -- I'll never use anything else from now on! (well ok, I'll use rnage() for loop indices). John On 22/01/2008, William Stein <[EMAIL PROTECTED]> wrote: > > Hi, > > By the way, I very often use the [a..b] notation, which returns > Sage integers, and is very fast and has the (a..b) generat

[sage-support] Re: int / Integer question

2008-01-22 Thread William Stein
Hi, By the way, I very often use the [a..b] notation, which returns Sage integers, and is very fast and has the (a..b) generator notation as well (and is very familiar to Magma users like me): sage: [q for q in [1..100] if q.is_square()] [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] sage: [q for q in (

[sage-support] Re: int / Integer question

2008-01-22 Thread Jason Grout
John Cremona wrote: > Thanks for the detailed explanation -- answering all points except > "Why the s in srange?"! > srange = "sage range"? Jason --~--~-~--~~~---~--~~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this

[sage-support] Re: int / Integer question

2008-01-22 Thread John Cremona
Thanks for the detailed explanation -- answering all points except "Why the s in srange?"! John On 22/01/2008, Carl Witty <[EMAIL PROTECTED]> wrote: > > On Jan 22, 1:31 am, Paul Zimmermann <[EMAIL PROTECTED]> wrote: > > I also "enjoyed" several times converting from 'int' to 'Integer' and back.

[sage-support] Re: int / Integer question

2008-01-22 Thread Carl Witty
On Jan 22, 1:31 am, Paul Zimmermann <[EMAIL PROTECTED]> wrote: > I also "enjoyed" several times converting from 'int' to 'Integer' and back. > For beginners, this is a real difficulty, and in my opinion range? or xrange? > should give a big warning that the "list of integers" output contains Pytho

[sage-support] Re: int / Integer question

2008-01-22 Thread Paul Zimmermann
John, > sage: [q for q in range(100) if q.is_square()] > > --rather, one has to do this > > sage: [q for q in range(100) if Integer(q).is_square()] > [0, 1, 4, 9, 16, 25, 36, 49, 64, 81] > > or even this: > sage: [Integer(q) for q in range(100) if Integer(q).is_square()] > [0, 1, 4, 9,