0

I am dealing with an algebraic mess of variables for a project and for some reason, even though the function is real, Mathematica had been spitting out imaginary values to me. This issue has been plaguing me for weeks and I finally pinned it down to the fact that Mathematica freezes when it is faced with something like

$(-x^3)^{1/3}$

When I supply a real positive value for $x$, it will always go for the imaginary number.

Now I know about the CubeRoot function and the Surd function. However, I have expressions with ~200-2000 terms in it and I don't want to take the time to hunt down every instance of cube roots. How can I force Mathematica to just give me the real values?

  • Perhaps you could try a replacement rule? It won't find everything, due to powers in the denominator, but it's a start: expr /. a_^(1/3) :> Surd[a, 3]. – march Apr 23 '21 at 21:36
  • Artes, no unfortunately. The cube roots I need evaluated correctly are buried deeply into expressions and Surd and CubeRoot do not hunt down these problematic terms. – cheekylittleduck Apr 23 '21 at 22:04
  • Can you use Refine[expression, x>0], followed by the replacement (-1)^(1/3) -> -1? That's similar to march's suggestion but might get more of the powers. – tad Apr 24 '21 at 00:33
  • How do you generate these expressions? Probably it makes sense to modify how the expressions are generated to take into account your reality assumptions. – Carl Woll Apr 24 '21 at 01:07

0 Answers0