Can you determine the sign of the polar form of a complex number?

schaefer.mp at gmail.com schaefer.mp at gmail.com
Wed Oct 17 15:17:32 CEST 2007


To compute the absolute value of a negative base raised to a
fractional exponent such as:

z = (-3)^4.5

you can compute the real and imaginary parts and then convert to the
polar form to get the correct value:

real_part = ( 3^-4.5 ) * cos( -4.5 * pi )
imag_part = ( 3^-4.5 ) * sin( -4.5 * pi )

|z| = sqrt( real_part^2 + imag_part^2 )

Is there any way to determine the correct sign of z, or perform this
calculation in another way that allows you to get the correct value of
z expressed without imaginary parts?

For example, I can compute:

z1 = (-3)^-4 = 0,012345679
and
z3 = (-3)^-5 = -0,004115226

and I can get what the correct absolute value of z2 should be by
computing the real and imaginary parts:

|z2| = (-3)^-4.5 = sqrt( 3,92967E-18^2 + -0,007127781^2 ) =
0,007127781

but I need to know the sign.

Any help is appreciated.



but I can know the correct sign for this value.




More information about the Python-list mailing list