Complex exponentiation: Raise complex number to complex number

1.4k Views Asked by At

I'm trying to do complex exponentiation on Javascript but I find hard to convert any of the equations I've read to the programming language.

I'm trying to know how to do $$(a+bi)^{c+di} = magic$$

I've read several posts that I find hard to understand and I'm not sure if I'm understanding the equations right.

I've found 2 approaches so far:

1. MathWorld: Complex Exponentiation

This is the link the to the site MathWorld: Complex Exponentiation

There is a equation there like this:

$$(a+bi)^{c+di} = (a^2+b^2)^{\frac{(c+di)}2} e^{i(c+id)\arg(a+ib)}$$

$$(a+bi)^{c+di} = (a^2+b^2)^{\frac{c}2} e^{-d\arg(a+ib)}*{(cos[c\arg(a+ib)+\frac{1}{2} d \ln(a^2+b^2)]+ i\sin[c\arg(a+ib)+\frac{1}{2} d \ln(a^2+b^2)])}$$

Taking account that: $arg(a+ib)=tan^{-1}(\frac{b}{a})$

This equation is in two lines also on the website and I get a little confused. Can I assume that the result of the avobe equation is:

Real Part

$$(a^2+b^2)^{\frac{c}2} e^{-d\arg(a+ib)}*(cos[c\arg(a+ib)+\frac{1}{2} d \ln(a^2+b^2)] =$$ $$=(a^2+b^2)^{\frac{c}2} e^{-d\tan^{-1}(\frac{b}{a})}*(cos[c\tan^{-1}(\frac{b}{a})+\frac{1}{2} d \ln(a^2+b^2)]$$

Imaginary Part

$$(a^2+b^2)^{\frac{c}2} e^{-d\arg(a+ib)}*(i\sin[c\arg(a+ib)+\frac{1}{2} d \ln(a^2+b^2)]=$$ $$=(a^2+b^2)^{\frac{c}2} e^{-d\tan^{-1}(\frac{b}{a})}*(i\sin[c\tan^{-1}(\frac{b}{a})+\frac{1}{2} d \ln(a^2+b^2)]$$

So, here is the first 2 question:

  • 1.1 Are those 2 assumptions right about the result of the exponentiation ?

  • 1.2 If the assumptions are wrong, which is the best way to solve the equation ?

2.Polar Form of a Complex Number

I've read on different posts and sites that another approach is to convert the number to the polar form of the complex number:

$$a+bi=r\,(cos \,θ+i sin θ)$$ $$r=\sqrt{a^2+b^2}$$ $$θ=arctan(\frac{b}{a})$$

  • 2.2 How could I use the polar form to calculate the result of a complex exponentiation?

$$(a+bi)^{c+di} = r\,(cos \,θ+i sin θ)^{q\,(cos \,∝\,+\,i\,sin ∝)}$$ $$r=\sqrt{a^2+b^2}$$ $$θ=arctan(\frac{b}{a})$$ $$q=\sqrt{c^2+d^2}$$ $$∝=arctan(\frac{d}{c})$$