Should numpy.sqrt(-1) return 1j rather than nan?

Mark Bakker markbak at gmail.com
Thu Oct 12 02:58:46 CDT 2006


My vote is for consistency in numpy.
But it is unclear what consistency is.

What is truly confusing for newbie Python users (and a source for error even
after 5 years of Python programming) is that

>>> 2/3
0

In that respect, I would think

>>> numpy.sqrt(2)

should give 1, but it gives 1.4142135623730951

So numpy does typechecking anyway (it gets an integer and makes it a float).

If that is the consistent behavior, then by all means

>>> sqrt(-1)

should return 1j.

Wouldn't that be the consistent thing to do????

Mark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://projects.scipy.org/pipermail/numpy-discussion/attachments/20061012/1447bd8c/attachment.html 
-------------- next part --------------
-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
-------------- next part --------------
_______________________________________________
Numpy-discussion mailing list
Numpy-discussion at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/numpy-discussion


More information about the Numpy-discussion mailing list