When the x
is fixed, then we set {D[z, y] == 0, D[z, {y, 2}] >= 0}
to get the local minimum.
f[x_, y_] := x^2 + y^2 + 3*x*y;
min = Plot3D[f[x, y], {x, -10, 10}, {y, -40, 40},
MeshFunctions -> {Function[{x, y, z}, D[f[x, y], y] // Evaluate]},
RegionFunction ->
Function[{x, y, z}, D[f[x, y], {y, 2}] > 0 // Evaluate],
Mesh -> {{0}}, MeshStyle -> Directive@{Thick, Red},
PlotStyle -> None, BoundaryStyle -> None];
plot3D =
Show[Plot3D[f[x, y], {x, -10, 10}, {y, -40, 40}, Mesh -> None], min,
PlotRange -> All, ViewProjection -> "Orthographic",
BoxRatios -> 1];
reg = ParametricRegion[{{x, f[x, y]}, {D[f[x, y], y] == 0,
D[f[x, y], {y, 2}] >= 0, -10 <= x <= 10}}, {x, y}];
plot2D = Region[Style[reg, Red], Axes -> True, AspectRatio -> 1];
{plot3D, plot2D}
- For the function
f[x_,y_]:=x^2+y^2-3*x*y-x^2*y-x*y^2;
Clear["Global`*"];
f[x_, y_] := x^2 + y^2 + 3*x*y - x^2*y - x*y^2;
reg3d = ParametricRegion[{{x, y, f[x, y]}, {D[f[x, y], y] == 0,
D[f[x, y], {y, 2}] >= 0, -10 <= x <= 10, -20 <= y <= 20}}, {x,
y}];
plot3d =
HighlightMesh[
DiscretizeRegion[reg3d, Axes -> True, BoxRatios -> 1,
PlotRange -> {{-10, 10}, {-20, 20}, {-50, 50}}], {Style[0, None],
Style[1, Directive@{Thick, Red}]}, ViewPoint -> Front,
ViewProjection -> "Orthographic"];
plot = Show[Plot3D[f[x, y], {x, -10, 10}, {y, -20, 20}, Mesh -> None],
plot3d, BoxRatios -> 1];
reg = ParametricRegion[{{x, f[x, y]}, {D[f[x, y], y] == 0,
D[f[x, y], {y, 2}] >= 0, -10 <= x <= 10, -20 <= y <= 20}}, {x,
y}];
plot2D =
Region[Style[reg, Red], Axes -> True, AspectRatio -> 1,
PlotRange -> {{-10, 10}, {-50, 50}}];
{plot, plot3d, plot2D}
f[x_, y_] := x^2 + y^2 + 3*x*y - x^2*y - x*y^2;
Plot3D[f[x, y], {x, -10, 10}, {y, -20, 20},
MeshFunctions -> Function[{x, y, z}, Evaluate@D[f[x, y], y]],
Mesh -> {{0}}, MeshStyle -> Red,
RegionFunction ->
Function[{x, y, z}, Evaluate[D[f[x, y], {y, 2}] >= 0]],
PlotPoints -> 80, MaxRecursion -> 4, BoundaryStyle -> None,
ClippingStyle -> None, Axes -> True, BoxRatios -> 1,
PlotRange -> {{-10, 10}, {-20, 20}, {-50, 50}}, PlotStyle -> None,
ViewPoint -> Front, ViewProjection -> "Orthographic"]