Re: [sage-devel] gcd with integers mod n

2011-12-11 Thread Keshav Kini
On Sun, Dec 11, 2011 at 15:57, William Stein wrote: > Any of the choices you mentioned above would be fine, but 5 is the > best answer, just like this is best: > >  sage: gcd(6/1, 9/1) >  3 >  sage: parent(gcd(6/1, 9/1)) >  Rational Field I more or less see what you're getting at, I think, but ju

Re: [sage-devel] gcd with integers mod n

2011-12-11 Thread Marco Streng
2011/12/11 Marco Streng : > Recently, #10771 changed the answer from 1 to 5 (both correct), but (this change was caused by the fact that 7 is now coerced to ZZ/7ZZ first, before being coerced back to ZZ, where it is 0) -- To post to this group, send an email to sage-devel@googlegroups.com To uns

Re: [sage-devel] gcd with integers mod n

2011-12-11 Thread Marco Streng
2011/12/11 Marco Streng : > did correct the type from Integer to IntegerMod. (sorry, that should have been "did not") -- 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,

Re: [sage-devel] gcd with integers mod n

2011-12-11 Thread Marco Streng
2011/12/11 Jeroen Demeyer : > On 2011-12-11 21:44, Marco Streng wrote: >> 2011/12/11 William Stein : >>> sage: parent(gcd(Mod(5,7), 7)) >>> Integer Ring >>> >>> which... sucks!    I consider this a bug.  We should definitely have >>> that the gcd is in parent(Mod(5,7)). >> >> This bug seems to be a

Re: [sage-devel] gcd with integers mod n

2011-12-11 Thread Jeroen Demeyer
On 2011-12-11 21:44, Marco Streng wrote: > 2011/12/11 William Stein : >> sage: parent(gcd(Mod(5,7), 7)) >> Integer Ring >> >> which... sucks!I consider this a bug. We should definitely have >> that the gcd is in parent(Mod(5,7)). > > This bug seems to be as old as http://trac.sagemath.org/sag

Re: [sage-devel] gcd with integers mod n

2011-12-11 Thread Marco Streng
2011/12/11 William Stein : > sage: parent(gcd(Mod(5,7), 7)) > Integer Ring > > which... sucks!    I consider this a bug.  We should definitely have > that the gcd is in parent(Mod(5,7)). This bug seems to be as old as http://trac.sagemath.org/sage_trac/ticket/4443 If "a" in "gcd(a,b)" has no attr

Re: [sage-devel] gcd with integers mod n

2011-12-10 Thread William Stein
On Sat, Dec 10, 2011 at 11:52 PM, Keshav Kini wrote: > Correct me if I'm wrong, but divisibility is only a partial order (and thus > gcds are only unique) modulo associates. Everything but 0 is a unit in Z/7Z, > an integral domain, so any of 1, 2, 3, 4, 5, or 6 would be an acceptable > value for t

Re: [sage-devel] gcd with integers mod n

2011-12-10 Thread Keshav Kini
Correct me if I'm wrong, but divisibility is only a partial order (and thus gcds are only unique) modulo associates. Everything but 0 is a unit in Z/7Z, an integral domain, so any of 1, 2, 3, 4, 5, or 6 would be an acceptable value for the gcd of 5 and 7(=0), no? Or is the "common parent" somet

Re: [sage-devel] gcd with integers mod n

2011-12-10 Thread David Roe
>> 4.7.2.alpha4, 4.8.alpha3: >> >> sage: five = Integers(7).list()[5]; five >> 5 >> sage: five.parent() >> Ring of integers modulo 7 >> sage: gcd(Integer(five), Integer(7)) >> 1 >> sage: gcd(five, 7) >> 5 >> > > I like the new behavior better.   It's coercing to the common parent,  then > giving a

Re: [sage-devel] gcd with integers mod n

2011-12-10 Thread William Stein
On Dec 10, 2011 4:12 PM, "Rob Beezer" wrote: > > Is the change in behavior below intended? I know there have been some > recent in-depth discussions about the GCD, so I might have well missed > it, in which case I apologize for bringing it up again. > > Rob > > 4.7.1: > > sage: five = Integers(7)