I’m trying to get the inverse function of x^3 by using InverseFunction. Can anyone explain the result please?
I really didn’t get the meaning of the symbols # and & in this context.
I got the error: InverseFunction::ifun: Inverse functions are being used. Values may be lost for multivalued inverses.
f[x_] := x^3
InverseFunction[f]
It is not an error, but rather a warning that you are trying to inverte a function that is not invertible in the complex plane. If you wanted the inverse of x^3 on the real line, the answer given by InverseFunction is wrong for negative inputs:
In[176]:= InverseFunction[Function[#^3]][-1.]
Out[176]= 0.5 + 0.866025 I
What you need is either Solve[x^3 == y, x, Reals] or Surd[y, 3], but I don’t know a way to get those with InverseFunction, which is not sophisticated in this respect:
Solve[x^3 == y, x, Reals]
Plot[Root[-y + #1^3 &, 1], {y, -2, 2}]
Plot[Surd[y, 3], {y, -2, 2}]
Thank you very much @Gianluca Gorni for your useful explanantion.
Hi Gennaro,
Plotting the real and imaginary parts of the solutions is a nice way to visualize the problem.
SolveValues[x^3 == y, x] //
Map[ReImPlot[#, {y, -2, 2},
Frame -> True,
PlotLabel -> Style[#, Black],
PlotLabels -> "Expressions",
ReImStyle -> {Automatic, Directive[Red, Dashing[{0.02, 0.01}]]},
ImageSize -> Large] &] //
Partition[#, UpTo@2] & //
Grid[#,
Frame -> All,
Alignment -> Top,
Spacings -> {1, 1}] &