How to find real part of $x^i$ without the "arg(x)" I am a novice at complex analysis - more experienced in algebra and calculus (real).
To find the real part of $x^i$, I first had to do something: Solve $x^i = e^{iy}$ for y then find $a$ and $b$ using Euler's formula.
Take $\ln$ of both sides: $i\ln(x) = iy$, $y = \ln(x)$
$e^{i\ln(x)} = \cos(\ln(x)) + i\sin\left(\ln(x)\right)$, the real part of $x^i$ should be $\cos(\ln(x))$, but this is incorrect. According to WolframAlpha, there is a whole other part of the solution that I missed.

I had to look up what that thing, the "complex argument" function, was - it is the angle to the origin of right angle triangles made to find complex-plane coordinates. However, due to the fact that the other part of the equation with the ln is definitely real, the "arg" function has to be real - or otherwise this wouldn't be the "real part" of anything (e to an imaginary power doesn't show up on real graphs - it isn't real) - despite this, there was no straight-to-the-point formula on the internet giving $\arg(x)$ in terms of real elementary functions - instead they all referred back to the fact that $\arg(a + bi) = \tan^{-1}(\frac{b}{a})$ which I'm guessing they derived from the right triangle in the complex coordinates analysis - since WolframAlpha didn't bother to simplify it, it seemed like if I wanted to turn this function into a more familiar inverse tan function I had to express the identity function in terms of real and imaginary parts; $a = x$, $b = 0$ - therefore we get $\tan^{-1}(0) = 0$ - implying $e^0$ would cancel to $1$ and I was right after all, the function never even existed to begin with. However when plotted, the two graphs are not the same. How can I turn "$\arg(x)$" into a recognizable, elementary, real function? So that the real part of $x^i$ could be plotted on Desmos, for example. My guess is that it is an unfortunate byproduct of taking the natural logarithm of an imaginary number at the start or it is an unspoken condition related to Euler's formula.
 A: $x^i$ is multivalued. As an example, consider $x=-2$. We have (as Gary pointed out) for $n\in\Bbb Z$,
$$-2 = e^{\ln(-2)} = e^{\ln\lvert-2\rvert+i\arg(-2)} e^{i2n\pi} = e^{\ln(2)} e^{i\left(2n\pi+\arg(-2)\right)} \\
\implies (-2)^i = e^{i\ln(2)} e^{-2n\pi-\arg(-2)} \\
\implies \Re (-2)^i = e^{-(2n+1)\pi} \cos(\ln(2))$$
WolframAlpha usually generates a table like this one when a result can be multivalued:

WolframAlpha assumes the principal branch, so that
$$x = e^{\ln\lvert x\rvert} e^{i\arg(x)} \implies x^i = e^{i\ln\lvert x\rvert} e^{-\arg(x)} \implies \Re x^i = \cos(\ln\lvert x\rvert) e^{-\arg(x)}$$
where
$$e^{-\arg(x)} = \begin{cases}e^{-\pi} & \text{if }x<0 \\1 & \text{otherwise}\end{cases}$$
It's a bit hard to tell with their default plot themes, but they do overlap:

A: Recall that complex numbers can be written in either rectangular or polar coordinates.
$$z = x + iy = r(\cos \theta + i \sin\theta)$$
The $\arg(z)$ notation just asks “What is $\theta$?”, the same way that $|z|$ asks “What is $r$?”  But while the latter has a simple closed-form formula $r = |z| = \sqrt{x^2 + y^2}$, $\arg$ is harder to express in such a simple way.
Matching up the real and imaginary parts of $z$ in both coordinate systems, we get $x = r \cos \theta$ and $y = r \sin \theta$.  From this, we get $\frac{y}{x} = \frac{r \sin \theta}{r \cos \theta} = \frac{\sin \theta}{\cos \theta} = \tan \theta$.  But we can't just say that $\theta = \arctan(\frac{y}{x})$, for two reasons:

*

*The expression $\frac{y}{x}$ is undefined when $x = 0$.  But complex numbers with $x = 0$ (aka pure imaginary numbers) are valid.

*The $\arctan$ function has a range of $(-\frac{\pi}{2}, \frac{\pi}{2})$  (with endpoints included if you accept $\pm \infty$ as inputs).  But that covers only half of the complex plane (Quadrants 1 and 4).  We also need to handle Quadrants 2 and 3.

So, a more careful definition of $\arg$ is the piecewise function:
$$\arg(z := x + iy) = \begin{cases} \arctan(\frac{y}{x}) ,& x > 0 \\ \frac{\pi}{2} - \arctan(\frac{y}{x}) ,& x < 0 \land y > 0 \\ -\frac{\pi}{2} - \arctan(\frac{y}{x}) ,& x < 0 \land y < 0 \\ \frac{\pi}{2} ,& x = 0 \land y > 0  \\ -\frac{\pi}{2} ,& x = 0 \land y < 0 \\ \pm\pi ,& x < 0 \land y = 0\\ \text{undefined} ,& x = 0 \land y = 0 \end{cases}$$
However, you seem to be assuming that the $x$ in $x^i$ is real, so we only need to consider the cases where the imaginary part $y$ is zero.
$$\arg(z := x) = \begin{cases} 0 ,& x > 0 \\ \pm\pi ,& x < 0\\ \text{undefined} ,& x = 0 \end{cases}$$
If $x > 0$, then $\arg(x) = 0$, so WA's expression $e^{-\arg(x)} \cos(\frac{\log(x^2)}{2})$ simplifies to $\cos(\frac{\log(x^2)}{2})$, which simplifies further to $\cos(\log(x))$.
A: $\arg(x) = \frac{\pi}{2} - \frac{\pi}{2}\operatorname{sgn}(x)$ therefore $$\operatorname{Re}(x^i) = e^{\frac{\pi}{2}\operatorname{sgn}(x) - \frac{\pi}{2}}\cos\left(\frac{\ln(x^2)}{2}\right).$$
My graph looks the same to the graph given by WolframAlpha so it is the same function most likely (same shape, same roots, same y-intercept, same stationary points etc.)
Thanks to @user170231
