numpy.cos(sympy.pi) throws error

29 views
Skip to first unread message

basti

unread,
May 6, 2008, 2:19:46 PM5/6/08
to sympy
Why can I do:
>> import math, sympy
>> math.cos(sympy.pi)
-1.0

but not:
>> import numpy, sympy
>> numpy.cos(sympy.pi)
---------------------------------------------------------------------------
<type 'exceptions.AttributeError'> Traceback (most recent call
last)

/home/sebastian/workspace/hgsympy/<ipython console> in <module>()

/home/sebastian/workspace/hgsympy/sympy/core/basic.py in
__getattr__(self, name)
216 # if we are here -- it surely does not exist,
217 # so let's get out of here as fast as possible.
--> 218 raise AttributeError(name)
219
220 else:

<type 'exceptions.AttributeError'>: cos

basti

unread,
May 6, 2008, 2:27:51 PM5/6/08
to sympy
Okay, the math module can do it, because the __float__ method is
implemented. numpy.cos seems to look for a cos method in pi and fails.
I'll have to ask the numpy guys why they are not calling __float__ if
this fails.
Reply all
Reply to author
Forward
0 new messages