Why doesn't Desmos Graphing Calculator graph $(-1)^x$?
On Desmos on my browser the graph of $(-1)^x$ fluctuates between plotting barely any points, one almost completely filled in line, and two almost completely filled in lines depending on the width of my browser window. Unfortunately when I tried to show this off in class on another similar computer I wasn't able to get anything to show up (it probably depends on screen resolution!)
Roughly speaking, Desmos breaks up the $x$-axis of the viewing window into a bunch of discrete, evenly spaced points, probably one for each pixel, and plugs those values into the function. Desmos is perfectly happy to take some random decimals and plug them into $(-1)^x$, such as:
- $(-1)^{3.12}$ which gives $1$,
- $(-1)^{3.14}$ which gives undefined,
- $(-1)^{3.24}$ which gives $-1$.
This seems to be based on reduced fraction representations of the decimals:
- $3.12 = \frac{78}{25}$, so we're taking an even power of the 25th root of -1 (i.e. -1)
- $3.14 = \frac{157}{50}$, so we're trying to take an even root of -1, which is undefined to a real-numbers based calculator
- $3.24 = \frac{81}{25}$, so we're taking an odd power of the 25th root of -1 (i.e. -1)
Depending on which specific decimals Desmos chooses to plug in, you'll get different looking graphs.