On 06/12/2013 06:07 PM, Jim Mooney wrote:
On 12 June 2013 14:16, Steve Willoughby <[email protected]> wrote:
or if you try to take the square root of a negative number, etc.
Or the log of -10. Although sqrt(-1) works fine for cmath.sqrt(-1) - I
think I get it.
Come to think of it you can do cmath.log(-10), but that's getting scary ;')
Jim
>>> import math, cmath
>>> i = complex(0,1)
>>> math.sqrt((math.e **(i * math.pi)).real)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: math domain error
>>> cmath.sqrt(float((math.e **(i * math.pi)).real))
1j
--
DaveA
_______________________________________________
Tutor maillist - [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor