# Expression for the real 7/3 power

I need an expression for the real 7/3 power of a real-valued function, i.e., a reformulation of

f[x_] := g[x]^(7/3)


that works for negative values of g[x]. This function and its first and second derivatives are used in heavy computation (i.e. in objectives to FindMinimum) and need to be well-defined at all values of x. In particular, I've tried the following, which don't work:

f[x_] := g[x]^(7/3)


which gives complex values at negative values of g[x], and

f[x_] := Surd[g[x],3]^7


which gives a "Infinite expression" error when its derivative is evaluated at 0.

• (-1)^(7/3) == ??? Mar 6, 2013 at 17:00
• @belisarius I'm sure he's interpreting this as -1 and that's rather the point of the new CubeRoot and Surd functions. Mar 6, 2013 at 17:02
• Why doesn't f[x_] := Piecewise[{{g[x]^(7/3), g[x] >= 0}}, -(-g[x])^(7/3)] work? Mar 6, 2013 at 17:52
• @belisarius I want the real 7/3 power of a real number, which is well defined over all $\mathbb{R}$. Mar 6, 2013 at 19:27
• @whuber Thanks, I will try that. Mar 6, 2013 at 19:27

To some extent, this is understandable given the formula for the derivative of the Surd.

D[Surd[x^4, 3], x] // InputForm
(* Out: (4*x^3)/(3*Surd[x^4, 3]^2) *)


Of course, this formula is good, except when $x=0$. Computer algebra systems frequently return this type of "generic" result. If you really need to work at zero, perhaps something like the following will work:

Clear[f, fp];
f[x_] = CubeRoot[x^7];
fp[x_] := f'[x] /; x != 0;
fp[0] = fp[0.0] = 0;


This should define a function fp representing your derivative that might work as expected. It also might depend on what you need to do with it.

• $f$ is used as input to functionals in my code that themselves take D of it, so if possible I would like to avoid having to define the derivative of f specially. Mar 6, 2013 at 19:26
• (Also, I suppose I hoped Mathematica would be "smart" enough to take a limit at 0, instead of throwing up its hands and aborting with an error.) Mar 6, 2013 at 19:30
• If I define the function just as f[x_] := Surd[x, 3]^7 and then make this: Plot[Evaluate[D[f[x], x]], {x, -1, 1}] it returns a plot. However, if I define it like this: f[x_] = D[Surd[x, 3]^7, x] /; x != 0; and try to draw the same plot or the one with the exclusion: Plot[Evaluate[f[x]], {x, -1, 1}, Exclusions -> x == 0] it returns nothing at all. Do you know why? Mar 7, 2013 at 8:39
• @Alexei It is semantically meaningless. Test it yourself by plugging in some particular arguments, as in f[1]. Remove the /; x!= 0 codicil and you might be more successful. Mar 7, 2013 at 9:07
• @whuber. Thank you. In fact I started my question with that. I tried your test as well and see what happens, but I seem to not understand its origin. Where is the difference between the operator written in the answer above and the one I wrote? I seem to only combined the second and third lines from that answer in one statement. The result is, however, clearly not what I expected, meaning that I am missing something important. Mar 8, 2013 at 9:52