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

Greg Willden gregwillden at gmail.com
Wed Oct 11 23:17:13 EDT 2006


On 10/11/06, Travis Oliphant <oliphant at ee.byu.edu> wrote:
>
> Stefan van der Walt wrote:
> >Further, if I understand correctly, changing sqrt and power to give
> >the right answer by default will slow things down somewhat.  But is it
> >worth sacrificing intuitive usage for speed?
> >
> For NumPy, yes.
>
> This is one reason that NumPy by itself is not a MATLAB replacement.


This is not about being a Matlab replacement.
This is about correctness.
Numpy purports to handle complex numbers.
Mathematically, sqrt(-1) is a complex number.
Therefore Numpy *must* return a complex number.
Speed should not take precedence over correctness.

If Numpy doesn't return a complex number then it shouldn't pretend to
support complex numbers.

Greg

-- 
Linux.  Because rebooting is for adding hardware.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20061011/816ea83b/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