negative base raised to fractional exponent

S

schaefer.mp

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.
 
S

Steve Holden

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:

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
 
R

Robert Kern

Steve said:
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
 
J

John Machin

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:

-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:
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
ValueError: negative number cannot be raised to a fractional power

Best regards,
John
 
K

Karthik Gurusamy

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


Karthik
 
K

Ken Schutte

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:
(0.01026806021211755, -0.0037372276904401318)


Ken
 
S

Steve Holden

John said:
This is part of the story -- the other part is that the story differs
depending on whether x is positive or negative.


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:

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
 
S

schaefer.mp

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:

(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?
 
K

Ken Schutte

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.
 
J

John J. Lee

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
-19.99999999999995


John
 
B

Bjoern Schliessmann

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top