negative base raised to fractional exponent

schaefer.mp at gmail.com schaefer.mp at gmail.com
Wed Oct 17 07:55:26 EDT 2007


On Oct 17, 4:05 am, Ken Schutte <kschu... at csail.mit.edu> wrote:
> schaefer... at gmail.com wrote:
> > Does anyone know of an approximation to raising a negative base to a
> > fractional exponent? For example, (-3)^-4.11111 since this cannot be
> > computed without using imaginary numbers. Any help is appreciated.
>
> As others have said, you can use Python's complex numbers (just write -3
> as -3+0j).  If for some reason you don't want to, you can do it all with
> reals using Euler's formula,
>
> (-3)^-4.11111  =  (-1)^-4.11111  *  3^-4.11111
> =
> e^(j*pi*-4.11111)  *  3^-4.11111
> =
> (cos(pi*-4.11111) + j*sin(pi*-4.11111)) * 3^-4.11111
>
> in Python:
>
>  >>> import math
>  >>> real_part = (3**-4.11111) * math.cos(-4.11111 * math.pi)
>  >>> imaj_part = (3**-4.11111) * math.sin(-4.11111 * math.pi)
>  >>> (real_part,imaj_part)
> (0.01026806021211755, -0.0037372276904401318)
>
> Ken

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?





More information about the Python-list mailing list