1
$\begingroup$

I have a function

 g[x_] := (x^3 - x^2)^(1/3)

that I want to plot. The plot I am getting gives me strange results. There is nothing plotted for x < 1, contrary to the results that I can obtain from my calculator. Do you have a idea why?

$\endgroup$
5
  • 4
    $\begingroup$ You need to cut and paste both the code for the function and the code you used to Plot that failed to work properly. It might be related to the result creating an imaginary number. $\endgroup$ Oct 7, 2015 at 19:15
  • $\begingroup$ The function is imaginary for certain values of x. You can see the real part of the solution by plotting Plot[Re@g[x],{x,0,2}] Also, I second Jack LaVinge. $\endgroup$
    – N.J.Evans
    Oct 7, 2015 at 19:17
  • $\begingroup$ Yes but i use mathematica exchange with my phone because i have issues with my connection at the moment. Thank you for your understanding. $\endgroup$
    – Bendesarts
    Oct 7, 2015 at 19:17
  • $\begingroup$ But as it is a ^(1/3) cubic roots normally the function is defined on R,isn t it? $\endgroup$
    – Bendesarts
    Oct 7, 2015 at 19:27
  • $\begingroup$ For the origin of surd see Etymology of "surd" $\endgroup$
    – Bob Hanlon
    Oct 7, 2015 at 21:50

1 Answer 1

5
$\begingroup$

You probably want to use Surd rather than Power. Mathematica normally treats expressions as complex-valued, which may give results differing from most calculators, which are restricted to the reals. Surd is provided to give calculator-like behavior when that is desired.

g[x_] := Surd[x^3 - x^2, 3]
With[{a = 3}, Plot[g[x], {x, -a, a}]]

plot

$\endgroup$
3
  • $\begingroup$ Perfect thank you and do you know what is the origin of this label "Surd"? $\endgroup$
    – Bendesarts
    Oct 7, 2015 at 19:38
  • 2
    $\begingroup$ @Bendesarts. I believe it is an old word pertaining to the extraction of irrational roots of integers; recall that "absurd" and "irrational" are practically synonyms. $\endgroup$
    – m_goldberg
    Oct 7, 2015 at 19:43
  • 7
    $\begingroup$ Or use CubeRoot. $\endgroup$ Oct 7, 2015 at 19:49

Not the answer you're looking for? Browse other questions tagged or ask your own question.