I saw this question, and found a formula:
=cos(dlog|a+bi|+carctandc)+isin(dlog|a+bi|+carctandc).
Which I later translated to Microsoft Math format:
cos(dlog(Abs(a+bi))+carctan(d/c))+sin(dlog(Abs(a+bi))+carctan(d/c))*i
And - that formula gives wrong results.
While the result is -0.507 - 0.861i
(for that formula, setting a=1,b=2,c=3,d=4
)
Doing (a + bi)^(c + di)
gives me 0.129+0.033i
Can anyone explain what I am doing wrong ? (I am trying to write a program which does this.)
Answer
I corrected the answer you cite. Instead of the arctan function it should be the arg function. These two functions are not always equal. The arg function is used in the principal logarithm of z=x+iy, which is the complex number
w=Log z=log|z|+iargz
so that ew=z, where argz (the principal argument of z) is the real number in −π<argz≤π, with x=|z|cos(argz) and y=|z|sin(argz).
The formula now reads as follows:
(a+bi)c+di=e(c+di) Log (a+bi)=e(c+di)(ln|a+bi|+iarg(a+bi))=ecln|a+ib|−darg(a+ib)+i(carg(a+ib)+dln|a+ib|)=ecln|a+ib|−darg(a+bi)××(cos(carg(a+ib)+dln|a+ib|)+isin(carg(a+ib)+dln|a+ib|)).
For a=1,b=2,c=3,d=4, we have (numeric computations in SWP)
(1+2i)3+4i=e(3+4i) Log (1+2i)=e(3+4i)(log|1+2i|+iarg(1+2i))=e3ln|1+2i|−4arg(1+2i)+i(3arg(1+2i)+4ln|1+2i|)=e3ln|1+2i|−4arg(1+2i)××(cos(3arg(1+2i)+4ln|1+2i|)+isin(3arg(1+2i)+4ln|1+2i|))≈0.13340(cos(6.5403)+isin(6.5403))≈0.12901+3.3924×10−2i,
which agrees with the computation in Wolfram Alpha for (1+2i)3+4i.
And for instance, if a=−1,b=2,c=3,d=4, then
(−1+2i)3+4i=e(3+4i) Log (−1+2i)=e(3+4i)(log|−1+2i|+iarg(−1+2i))=e3ln|−1+2i|−4arg(−1+2i)+i(3arg(−1+2i)+4ln|−1+2i|)=e3ln|−1+2i|−4arg(−1+2i)××(cos(3arg(−1+2i)+4ln|−1+2i|)+isin(3arg(−1+2i)+4ln|−1+2i|))≈3.2679×10−3(cos(9.3222)+isin(9.3222))≈3.2507×10−3+3.346×10−4i.
In Wolfram Alpha we get (−1+2i)3+4i≈−0.003250688+0.000334598i
No comments:
Post a Comment