You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
sage: imag(complex(0,1))
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/home/grout/.sage/temp/good/9936/_home_grout__sage_init_sage_0.py in <module>()
/home/grout/sage/local/lib/python2.5/site-packages/sage/misc/functional.pyc in imag(x)
376 Return the imaginary part of x.
377 """
--> 378 try: return x.imag()
379 except AttributeError: return CDF(x).imag()
380
TypeError: 'float' object is not callable
This is because complex(0,1).imag is a number, not a function, so trying to call that number gives the error. As Robert Bradshaw said on the mailing list, Sage's imag() should really know about python complex numbers.
----------------------------------------------------------------------
| Sage Version 4.0, Release Date: 2009-05-29 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage: imag(complex(0,1))
1.00000000000000
aghitza
changed the title
imag(complex(0,1)) gives TypeError (easy)
[already fixed?] imag(complex(0,1)) gives TypeError (easy)
Jun 2, 2009
----------------------------------------------------------------------
| Sage Version 4.1, Release Date: 2009-07-09 |
| Type notebook() for the GUI, and license() for information. |
----------------------------------------------------------------------
sage: imag(complex(0,1))
1.00000000000000
So I'm closing this ticket as fixed.
sagetrac-mvngumannequin
changed the title
[already fixed?] imag(complex(0,1)) gives TypeError (easy)
imag(complex(0,1)) gives TypeError (easy)
Jul 26, 2009
This is because complex(0,1).imag is a number, not a function, so trying to call that number gives the error. As Robert Bradshaw said on the mailing list, Sage's imag() should really know about python complex numbers.
Component: algebra
Issue created by migration from https://trac.sagemath.org/ticket/5420
The text was updated successfully, but these errors were encountered: