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

David Goldsmith David.L.Goldsmith at noaa.gov
Thu Oct 12 12:24:40 EDT 2006


Greg Willden wrote:
> May I suggest the following change to generate_umath.py?
>
> <completely untested string change>
> 'sqrt' :
>     Ufunc(1, 1, None,
>           'square-root elementwise. For real x, the domain is 
> restricted to x>=0.\n\
>           For complex results for x<0 see numpy.scimath.sqrt',
>           TD(inexact, f='sqrt'),
>           TD(M, f='sqrt'),
>           ),
> '
>
> When sqrt throws a ValueError would it be possible/appropriate for the 
> error message to mention numpy.scimath.sqrt?
>
> I'm just trying to think of other ways to help make the transition as 
> smooth as possible for new users.
And helpful error messages are one of Python's best features - in 
general, numpy doesn't have enough of 'em, IMO.

DG
>
> Greg
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> 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
> ------------------------------------------------------------------------
>
> _______________________________________________
> Numpy-discussion mailing list
> Numpy-discussion at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/numpy-discussion
>   


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