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

Nicolas Gruel humufr@yahoo...
Sun Jul 12 14:42:11 CDT 2009


Why keeping the numpy comportment (NaN)? If it's only for historical reason and it's mathematicaly better to have 1j, this behaviour should be corrected. It was a limitation of numeric but numpy has been written to extend and to remove the limitation.

H. 

--- En date de : Dim 12.7.09, Robert Kern <robert.kern@gmail.com> a écrit :

> De: Robert Kern <robert.kern@gmail.com>
> Objet: Re: [SciPy-user] How to get sqrt(-1) = 1j per default?
> À: "SciPy Users List" <scipy-user@scipy.org>
> Date: Dimanche 12 Juillet 2009, 14h10
> 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
> _______________________________________________
> SciPy-user mailing list
> SciPy-user@scipy.org
> http://mail.scipy.org/mailman/listinfo/scipy-user
> 


      



More information about the SciPy-user mailing list