Mathematica Stack Exchange is a question and answer site for users of Mathematica. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am wondering why the following fails to cover the surface at points near $k = 0$.

c[z_] := (z + 1) (z - 1) (z + 1 + I);

ContourPlot3D[Abs[c[x + I y]] == k^3, {x, -2.5, 2}, {y, -2, 2}, 
{k, 0, 1.75}, Background -> White, AxesLabel -> {"x", "y", "k"}]

Mathematica graphics

Furthermore, when the left hand side is complex expanded and the equation is rearranged with $2xy+k^3$ on the right, the curve looks significantly different, with one large and one small foot, both touching at zero. Why is that?

share|improve this question
Could you provide more detail on your rearrangement process? – Sjoerd C. de Vries Mar 26 '14 at 21:05
It's a sampling issue; you could try increasing PlotPoints or MaxRecursion. But why not apply Plot3D to $|c(x+iy)|^{1/3}$ instead? It'll be much faster, and then you can increase MaxRecursion to like 5 and get a really nice plot very quickly. – Rahul Mar 26 '14 at 21:45
There's a lot of space and not a lot of contours down there. So, while sampling points it is highly unlikely to get points outside and inside the countour near k = 0. And ContourPlot is looking for the switch of sign of lhs-rhs of equation, roughly speaking. – Kuba Mar 26 '14 at 21:45
@Kuba: You took 4 seconds to write a better explanation of the sampling problem. :) – Rahul Mar 26 '14 at 21:47
@Sjoerd, I just captured the results of c[x + y I] and moved 2xy to the RHS. ContourPlot3D[ Abs[-1 - x + x^2 + x^3 - y^2 - 3 x y^2 + I (-1 + x^2 - y + 2 x y + 3 x^2 y - y^2 - y^3)] == 2 x y + k^3, {x, -2.5, 2}, {y, -2, 2}, {k, 0, 1.75}] – Gary Palmer Mar 26 '14 at 23:21
up vote 8 down vote accepted

ContourPlot3D is not very good at resolving thin features, because it only knows that the feature exists when one of the sampling points happens to land inside it. In general, one thing you can do is to increase PlotPoints, which improves the plot but takes a very long time.

 Abs[c[x + I y]] == k^3, {x, -2.5, 2}, {y, -2, 2}, {k, 0, 1.75}, 
 Background -> White, AxesLabel -> {"x", "y", "k"}, PlotPoints -> 20]

enter image description here

In this particular case, though, your plot is equivalent to $k = |c(x+iy)|^{1/3}$, so you could just use Plot3D instead. This is much faster because it only has to sample the two-dimensional $xy$ plane rather than the three-dimensional $xyk$ space. Then you can afford to make MaxRecursion quite large and it's still really quick to plot.

Plot3D[Abs[c[x + I y]]^(1/3), {x, -2.5, 2}, {y, -2, 2}, PlotRange -> {0, 1.75},
 Background -> White, AxesLabel -> {"x", "y", "k"}, ClippingStyle -> None,
 BoxRatios -> 1, MeshFunctions -> {#1 &, #2 &, #3 &}, MaxRecursion -> 5]

enter image description here

(I've added a few options to make it look like your original plot.)

share|improve this answer
Exceptionally helpful answer. – Gary Palmer Mar 26 '14 at 23:30

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.