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

Travis Oliphant oliphant.travis at ieee.org
Thu Oct 12 03:41:46 EDT 2006


David Goldsmith wrote:
>>   
>>     
> I don't use scipy (and don't want to because of the overhead) but it 
> sounds like I should because if I'm taking the square root of a variable 
> whose value at run time happens to be real but less than zero, I *want* 
> the language I'm using to return an imaginary; in other words, it's not 
> the scipy behavior which "scares" me, its the numpy (which I do/have 
> been using) behavior. 

O.K.  Well the functions you want are in numpy.lib.scimath.  I should 
have directed you there.  You actually don't need scipy installed at 
all.  Just import sqrt from numpy.lib.scimath.  I'm sorry I 
misunderstood the issue.

-Travis


-------------------------------------------------------------------------
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




More information about the NumPy-Discussion mailing list