On Monday, August 27, 2007, at 06:37PM, "William Stein" <[EMAIL PROTECTED]> 
wrote:
>On 8/27/07, Justin Walker <[EMAIL PROTECTED]> wrote:
>> Hi, all,
>>
>> I do this, and get integers, but the types are rational:
>>
>> sage: b1=0
>> sage: b2=2
>> sage: s=(b1+b2)/2
>> sage: n=(b1-b2)/2
>> sage: s
>> 1
>> sage: n
>> -1
>
>That s and n are rational is correct, since "/ is a constructor
>for elements of the fraction field".   If you want integers
>you might do a floor div or explicit coercion:

This I get; I was just setting up for the problem below (I phrased my comment
badly, perhaps).

>> Then I do this:
>>
>> sage: xgcd(s,n)
>> ---------------------------------------------------------------------------
>> <type 'exceptions.AttributeError'>        Traceback (most recent call last)
>>
>> /SandBox/Justin/sb/Sage/Code/<ipython console> in <module>()
>>
>> /SandBox/Justin/sb/sage-2.8/local/lib/python2.5/site-packages/sage/rings/arith.py
>>  in xgcd(a, b)
>>    1122     if not isinstance(a, RingElement):
>>    1123         a = integer_ring.ZZ(a)
>> -> 1124     return a.xgcd(b)
>>    1125
>>    1126 XGCD = xgcd
>>
>> <type 'exceptions.AttributeError'>: 'sage.rings.rational.Rational' object 
>> has no attribute 'xgcd'
>>
>> Is this expected?  It seems, somehow, wrong :-}
>
>It's a bug.  The fix is in the attached patch.

Thanks for the quick turnaround!  I'll try it out soon.

Justin

--
Justin C. Walker
Director,
Institute for the Enhancement of the Director's Income
---

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://sage.math.washington.edu/sage/ and http://sage.scipy.org/sage/
-~----------~----~----~----~------~----~------~--~---

Reply via email to