[SciPy-dev] Issues with square roots of complex numbers

josef.pktd@gmai... josef.pktd@gmai...
Sun Oct 18 20:05:51 CDT 2009


On Sun, Oct 18, 2009 at 8:34 PM, Arkapravo Bhaumik
<arkapravobhaumik@gmail.com> wrote:
> Dear Friends
>
> I faced some issues in square root of iota, and evaluated it using cmath,
> scipy and Matlab.
>
> The details are included on the following link from my blogspot,
> http://programming-unlimited.blogspot.com/2009/10/square-root-of-iota.html .
> Please feel free to comment or criticise.
>
> Regards
>
> Arkapravo
>

Looks to me like standard floating point issues, matlab is not more
precise because it displays only 4 digits

>>> np.sqrt([1j])
array([ 0.7071+0.7071j])

>>> np.array([1j])**(0.5)
array([ 0.7071+0.7071j])





However, it seems like printoptions doesn't work for scalars  (?)

>>> np.set_printoptions(precision=4)
>>> np.sqrt(1j)
(0.70710678118654746+0.70710678118654757j)
>>> print np.sqrt(2)
1.41421356237

Josef


More information about the Scipy-dev mailing list