On Tue, Jun 10, 2008 at 2:04 PM, mabshoff <[EMAIL PROTECTED]> wrote:
>
> Riccardo Gori wrote:
>> Hello,
>
> Hi Riccardo,
>
> I have also forwarded your email to sage-devel.
>
>> In SAGE-3.0.2 with a Intel Mac OSX 10.5 I found the following bug:
>>
>> If I create a sympy matrix and if I try to access it it gives me an error.
>> Step to reproduce:
>>
>> sage: import sympy
>> sage: M = sympy.Matrix( (2,3) )
>> sage: sympy.pprint M[0]
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in <module>
>>   File "/Users/riccardo/.sage/sage_notebook/worksheets/admin/3/code/299.py", 
>> line 7, in <module>
>>     M[Integer(1)]
>>   File 
>> "/Applications/sage/local/lib/python2.5/site-packages/sympy/plotting/", line 
>> 1, in <module>
>>       File 
>> "/Applications/sage/local/lib/python2.5/site-packages/sympy/matrices/matrices.py",
>>  line 150, in __getitem__
>>     assert len(key) == 2
>> TypeError: object of type 'sage.rings.integer.Integer' has no len()
>> sage: sympy.pprint M[int(0)]
>> 2
>
> This is most likely an integration issue and I assume that if you use
> Python ints the problem will go away. One aspect there is certainly
> that Sympy is not integrated into Sage's coercion model.

This is a bug in Sympy:

sage:  import sympy
sage: M = sympy.Matrix( (2,3) )
sage: M
[2]
[3]
sage: M[0]
TypeError                                 Traceback (most recent call last)
...

Sympy *should* call the __index__ method on the input object
in __getitem__, but it doesn't.  The __index__ method is supported
by Sage integers, and was added (by Travis Oliphant) in Python 2.5
for exactly the above reason.

I've cc'd this email to Ondrej Certik and hope he can post a bug
report to the sympy bug tracker.

 -- 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