[SciPy-user] How to get sqrt(-1) = 1j per default?

Martin Kirsch xyz.account@arcor...
Sun Jul 12 11:22:37 CDT 2009

Robert Kern <robert.kern <at> gmail.com> writes:

> ... forgetting that the scipy namespace
> aliases the numpy functions and only use the subpackages in scipy. Use
> the functions from numpy or numpy.lib.scimath directly, as needed.

Ok, using only the scipy subpackages helps to decouple the interdependencies
between numpy and scipy (many pitfalls for newcomers).
But why it makes a difference doing "from scipy import *"
(1) per ipy_profile_scipy.py (ipython -pylab -p scipy) => sqrt(-1)= NaN
(2) per console input => sqrt(-1)= 1j
Originally I guessed that in both cases sqrt comes from scipy because of the
preceding "from scipy import *" in both cases, but case (1) references
numpy.sqrt despite "from scipy import *" in ipy_profile_scipy.py and I don't
know the reason.

More information about the SciPy-user mailing list