On Oct 16, 2:48 pm, [EMAIL PROTECTED] 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

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to