I saw this question, and found a formula:
$$=\cos \left( d\log |a+bi|+c\arctan \frac{d}{c}\right)+i\sin \left( d\log |a+bi|+c\arctan \frac{d}{c}\right).$$
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=\text{Log }z=\log |z|+i\arg z$$
so that $e^w=z$, where $\arg z$ (the principal argument of $z$) is the real number in $-\pi\lt \arg z\le \pi$, with $x=|z|\cos (\arg z)$ and $y=|z|\sin (\arg z)$.
The formula now reads as follows:
$$\begin{eqnarray*}
\left( a+bi\right) ^{c+di} &=&e^{(c+di)\text{ Log }(a+bi)} \\
&=&e^{(c+di)\left( \ln |a+bi|+i\arg (a+bi)\right) } \\
&=&e^{c\ln \left\vert a+ib\right\vert -d\arg \left( a+ib\right) +i\left(
c\arg \left( a+ib\right) +d\ln \left\vert a+ib\right\vert \right) } \\
&=&e^{c\ln \left\vert a+ib\right\vert -d\arg(a+bi)}\times \\
&&\times \left( \cos \left( c\arg \left( a+ib\right) +d\ln \left\vert
a+ib\right\vert \right) +i\sin \left( c\arg \left( a+ib\right) +d\ln
\left\vert a+ib\right\vert \right) \right).
\end{eqnarray*}$$
For $a=1,b=2,c=3,d=4$, we have (numeric computations in SWP)
$$\begin{eqnarray*}
\left( 1+2i\right) ^{3+4i} &=&e^{(3+4i)\text{ Log }(1+2i)} \\
&=&e^{(3+4i)\left( \log |1+2i|+i\arg (1+2i)\right) } \\
&=&e^{3\ln \left\vert 1+2i\right\vert -4\arg \left( 1+2i\right) +i\left(
3\arg \left( 1+2i\right) +4\ln \left\vert 1+2i\right\vert \right) } \\
&=&e^{3\ln \left\vert 1+2i\right\vert -4\arg \left( 1+2i\right) }\times \\
&&\times \left( \cos \left( 3\arg \left( 1+2i\right) +4\ln \left\vert
1+2i\right\vert \right) +i\sin \left( 3\arg \left( 1+2i\right) +4\ln
\left\vert 1+2i\right\vert \right) \right) \\
&\approx &0.13340\left( \cos \left( 6.5403\right) +i\sin \left(
6.5403\right) \right) \\
&\approx &0.12901+3.3924\times 10^{-2}i,
\end{eqnarray*}$$
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
$$\begin{eqnarray*}
\left( -1+2i\right) ^{3+4i} &=&e^{(3+4i)\text{ Log }(-1+2i)} \\
&=&e^{(3+4i)\left( \log |-1+2i|+i\arg (-1+2i)\right) } \\
&=&e^{3\ln \left\vert -1+2i\right\vert -4\arg \left( -1+2i\right) +i\left(
3\arg \left( -1+2i\right) +4\ln \left\vert -1+2i\right\vert \right) } \\
&=&e^{3\ln \left\vert -1+2i\right\vert -4\arg \left( -1+2i\right) }\times \\
&&\times \left( \cos \left( 3\arg \left( -1+2i\right) +4\ln \left\vert
-1+2i\right\vert \right) +i\sin \left( 3\arg \left( -1+2i\right) +4\ln
\left\vert -1+2i\right\vert \right) \right) \\
&\approx &3.267\,9\times 10^{-3}\left( \cos \left( 9.3222\right) +i\sin
\left( 9.3222\right) \right) \\
&\approx &3.\,250\,7\times 10^{-3}+3.346\times 10^{-4}i.
\end{eqnarray*}$$
In Wolfram Alpha we get $(-1+2i)^{3+4i}\approx -0.003250688+0.000334598i$
No comments:
Post a Comment