I have this 3-variable function

f := 16 ((-1 + (9 x^2)/4) Cos[z] Cosh[(π x)/3] + 
      3 x Sin[z] Sinh[(π x)/3]) Sinh[π x] + 
   8 (-1 + (9 x^2)/4) Sinh[x y] + (-3 + (9 x^2)/4)^2 Sinh[
     x (2 π + y)] - (1 + (9 x^2)/
      4)^2 (2 Cosh[(2 π x)/3] Sinh[x y] + Sinh[2 π x - x y]);

I use ContourPlot3D as

ContourPlot3D[f == 0, {x, 1.1, 1.21}, {y, 2, 2.2}, {z, 0.8, 1.2}]

and I get the result (I have attached different orientations of the plot)

enter image description here

Here, I see an empty part in between. I am sure that these two sheets either touch each other or avoid each other. So, this empty part (if it is really empty!) should not be true. How can I get a more accurate result (plot) to make sure that they are continuous (meet each other) or not?


1 Answer 1


Yes, there is a critical point where the sheets join:

jac = D[f, {{x, y, z}}];

FindRoot[jac == {0, 0, 0}, {{x, 1.1}, {y, 2.1}, {z, 1}}];
cpt = {x, y, z} /. %
f /. %%
  {1.1597, 2.12999, 0.963489}
  0.                           <-- on the surface  f == 0

Put the critical point in the middle of the plot (and use an odd number for PlotPoints, default = 15).

cplot = ContourPlot3D[
  ff == 0,
  {x, cpt[[1]] - 0.1, cpt[[1]] + 0.1},
  {y, cpt[[2]] - 0.3, cpt[[2]] + 0.3},
  {z, cpt[[3]] - 0.6, cpt[[3]] + 0.6}, 
  AxesLabel -> Automatic]

enter image description here

Discussion. Contour plotting is accomplished via discrete sampling and the application of the intermediate value theorem to determine when the contour surface passes through a mesh element. It's a fairly rough way to approximate a surface. It performs best when a single sheet of a surface passes through a mesh element. When sheets intersect or touch, it is sometimes hard to deduce what is going on. Typical approaches include increasing PlotPoints (default value 15) or MaxRecursion (default value 2). These approaches lead to a finer mesh and smaller holes. Sometimes they resolve the problem completely. Above we were able to apply specific knowledge about the surface. Had there been two such critical points, we could probably not make the above work.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.