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?
Mathematica Stack Exchange is a question and answer site for users of Wolfram Mathematica. It only takes a minute to sign up.
Sign up to join this community
Plot
is doing some transformation that it shouldn't. $\endgroup$ – Michael E2 Feb 10 at 3:16Plot[Im[1/((-1)^(2/3) + x)], {x, 0, 1}]
works as expected. $\endgroup$ – Roma Lee Feb 10 at 3:18Plot[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}]
$\endgroup$ – Michael E2 Feb 10 at 3:24_Complex
pattern. Maybe Mma erroneously assumes the argument ofIm
is real as there are noComplex
heads? But then whyPlot[Im[1/((-1)^(2/3) + x)], {x, 0, 1}]
work fine? $\endgroup$ – Roma Lee Feb 10 at 3:30Plot[N@Im[(1 + (-1)^(2/3)*x)/((-1)^(2/3) + x)], {x, 0, 1}]
. AddEvaluate
, and YEP:Plot[Evaluate@N@Im[(1 + (-1)^(2/3)*x)/((-1)^(2/3) + x)], {x, 0, 1}]
$\endgroup$ – Michael E2 Feb 10 at 3:30