1
$\begingroup$

When looking for the critical points of $f(x,y) = x^6+y^6+x^2+y^2$ only on the set $M = \lbrace (x,y) \in \mathbb{R}^2 \mid x^2+y^2 = 1 \rbrace$ I ask myself for a good visualization. So it would be great to have the 3DPlot of $f$ with all the points on the surface of $f(x,y)$ marked where $(x,y) \in M$.

Something like that:

enter image description here

$\endgroup$
3
$\begingroup$
f[x_, y_] := x^6 + y^6 + x^2 + y^2

Plot3D[f[x, y], {x, -2, 2}, {y, -2, 2}, 
 MeshFunctions -> {#^2 + #2^2 &},
 Mesh -> {{1}}, 
 MeshStyle -> Directive[Red, Thick]]

enter image description here

Update: Keeping the original mesh lines in a single Plot3D:

Using multiple MeshFunctions:

Plot3D[f[x, y], {x, -2, 2}, {y, -2, 2}, 
 MeshFunctions -> {#^2 + #2^2 &, # &, #2 &}, 
 Mesh -> {{1}, 20, 20}, 
 MeshStyle -> {Directive[Red, Thick], Gray, Gray}]

enter image description here

Using two functions as the first argument and using the option BoundaryStyle:

Plot3D[{f[x, y], ConditionalExpression[f[x, y], x^2 + y^2 <= 1]}, 
 {x, -2, 2}, {y, -2,  2}, PlotStyle -> {LightBlue, None}, 
 BoundaryStyle -> {2 -> Directive[Red, Thick]}]

enter image description here

Update 2: to visualize the region $M=\lbrace (x,y) \in \mathbb(R)^2 \mid x^2 + y^2 < 1 \rbrace$:

Plot3D[{ConditionalExpression[f[x, y], x^2 + y^2 >= 1], 
  ConditionalExpression[f[x, y], x^2 + y^2 <= 1]}, 
{x, -2, 2}, {y, -2, 2}, PlotStyle -> {LightBlue, Red}]

enter image description here

$\endgroup$
  • $\begingroup$ Thank you for your help. $\endgroup$ – Arjihad Jul 1 '18 at 9:57
  • $\begingroup$ @Arjihad, my pleasure. Thank you for the accept. $\endgroup$ – kglr Jul 1 '18 at 12:01
3
$\begingroup$

Here is a way to get exactly the picture you showed, including the regular mesh lines on the surface:

f[x_, y_] := x^6 + y^6 + x^2 + y^2
surf = Plot3D[f[x, y], {x, -2, 2}, {y, -2, 2}, PlotTheme -> "Classic"];
intersect = 
  Plot3D[f[x, y], {x, -2, 2}, {y, -2, 2}, PlotStyle -> {FaceForm[]}, 
   BoundaryStyle -> None, MeshFunctions -> {#^2 + #2^2 &}, 
   Mesh -> {{1}}, MeshStyle -> Directive[Red, Thickness[.01]]];
Show[surf, intersect]

Mathematica graphics

I used the same trick as @kglr but combined two versions of the plot. One uses the mesh to create the intersection only (no surface), and the other creates only the surface with its regular mesh. To combine them, I use Show, which is really the general way to put any number of 3D plots together as one unit.

$\endgroup$
  • $\begingroup$ Is there a there a way to visualize the same plot with $M=\lbrace (x,y) \in \mathbb(R)^2 \mid x^2 + y^2 < 1 \rbrace$ ? $\endgroup$ – Arjihad Jul 1 '18 at 6:43
  • $\begingroup$ Looks like @kglr already added that. $\endgroup$ – Jens Jul 1 '18 at 15:05

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.