The simplest solution to this type of problem is usually to use a function like Solve
or NSolve
to generate solutions to an equation, which can then be plotted.
In this case, I would do the following:
Plot[p /. NSolve[p^3 == x, p, Reals], {x, -10, 10}]

All I am doing is plotting p
such that p
is a solution to p^3 == x
. NSolve
allows me to force the result to be a real number.
This is a (very) minor variation on the techniques mentioned in solutions that you link in your question.
I recommend that you read this link for more information on why Mathematica does what it does. Essentially, real numbers have unique cube roots, but (non-zero) complex numbers have 3 distinct roots. Mathematica assumes that all symbols are complex, so it has a choice about which of the 3 roots it could return. For reasons explained in the link, Mathematica chooses the complex root with a positive imaginary part.
Addendum by J. M.
In version 9, one now has the new functions CubeRoot[]
, which returns real-valued cube roots of real numbers (and does not evaluate for complex arguments), and the more general Surd[]
. See the documentation for details.
Plot[Root[#^3 - x &, 1], {x, -2, 2}]
, which works. $\endgroup$