Why doesn't this work?
[color=blue][color=green][color=darkred]
>>> import math
>>> math.exp(1j*mat h.pi)[/color][/color][/color]
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: can't convert complex to float; use e.g. abs(z)
The expected answer, of course, is -1.
It does work if you do it like this:
[color=blue][color=green][color=darkred]
>>> math.e**(1j*mat h.pi)[/color][/color][/color]
(-1+1.22464679914 73532e-16j)
So why not math.exp(comple x)?
--
David Eppstein http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science
[color=blue][color=green][color=darkred]
>>> import math
>>> math.exp(1j*mat h.pi)[/color][/color][/color]
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: can't convert complex to float; use e.g. abs(z)
The expected answer, of course, is -1.
It does work if you do it like this:
[color=blue][color=green][color=darkred]
>>> math.e**(1j*mat h.pi)[/color][/color][/color]
(-1+1.22464679914 73532e-16j)
So why not math.exp(comple x)?
--
David Eppstein http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science
Comment