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

Travis Oliphant oliphant at ee.byu.edu
Wed Oct 11 18:19:58 EDT 2006


Fernando Perez wrote:

>On 10/11/06, Travis Oliphant <oliphant at ee.byu.edu> wrote:
>
>  
>
>>pearu at cens.ioc.ee wrote:
>>    
>>
>>>Could sqrt(-1) made to return 1j again?
>>>
>>>      
>>>
>>Not in NumPy.  But, in scipy it could.
>>    
>>
>
>Without taking sides on which way to go, I'd like to -1 the idea of a
>difference in behavior between numpy and scipy.
>
>IMHO, scipy should be within reason a strict superset of numpy.
>  
>
This was not the relationship of scipy to Numeric.

For me, it's the fact that scipy *used* to have the behavior that

scipy.sqrt(-1) return 1j

and now doesn't  that is the kicker. 

On the other hand requiring all calls to numpy.sqrt to go through an 
"argument-checking" wrapper is a bad idea as it will slow down other uses.

So, I committed a change to scipy to bring it back into compatibility 
with 0.3.2



>Gratuitious differences in behavior like this one are going to drive
>us all mad.
>
>There are people who import scipy for everything, others distinguish
>between numpy and scipy, others use numpy alone and at some point in
>their life's code they do
>
>import numpy as N -> import scipy as N
>
>because they start needing stuff not in plain numpy.  Having different
>APIs and behaviors appear there is, I think, a Seriously Bad Idea
>(TM).
>  
>
I think the SBI is mixing numpy and scipy gratuitously  (which I admit I 
have done in the past).  I'm trying to repent....

-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