On Numbers

Erik Max Francis max at alcyone.com
Wed Jan 18 07:29:59 EST 2006


Steve Holden wrote:

>   >>> import cmath
>   >>> cmath.sqrt(-1)
> 1j
>   >>>
> 
> Indeed. But even exponentiation can come respectably close:
> 
>   >>> (-1+0j)**0.5
> (6.123233995736766e-17+1j)

Oh, no doubt.  I was just pointing out that cmath.sqrt is what you want 
if you really do want the complex result rather than the principal real one.

-- 
Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
San Jose, CA, USA && 37 20 N 121 53 W && AIM erikmaxfrancis
   Dear World: I am leaving because I am bored.
   -- George Sanders (in his suicide note)



More information about the Python-list mailing list