# Plot[Im[f[x]],...] incorrectly gives graph of identical zero function

Consider

Plot[Im[(1 + (-1)^(2/3)*x)/((-1)^(2/3) + x)], {x, 0, 1}]


At least in Mma 11 it gives the following picture: Meanwhile,

Plot[Im[ComplexExpand[(1 + (-1)^(2/3)*x)/((-1)^(2/3) + x)]], {x, 0,
1}]


What is going on here?

• My initial guess is that it's a bug, and Plot is doing some transformation that it shouldn't. Feb 10 at 3:16
• At the same time, e.g., Plot[Im[1/((-1)^(2/3) + x)], {x, 0, 1}] works as expected. Feb 10 at 3:18
• It works with arbitrary precision: Plot[Im[(1 + (-1)^(2/3)*x)/((-1)^(2/3) + x)], {x, 0, 1}, WorkingPrecision -> 10]. It works with a black-box machine-precision function: f[x_?NumericQ] := Im[(1 + (-1)^(2/3)*x)/((-1)^(2/3) + x)]; Plot[f[x], {x, 0, 1}]. And a third way: Plot[Im[(1 + (-1.)^(2/3)*x)/((-1)^(2/3) + x)], {x, 0, 1}] Feb 10 at 3:24
• @MichaelE2 Yes, the erroneous behavior is very fragile. Can it be related to (-1)^(...) representation of complex numbers? I myself make mistakes from time to time when checking for presence of complex numbers with _Complex pattern. Maybe Mma erroneously assumes the argument of Im is real as there are no Complex heads? But then why Plot[Im[1/((-1)^(2/3) + x)], {x, 0, 1}] work fine? Feb 10 at 3:30
• Sorry for all the experiments. NOPE: Plot[N@Im[(1 + (-1)^(2/3)*x)/((-1)^(2/3) + x)], {x, 0, 1}]. Add Evaluate, and YEP: Plot[Evaluate@N@Im[(1 + (-1)^(2/3)*x)/((-1)^(2/3) + x)], {x, 0, 1}] Feb 10 at 3:30