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