negative base raised to fractional exponent

John J. Lee jjl at pobox.com
Wed Oct 17 16:37:25 EDT 2007


schaefer.mp at gmail.com writes:
[...]
> Thank you for this. Now I need to somehow express this as a real
> number. For example, I can transform the real and imaginary parts into
> a polar coordinate giving me the value I want:
>
> z = sqrt( real_part**2 + imaj_part**2 )
>
> but this is an absolute terms. How does one determine the correct sign
> for this value?

If you mean the angle

>>> import math
>>> x = (-3 + 0j) ** (-37/9.)
>>> math.atan2(x.imag, x.real) * (180 / math.pi)
-19.99999999999995


John



More information about the Python-list mailing list