[SciPy-user] How to get sqrt(-1) = 1j per default?
Robert Kern
robert.kern@gmail....
Sun Jul 12 13:10:37 CDT 2009
On Sun, Jul 12, 2009 at 12:12, Pauli Virtanen<pav+sp@iki.fi> wrote:
> On 2009-07-12, Martin Kirsch <xyz.account@arcor.de> wrote:
> [clipÂ]
>> 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
Note that "from scipy import *" is precisely the thing that I am
suggesting that you should never do.
>> 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.
>
> Perhaps the -pylab switch makes Ipython to run "from numpy import *",
> or something similar, *after* ipy_profile_scipy.py? I'd suppose that
> if you do "from scipy import *" in the Ipython console, you'd get
> Scipy's version of sqrt.
Correct.
> Also, does the order of the -pylab and -p switches on the Ipython
> command line make a difference?
I don't think so.
--
Robert Kern
"I have come to believe that the whole world is an enigma, a harmless
enigma that is made terrible by our own mad attempt to interpret it as
though it had an underlying truth."
-- Umberto Eco
More information about the SciPy-user
mailing list