[SciPy-user] How to get sqrt(-1) = 1j per default?
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.
--- En date de : Dim 12.7.09, Robert Kern <email@example.com> a écrit :
> De: Robert Kern <firstname.lastname@example.org>
> Objet: Re: [SciPy-user] How to get sqrt(-1) = 1j per default?
> À: "SciPy Users List" <email@example.com>
> Date: Dimanche 12 Juillet 2009, 14h10
> On Sun, Jul 12, 2009 at 12:12, Pauli
> Virtanen<firstname.lastname@example.org> wrote:
> > On 2009-07-12, Martin Kirsch <email@example.com>
> > [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.
> > 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
More information about the SciPy-user