English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I am writing a program for making complex numbers operations. However, I have one problem with powers:
Assume I want to calculate x^y, where x and y can be any number (integer, real or complex, finite or infinite).
In this case x^y = Exp(y*Ln(x))

Exp and Ln are defined for a complex number "z" (see details below)

The problem is that x^y will fail when x=0 - and don't know how will behave for infinite numbers
I'd like to know:
a) If my definitions of Exp and Log are right for any value (real, complex, finite or infinite)
b) What exceptional case I should handle specially in the power function (for example, 0^0=undefined, x^0=1, 0^2=?)
I want to make it the most general possible...
Thanks.

2007-11-16 16:53:54 · 1 answers · asked by Anonymous in Science & Mathematics Mathematics

Definition of Exp and Ln for a complex number "z":

Exp(z) is a complex number whose
Real part is: exp(z.Re)*cos(z.Im),
Imag. part is: exp(z.Re)*sin(z.Im)

Ln(z) is a complex number whose
Real part is: 0.5*log(z.Re*z.Re + z.Im*z.Im)
Imag. part is: Arg(z.Re,Z.Im)
Undefined for 0 (0+0*i)

exp, sin, cos, log, are the traditional functions for real numbers in Math.h library of c++ (log is natural logarithm). Arg is the argument of a complex number, and returns the angle of its polar representation between 0 and 2*pi, depending on the real and imag. part.

2007-11-16 16:54:38 · update #1

1 answers

Interesting!
a) I think that your definition of Exp is right for real and complex values. You're also good for the cases of infinite y and infinite x (seems it's fine too for the case where y is infinite and x b) I guess you need to handle the x=0 case specially, since the formula incorrectly yields 1 not 0. The y=0 case needs no further attention, except in the special situation where x=0 and y=0, in which case 'undefined' is the correct answer.

2007-11-16 17:38:18 · answer #1 · answered by Anonymous · 0 0

fedest.com, questions and answers