This should have a trivial solution, but how do I plot a list of (complex) numbers in the complex plane? Or, put another way, why doesn't the code below work?
I get the error "... is not a list of numbers or pairs of numbers."
I'm pretty new to Mathematica, so I'm kinda fumbling in the dark. I've taken the last part of the code from here.
EDIT: Rahul found the bug, it's corrected in the code below. However, I only see two points in the resulting plot, instead of the expected four. Why?
k = 2;
S = Sum[Sign[i] x^(n + i), {i, -k, k}];
sol = N[ComplexExpand[FullSimplify[Solve[S == 0, x]]]]
(* {{x -> -1.}, {x -> 1.}, {x -> -0.5 - 0.866025 I}, {x -> -0.5 + 0.866025 I}} *)
p = ListPlot[{Re[#], Im[#]} & /@x /. sol,
AxesOrigin -> {0, 0},
PlotRange -> {{-1.2, 1.2}, {-1.2, 1.2}},
ImagePadding -> 40,
AspectRatio -> 1,
Frame -> True,
FrameLabel -> {{Im, None}, {Re, "complex plane"}},
PlotStyle -> Directive[Red, PointSize[.02]]];
Show[p]


solis not a list of complex numbers.solis a list of replacement rules, each of which replacesxwith a complex number. So you should plot(x /. sol)instead ofsoldirectly. – Feb 25 '16 at 20:08{Re[#], Im[#]} & /@ (x /. sol).ReplaceAllhas lower precedence thanMap, so you need some braces here. – Yves Klett Feb 26 '16 at 14:19