1
$\begingroup$

I have the following code:

ContourPlot3D[2x*z + 2y*z - y^3 - x^2 - 3z^2, {x, -3, 3}, {y, -3, 3}, {z, -3,3}]

which correctly produces a 3D plot of the function specified.

I was wondering if there was a way to demonstrate the critical points of the function on this plot? There are two:

  • (0,0,0) - saddle point
  • (1/6,1/3,1/6) - local max
$\endgroup$
2
$\begingroup$

One way to do this is to use Show, to combine two graphics:

Show[
 ContourPlot3D[
  2 x*z + 2 y*z - y^3 - x^2 - 3 z^2, {x, -3, 3}, {y, -3, 3}, {z, -3, 
   3}],
 Graphics3D[{PointSize[Large], Red, Point[{0, 0, 0}], 
   Point[{1/6, 1/3, 1/6}]}]
 ]
|improve this answer|||||
$\endgroup$
  • $\begingroup$ Not possible in 3D with Epilog, as anything in the Epilog is taken to be 2D and rendered on top. $\endgroup$ – Szabolcs Oct 1 '19 at 11:32
  • $\begingroup$ It is better to add ContourStyle -> Opacity[0.5] or another appropriate value to ContourPlot3D to show points behind the surface. And probably Mesh -> None, but I'm not sure what picture OP want. $\endgroup$ – Alx Oct 1 '19 at 11:34
  • $\begingroup$ @Szabolcs Indeed, I read the documentation after writing the answer :) It seems strange to me that there's nothing like Epilog3D. $\endgroup$ – Carl Lange Oct 1 '19 at 12:16
  • 2
    $\begingroup$ I think it might be because in 3D it doesn't make sense to have a layer behind (Prolog) and a layer in front of (Epilog) of the main graphics, like it does in 2D. (Of course, even if it doesn't make physical sense, it can certainly be rendered that way on a computer.) $\endgroup$ – Szabolcs Oct 1 '19 at 14:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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