示例代码:

Clear["`*"];
f[x_, y_] := -(x - 1)^2 - (y + 1)^2;

(*找到最大值点*)
maxPoint = 
 Maximize[{f[x, y], -10 <= x <= 10 && -10 <= y <= 10 && 
    x^2 + y^2  {{{maxPoint[[2, 1, 2]], Blue}}, {{maxPoint[[2, 2, 2]], 
       Black}}}, 
   RegionFunction -> 
    Function[{x, y, z}, x^2 + y^2  Opacity[4/5], 
   Mesh -> None];
Y2 = ListPointPlot3D[{{maxPoint[[2, 1, 2]], maxPoint[[2, 2, 2]], 
     maxPoint[[1]]}}, PlotStyle -> {{PointSize[Large], Red}}];

Show[Y1, Y2]

结果图如下:

mathematica中三维画图中标记函数的最大值点插图

本站无任何商业行为
个人在线分享 » mathematica中三维画图中标记函数的最大值点
E-->