negative base raised to fractional exponent

John Machin sjmachin at lexicon.net
Wed Oct 17 00:26:02 CEST 2007


On Oct 17, 8:03 am, Steve Holden <st... at holdenweb.com> 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.
>
> 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




More information about the Python-list mailing list