Complex number and "TypeError: 'float' object is not callable"

818 views
Skip to first unread message

Alasdair

unread,
Mar 1, 2009, 7:09:05 AM3/1/09
to sage-support
Here's the error:

c=complex((sqrt(3)+2*I)^4)
imag(c)

returns

"TypeError: 'float' object is not callable"

So - how do I obtain the imaginary part of c?

Thanks,
Alasdair

Robert Bradshaw

unread,
Mar 1, 2009, 7:14:27 AM3/1/09
to sage-s...@googlegroups.com

c.imag

Our imag() function should really know about Python complex variables...

- Robert


Alasdair

unread,
Mar 2, 2009, 6:09:18 AM3/2/09
to sage-support
Thanks - being a beginner I thought that c.imag() was the only
allowable syntax; I didn't know c.imag was allowed.

-Alasdair

On Mar 1, 11:14 pm, Robert Bradshaw <rober...@math.washington.edu>
wrote:

Jason Grout

unread,
Mar 2, 2009, 12:39:16 PM3/2/09
to sage-s...@googlegroups.com


I agree. This is http://trac.sagemath.org/sage_trac/ticket/5420 and is
very easy, low-hanging fruit for anyone that wants to learn how to
contribute to Sage :).

Jason

Robert Bradshaw

unread,
Mar 2, 2009, 2:40:27 PM3/2/09
to sage-s...@googlegroups.com
On Mar 2, 2009, at 3:09 AM, Alasdair wrote:

> Thanks - being a beginner I thought that c.imag() was the only
> allowable syntax; I didn't know c.imag was allowed.

It's not in general, only for the Python complex type.

- Robert

Reply all
Reply to author
Forward
0 new messages