# How can I highlight the vanishing-partials in an interactive 3D plot?

I am using Manipulate and Plot3D to plot a function with two real variables and two extra parameters.

f[x_, y_, alpha_, gamma_] := x*y + alpha*x - Log[Power[x, gamma]*y]
Manipulate[
Plot3D[f[x, y, alpha, gamma], {x, 0, 5}, {y, 0, 5},
PlotStyle -> Opacity[0.4]],
{alpha, -100, 100, 0.1}, {gamma, -100,
100, 0.1}]


I want to dynamically highlight/plot the 3D curve (or set of points) of the vanishing partials (D[f, x] == D[f, y] == 0) over the function, and have it update according to the parameter values manipulated.

I know I should probably use NDSolve for this, But I need the solution to be updated and displayed on parameter changes. How do I do that?

I would use MeshFunctions, although self-intersecting mesh lines usually aren't connected properly. Increasing PlotPoints helps.

g[x_, y_] := Cos[2 x + y] + y^3/2 - y;
Plot3D[g[x, y], {x, -2, 2}, {y, -2, 2},
PlotPoints -> ControlActive[Automatic, 50], MeshStyle -> {Blue, Red},
MeshFunctions -> {Function[{x, y, z}, Derivative[1, 0][g][x, y]],
Function[{x, y, z}, Derivative[0, 1][g][x, y]]},
Mesh -> {{0}, {0}}] f[x_, y_, alpha_, gamma_] := x*y + alpha*x - Log[Power[x, gamma]*y]
Manipulate[
Plot3D[f[x, y, alpha, gamma], {x, 0, 5}, {y, 0, 5},
PlotStyle -> Opacity[0.4],
PlotPoints -> ControlActive[Automatic, 50],
MeshStyle -> {Blue, Red},
MeshFunctions -> {Function[{x, y, z}, Derivative[1, 0, 0, 0][f][x, y, alpha, gamma]],
Function[{x, y, z}, Derivative[0, 1, 0, 0][f][x, y, alpha, gamma]]},
Mesh -> {{0}, {0}}],
{alpha, -100, 100, 0.1}, {gamma, -100, 100, 0.1}]

• Thanks @Michael E2 ! And another thing.. How do I keep the same functionality but have alpha and gamma not be arguments of f? Mar 15 '13 at 14:37
• You could put the function definition inside Manipulate and set TrackedSymbols :> {alpha, gamma}. Mar 15 '13 at 19:35