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