After importing numpy, Sage for some reason loses the ability to deal with 
complex numbers correctly, e.g.

sage: (1+1j)/sqrt(2)
(0.500000000000000 + 0.500000000000000*I)*sqrt(2)
sage: from numpy import *
sage: (1+1j)/sqrt(2)
/Applications/MyApps/Math/Sage-6.0.app/Contents/Resources/sage/src/bin/sage-ipython:1:
 ComplexWarning: Casting complex values to real discards the imaginary part
  #!/usr/bin/env python
0.70710678118654746

The last result is obviously wrong. This happens in 'Sage Version 6.0, Release 
Date: 2013-12-17' as well as in Sage 5.11 on Mac OS X 10.8. The same problem 
occurs with other numpy functions like log10 etc and with other operators like 
'*', '+', ...

When I use the system supplied python all is fine:

Python 2.7.2 (default, Oct 11 2012, 20:14:37) 
[GCC 4.2.1 Compatible Apple Clang 4.0 (tags/Apple/clang-418.0.60)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> from numpy import *
>>> (1+1j)/sqrt(2)
(0.7071067811865475+0.7071067811865475j)

What's going on here?

Best regards,
    Bernhard

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to