On Apr 13, 2008, at 9:46 PM, William Stein wrote:
>
> On Sun, Apr 13, 2008 at 9:37 PM,  <[EMAIL PROTECTED]> wrote:
>>
>>  sage: Q.<x,y> = QQ['x,y']
>>  sage: R.<X,Y> = Q.quo(Q.ideal(x^2 + y^2 -1))
>>  sage: X/2
>>   
>> --------------------------------------------------------------------- 
>> ------
>>  <type 'exceptions.NotImplementedError'>   Traceback (most recent  
>> call last)
>>
>>  /home/boothby/.sage/<ipython console> in <module>()
>>
>>  /home/boothby/.sage/element.pyx in  
>> sage.structure.element.RingElement.__div__ (sage/structure/ 
>> element.c:9080)()
>>
>>  /home/boothby/.sage/coerce.pyx in  
>> sage.structure.coerce.CoercionModel_cache_maps.bin_op_c (sage/ 
>> structure/coerce.c:5055)()
>>
>>  /home/boothby/.sage/element.pyx in  
>> sage.structure.element.RingElement.__div__ (sage/structure/ 
>> element.c:9063)()
>>
>>  /home/boothby/.sage/coerce.pxi in sage.structure.element._div_c  
>> (sage/structure/element.c:16174)()
>>
>>  /home/boothby/sage/local/lib/python2.5/site-packages/sage/rings/ 
>> quotient_ring_element.py in _div_(self, right)
>>      114         if not right.is_unit():
>>      115             raise ZeroDivisionError
>>  --> 116         raise NotImplementedError
>>      117
>>      118     def __int__(self):
>>
>>  <type 'exceptions.NotImplementedError'>:
>>
>>
>>  I'd understand if I were trying to divide by a non-unit, or even  
>> a unit polynomial.  But I'm trying to divide by a unit in the base  
>> ring -- shouldn't that work?  Is this a problem in the coercion  
>> model, or is it validly not implemented?
>>
>
> It's simply not implemented.  Implement it and post a patch.... :-)

I would add that it needs to be implemented carefully--it will be  
easy to create infinite loops as division creates fraction-field  
elements, so you can't just invert and cast.

> The source code for the function _div_ that is called is
>
> sage: X._div_??
> Source:
>     def _div_(self, right):
>         if not right.is_unit():
>             raise ZeroDivisionError
>         raise NotImplementedError
>
> which does *not* presently try to invert right if it does happen to  
> be a unit
> in the base ring.  Why?  Because it's not implemented yet.
> Your best bet is to either implement better functionality
> for computing in quotient rings or to type
>
> sage: X * (1/2)
> 1/2*X
>
> By the way, looking at the file quotient_ring_element.py, I would
> bring the doctest coverage to 100% before adding or subtracting
> any code from that file.  Right now coverage is a terrible 24%.
>
>  -- william
>
> 

--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-devel@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sage-devel
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to