#5420: imag(complex(0,1)) gives TypeError (easy)
---------------------+------------------------------------------------------
 Reporter:  jason    |       Owner:  tbd       
     Type:  defect   |      Status:  new       
 Priority:  major    |   Milestone:  sage-3.4.1
Component:  algebra  |    Keywords:            
---------------------+------------------------------------------------------
 {{{
 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.

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/5420>
Sage <http://sagemath.org/>
Sage - Open Source Mathematical Software: Building the Car Instead of 
Reinventing the Wheel

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to