471,357 Members | 1,094 Online

# negative base raised to fractional exponent

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.

Oct 16 '07 #1
10 9591 sc*********@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.
A couple of questions.

1. How do you approximate a complex number in the reals? That doesn't
make sense.

2. x ^ -4.1111 = 1 / (x ^ 4.1111), so where do complex numbers enter
into this anyway?

3. I think you will find the complex numbers start to emerge as you
explore fractional exponents.

This being Python, and an interactive interpreter being available, you
can always just try it:
>>-3 ** -4.1111
-0.010927147607830808
>>-1 ** -2
-1.0
>>(-1+0j) ** (-2)
(1+0j)
>>(-1+0j) ** (0.5)
(6.123233995736766e-17+1j)
>>(-3 + 0j) ** (-4.1111 + 0j)
(0.010268290423601775-0.0037369461622949107j)
>>>
regards
Steve
--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden

Sorry, the dog ate my .sigline so I couldn't cat it

Oct 16 '07 #2
Steve Holden wrote:
sc*********@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.
A couple of questions.

1. How do you approximate a complex number in the reals? That doesn't
make sense.

2. x ^ -4.1111 = 1 / (x ^ 4.1111), so where do complex numbers enter
into this anyway?
When *x* is negative and the exponent is fractional.

--
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco

Oct 16 '07 #3
On Oct 17, 8:03 am, Steve Holden <st...@holdenweb.comwrote:
schaefer...@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.

A couple of questions.

1. How do you approximate a complex number in the reals? That doesn't
make sense.

2. x ^ -4.1111 = 1 / (x ^ 4.1111), so where do complex numbers enter
into this anyway?

3. I think you will find the complex numbers start to emerge as you
explore fractional exponents.
This is part of the story -- the other part is that the story differs
depending on whether x is positive or negative.
>
This being Python, and an interactive interpreter being available, you
can always just try it:
>>-3 ** -4.1111
-0.010927147607830808
Steve, Trying to memorise the operator precedence table for each of
several languages was never a good idea. I admit advanced age :-) and
give up and use parentheses, just like the OP did:
>>(-3)**-4.11111
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: negative number cannot be raised to a fractional power

Best regards,
John

Oct 16 '07 #4
On Oct 16, 2:48 pm, schaefer...@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.
Use complex numbers. They are part of python (no special modules
needed).
Just write your real number r, as r+0j

e.g. square-root of -4 is 2j
>>(-4+0j)**(0.5)
(1.2246063538223773e-16+2j) # real part is almost zero
>>>
(-4.234324+0j)**(0.5)
(1.2599652164116278e-16+2.0577473119894969j)
>>2.0577473119894969j ** 2
(-4.234324+0j)
>>>

Karthik

Oct 16 '07 #5
sc*********@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
Oct 17 '07 #6
John Machin wrote:
On Oct 17, 8:03 am, Steve Holden <st...@holdenweb.comwrote:
>schaefer...@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.
A couple of questions.

1. How do you approximate a complex number in the reals? That doesn't
make sense.

2. x ^ -4.1111 = 1 / (x ^ 4.1111), so where do complex numbers enter
into this anyway?

3. I think you will find the complex numbers start to emerge as you
explore fractional exponents.

This is part of the story -- the other part is that the story differs
depending on whether x is positive or negative.
>This being Python, and an interactive interpreter being available, you
can always just try it:
> >>-3 ** -4.1111
-0.010927147607830808

Steve, Trying to memorise the operator precedence table for each of
several languages was never a good idea. I admit advanced age :-) and
give up and use parentheses, just like the OP did:
>>>(-3)**-4.11111
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: negative number cannot be raised to a fractional power

Best regards,
John
Well I guess I'd better admit to advances age too. Particularly since
there was a python-dev thread about precedence, unaries and
exponentiation not too long ago.

regards
Steve

--
Steve Holden +1 571 484 6266 +1 800 494 3119
Holden Web LLC/Ltd http://www.holdenweb.com
Skype: holdenweb http://del.icio.us/steve.holden

Sorry, the dog ate my .sigline so I couldn't cat it

Oct 17 '07 #7
On Oct 17, 4:05 am, Ken Schutte <kschu...@csail.mit.eduwrote:
schaefer...@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?
Oct 17 '07 #8
sc*********@gmail.com wrote:
On Oct 17, 4:05 am, Ken Schutte <kschu...@csail.mit.eduwrote:
>schaefer...@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?
This is a complex number with non-zero imaginary part - there is no way
to "express it as a real number". Depending what you are trying to do,
you may want the magnitude, z, which is by definition always positive.
Or, maybe you just want to take real_part (which can be positive or
negative). Taking just the real part is the "closest" real number, in
some sense.
Oct 17 '07 #9
sc*********@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
Oct 17 '07 #10
sc*********@gmail.com wrote:
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.
Not really. It is just the "absolute value" which is a property of
the complex number; it is (as already stated) by definition always
positive. There doesn't exist any underlying "real" value from
which a sign is stripped to yield the absolute value of z.
How does one determine the correct sign for this value?
In this case, the background (what you model using this complex
number) is of great importance.

Consider learning more about complex numbers; especially about how
they can be represented as a point on the complex plane
(<http://en.wikipedia.org/wiki/Complex_plane>), understanding this
makes understanding and dealing with complex numbers much easier.

Regards,
Björn

--
BOFH excuse #31:

cellular telephone interference

Oct 17 '07 #11

### This discussion thread is closed

Replies have been disabled for this discussion.

### Similar topics

 2 posts views Thread by Brian van den Broek | last post: by 25 posts views Thread by Jason | last post: by 1 post views Thread by Dave | last post: by 6 posts views Thread by Ben Finney | last post: by 29 posts views Thread by Peter Ammon | last post: by 4 posts views Thread by Just Me | last post: by 8 posts views Thread by better_cs_now | last post: by reply views Thread by emin.shopper | last post: by 10 posts views Thread by thatwhiteguy | last post: by reply views Thread by Yacine Si Tayeb | last post: by reply views Thread by KayQ | last post: by reply views Thread by sofiatarhonska | last post: by reply views Thread by leo001 | last post: by reply views Thread by chloesad91 | last post: by reply views Thread by chloesad91 | last post: by reply views Thread by SwissProgrammer | last post: by reply views Thread by kjhyder | last post: by reply views Thread by XIAOLAOHU | last post: by