[SciPy-dev] [Numpy-discussion] Should numpy.sqrt(-1) return 1j rather than nan?
Fernando Perez
fperez.net at gmail.com
Thu Oct 12 02:41:03 CDT 2006
[ Moved over from the numpy list at Travis' request ]
On 10/12/06, Scott Sinclair <sinclaird at ukzn.ac.za> wrote:
> As far as I can tell this is exactly what happens. Consider the issue
> under discussion...
>
> ----------------------------------
> >>> import numpy as np
> >>> np.sqrt(-1)
> -1.#IND
> >>> np.sqrt(-1+0j)
> 1j
> >>> a = complex(-1)
> >>> np.sqrt(a)
> 1j
> >>> import scipy as sp
> >>> sp.sqrt(-1)
> -1.#IND
> >>> np.sqrt(-1+0j)
> 1j
> >>> sp.sqrt(a)
> 1j
> >>> np.__version__
> '1.0rc1'
> >>> sp.__version__
> '0.5.1'
> >>>
>
> ----------------------------------
>
> I'm sure that this hasn't changed in the development versions.
Check again (I just rebuilt from SVN right now):
In [1]: import numpy as n, scipy as s
In [2]: n.sqrt(-1)
Out[2]: nan
In [3]: s.sqrt(-1)
Out[3]: 1j
In [4]: n.__version__,s.__version__
Out[4]: ('1.0.dev3315', '0.5.2.dev2264')
Travis gave all the details on this particular issue, so I won't rehash them.
Cheers,
f
More information about the Scipy-dev
mailing list