Dear Álinson,

This is now fixed in the new release sage-6.5

sage: xgcd(4,2)
(2, 0, 1)
sage: xgcd(Rational(4),Rational(2))
(2, 0, 1)

But be careful that the output type depends on the input

sage: a,b,c = xgcd(4,2)
sage: d,e,f = xgcd(Rational(4), Rational(2))
sage: type(a), type(b), type(c)
(<type 'sage.rings.integer.Integer'>,
 <type 'sage.rings.integer.Integer'>,
 <type 'sage.rings.integer.Integer'>)
sage: type(d), type(e), type(f)
(<type 'sage.rings.rational.Rational'>,
 <type 'sage.rings.rational.Rational'>,
 <type 'sage.rings.rational.Rational'>)

Vincent

On 25/01/2015, Vincent Delecroix <[email protected]> wrote:
> Hello
>
> 2015-01-25 19:14 UTC+01:00, Álinson S Xavier <[email protected]>:
>> Vincent Delecroix <[email protected]> wrote:
>>> Anyway, the answer you got is perfectly valid and it would actually
>>> make confusion to not return the trivial answer (1, 1/a, 0) in the
>>> case of fields. Do you still think this is a bug?
>>
>> I am not sure. This behavior did cause a subtle bug in my application.
>> I made sure the arguments to xgcd were rational numbers with denominator
>> one, but I forgot to actually cast them into integers.
>>
>> It also disagrees with the gcd function:
>>
>>   sage: gcd(6/1,2/1)
>>   2
>>   sage: xgcd(6/1,2/1)
>>   (1, 1/6, 0)
>
> Right, this is unfortunate. But the answer is still valid (since 2 is
> a unit of the rational numbers). The problem comes from the fact that
> all "quotient fields" (fields that come from the quotient of a ring)
> have a custom gcd function that takes care of that but no associated
> xgcd. I opened a ticket for that at
>     http://trac.sagemath.org/ticket/17671
> (this is the way things are modified in Sage)
>
> It should be fixed in the next release in which you will have
> {{{
> sage: gcd(6/1,2/1)
> 2
> sage: xgcd(6/1,2/1)
> (2, 0, 1)
> }}}
>
> Thanks for you report and your insistence ;-)
> Vincent
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.

Reply via email to