Raising a Complex Number to a Decimal Value

2.5k Views Asked by At

So for my class i have to make a java program that deals with complex numbers. I finished getting the root and power and i was wondering how to do a method that deals with powers such as 2.56. Now im not exactly sure how to take a complex number to the power of 2.56 and whether i would use the same method of De Moivres Formula. I was thinking that taking something to the power of 2.56 is the same as taking it to the power of 256 and then taking the 100th root of it, but im not sure if that will work for complex numbers or if it will work in java.

Anyways any help would be appreciated...i barely remember anything about complex numbers...

4

There are 4 best solutions below

0
On

Any complex number $z = x + iy$ can be written in the form $z = r e^{i \theta}$, where $r = \sqrt{x^2 + y^2}$ and $\tan \theta = \frac{y}{x}$. ($0 \leq \theta < 2 \pi$) Thus, you may use $z^{\alpha} = r^{\alpha} e^{i \alpha \theta}$ for any $\alpha \in \mathbb{R}$.

3
On

I recomend using the exponential form: $$z=x+yi=re^{i\phi}$$

$$z^\alpha=r^\alpha e^{i\alpha\phi}=r^\alpha\cos(\alpha\phi)+ir^\alpha\sin(\alpha\phi)$$

1
On

As others noted, we can write $x=re^{i\theta}$.

As Stefan Smith noted, there are infinitely many choices for $\theta$, so in general we will end up with $x^a$ having reasonable values $r^a e^{ia(\theta+2\pi k)}=r^a e^{ia\theta}e^{ia\cdot2\pi}$ for any integer $k$.

This form is instructive: it is easy to see that there is only one possible value when $a$ is an integer, and that there are only finitely many when $a$ is rational.

Edit: It's interesting to see how things twist when $a$ is purely imaginary.

0
On

There is not an universally agreed-upon way to do this (raise an arbitrary complex number to the power 2.56). The usual way is to write the complex number $z$ in the form $r\exp(i\theta) = r(\cos\theta + i\sin\theta)$ where $r = |z| \geq 0$, $\theta$ is real (the equation is true due to Euler's Formula), then define

$$z^{2.256} = r^{2.56}\exp(2.56i\theta) = r^{2.56}(\cos(2.56\theta) + i\sin(2.56\theta))$$

(using Euler's formula for the second equation). The problem with this is that for any $z$, many choices of $\theta$ satisfy $z=r\exp(i\theta)$. If $z=0$, $\theta$ can be anything (but $0^{2.56}=0$, so there is no problem). If $z \neq 0$, the most popular choice is to use $\theta = \operatorname{Arg}(z)$, where $\operatorname{Arg}(z)$ is the unique angle in $(-\pi,\pi]$ satisfying $\cos\theta= Re(z)/|z|$ and $\sin\theta= Im(z)/|z|$. Note that it is a bad idea to say $\tan(\theta) = Im(z)/Re(z)$ because $Re(z)$ might be zero. It is even worse to define $\theta = \tan^{-1}(Im(z)/Re(z))$ because not only can $Re(z)$ be zero, but this way, $\theta$ must be in a right-hand quadrant, which might not be correct.

While using $\operatorname{Arg}(z)$ is the most popular way to choose $\theta$, I don't know if there is any mathematical reason why it is the best way.

To compute $\operatorname{Arg}(z)$ using Java, if you are lucky, there will be a two-argument "Arg"-type function. If this does not exist, you should use the regular inverse tangent function, but you will have to do several cases, depending on the signs of $x$ and $y$, and in some cases you will have to add or subtract $\pi$ from the output of the inverse tangent function.

EDIT: dfeuer makes a good observation in his/her answer, and I hope s/he doesn't mind if I steal it and repeat it here: if $n$ is an integer and $z$ a complex number, then $z^n$ is unambiguously defined and can be computed in the obvious way (repeated multiplication and/or repeated squaring) or by using the scheme above (you will get the same answer regardless of which sensible $\theta$ you use). Of course, $0^n$ is undefined if $n<0$, and it is debatable whether $0^0$ should be given a value (in many applications, people seem to treat it as $1$). If the exponent $\alpha$ is rational, then as s/he writes, then $z^\alpha$ has finitely many values that might make sense. If your exponent is 2.56, which simplfies to $64/25$, there are "only" 25 possible possible values for $z^{2.56}$ if $z \neq 0$.