How can I plot $y^x$?

117 Views Asked by At

How can I plot $y^x$? To keep things simple and to not have another $z$ variable on the other end of the equation, let's assume $y^x=10$. As long as that value is not $0$, the curve we get should look about the same.

The problem arises when $x$ is negative. The thing is, when $x$ is an odd, then y can only be a positive number. However, when $x$ is even, y can be either positive or negative. Therefore, if you look at the $x$ negative side of the graph, you would be able to mark a point whenever $x$ is even, but there would be no point when it is odd. So how could you graph such a thing? I simply have no idea what happens between two negative odd numbers (e.g. how does the curve behave between $-1$ and $-3$?)

As always, I tried WolframAlpha, and even it has trouble graphing the thing! Here is what it ends up with.

2

There are 2 best solutions below

2
On

$y^x = 10$ is equivalent to $e^{x\ln y}=10$, i.e. $\ln y=\frac{\ln 10}{x}$, or (again) $y=e^{\frac{\ln 10}{x}}$ (in particular, from the very beginning observe that we must have $y > 0$ for the expression to be defined without ambiguity). The latter form can be easily plotted, e.g. via Mathematica.

2
On

In Matlab:

>> x=linspace(-10,10,5000);
>> y=linspace(-10,10,5000);
>> t=y.^x-10;
>> plot(x,real(t))
>> plot(x,imag(t))

Real:

enter image description here

Imaginary:

enter image description here


Mathematica 3D plots:

Plot3D[Re[y^x - 10], {x, -10, 10}, {y, -10, 10}]
Plot3D[Im[y^x - 10], {x, -10, 10}, {y, -10, 10}]

Real:

enter image description here

Imaginary:

enter image description here

2D Contour plots:

ContourPlot[Re[y^x - 10], {x, -10, 10}, {y, -10, 10}]
ContourPlot[Im[y^x - 10], {x, -10, 10}, {y, -10, 10}]

Real:

enter image description here

Imaginary:

enter image description here