Why the negative number raised to X gives strange graph?
Y = (-1) / X
This is sine and cosine both functions in real and imaginary part.
How to explain this?
If you heard about complex numbers, you should wonder how powers are evaluated in the complex.
A possible definition is with the polar representation
$$z=re^{i\theta}\implies z^x=r^xe^{i\theta x}$$ where $x$ is a real number.
Then
$$(-1)^x=(e^{i\pi})^x=e^{i\pi x}=\cos(\pi x)+i\sin(\pi x).$$
Beware that this is not the definition, because one also has
$$(-1)^x=(e^{i3\pi})^x=\cos(3\pi x)+i\sin(3\pi x)$$ and similar with other $2\pi$ increments.
More generally, a complex raised to a complex power can be defined by logarithms,
$$z^w=e^{w\log z}=e^{w(\log r+i\theta)}=e^{x\log r-y\theta+i(x\theta+y\log r)}=e^{x\log r-y\theta}(\cos(x\theta+y\log r)+i\sin(x\theta+y\log r)).$$
So, let's consider the function $f\left( x \right) = {\left( { - 1} \right)^x}$. It is required to determine the existence domain of this function.
In order to determine the existence domain of the function $f\left( x \right) = {\left( { - 1} \right)^x}$ let's use the well-known Euler's formula that establishes the fundamental relationship between the trigonometric functions and the complex exponential function: ${e^{i \cdot x}} = \cos \left( x \right) + i \cdot \sin \left( x \right)$, where $x$ is arbitrary real number, i.e. $x \in \mathbb R^{1} \equiv \left( { - \infty ,\, + \infty } \right)$, and $i$ is elliptic type imaginary unit, i.e. $i^{2}=-1$.
Since for $\forall n \in \mathbb Z \equiv \{..., -3, -2, -1, 0, +1, +2, +3, ...\}$ we have $\cos \left( {\left( {2 \cdot n + 1} \right) \cdot \pi } \right) = - 1$ and $\sin \left( {\left( {2 \cdot n + 1} \right) \cdot \pi } \right) = 0$, then we can write that $ - 1 = \cos \left( {\left( {2 \cdot n + 1} \right) \cdot \pi } \right) + i \cdot \sin \left( {\left( {2 \cdot n + 1} \right) \cdot \pi } \right) = {e^{i \cdot \left( {2 \cdot n + 1} \right) \cdot \pi }}$. Therefore, the expression ${\left( { - 1} \right)^x} = {\left( {{e^{i \cdot \left( {2 \cdot n + 1} \right) \cdot \pi }}} \right)^x} = {e^{i \cdot \left( {2 \cdot n + 1} \right) \cdot \pi \cdot x}} = \cos \left( {\left( {2 \cdot n + 1} \right) \cdot \pi \cdot x} \right) + i \cdot \sin \left( {\left( {2 \cdot n + 1} \right) \cdot \pi \cdot x} \right)$ is hold true as soon as $\sin \left( {\left( {2 \cdot n + 1} \right) \cdot \pi \cdot x} \right) = 0$.
So, the question of determination of the existence domain of the function $f\left( x \right) = {\left( { - 1} \right)^x}$ is reduced to the problem of solving the equation $\sin \left( {\left( {2 \cdot n + 1} \right) \cdot \pi \cdot x} \right) = 0$.
As we know the equation $\sin \left( \alpha \right) = 0$ has the solution $\alpha = \pi \cdot k$, where $k \in \mathbb Z$. Consequently, from $\sin \left( {\left( {2 \cdot n + 1} \right) \cdot \pi \cdot x} \right) = 0$ we have $\left( {2 \cdot n + 1} \right) \cdot \pi \cdot x = \pi \cdot k$, where $k \in \mathbb Z$, $n \in \mathbb Z$, i.e. $x = \frac{{\pi \cdot k}}{{\left( {2 \cdot n + 1} \right) \cdot \pi }} = \frac{k}{{2 \cdot n + 1}}$, where $k \in \mathbb Z$, $n \in \mathbb Z$.
So, the existence domain of the function $f\left( x \right) = {\left( { - 1} \right)^x}$ is the set $\left\{ {\frac{k}{{2 \cdot n + 1}},\,\,\forall k \in \mathbb Z ,\,\,\forall n \in \mathbb Z} \right\}$. In other words, for each $x \in \left\{ {\frac{k}{{2 \cdot n + 1}},\,\,\forall k \in \mathbb Z ,\,\,\forall n \in \mathbb Z } \right\}$ the function $f\left( x \right) = {\left( { - 1} \right)^x}$ is defined.
Remark. Above I have used the phrase "elliptic type imaginary unit" instead the habitual set expression "imaginary unit". Here I would not like to explain the meaning of the phrase "elliptic type imaginary unit" as well as the meaning of the phrase "elliptic complex number". Here I would like only to note that there are three types' complex numbers: