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

示例代码:

复制代码
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 <= 10}, {x, y}]

(*绘制3D图形并标记最大值点*)
Y1 = Plot3D[f[x, y], {x, -10, 10}, {y, -10, 10}, 
   Mesh -> {{{maxPoint[[2, 1, 2]], Blue}}, {{maxPoint[[2, 2, 2]], 
       Black}}}, 
   RegionFunction -> 
    Function[{x, y, z}, x^2 + y^2 <= 10],(*BoxRatios\[Rule]Automatic,
   ColorFunction\[Rule]"Rainbow",*)PlotStyle -> Opacity[4/5], 
   Mesh -> None];
Y2 = ListPointPlot3D[{{maxPoint[[2, 1, 2]], maxPoint[[2, 2, 2]], 
     maxPoint[[1]]}}, PlotStyle -> {{PointSize[Large], Red}}];

Show[Y1, Y2]

结果图如下:

相关推荐
汇能感知7 小时前
光谱相机的探测器阵列
经验分享·笔记·科技
R6bandito_9 小时前
STM32中printf的重定向详解
开发语言·经验分享·stm32·单片机·嵌入式硬件·mcu
Cathy Bryant14 小时前
球极平面投影
经验分享·笔记·数学建模
为java加瓦16 小时前
枚举单例模式:Java单例实现的终极方案解析
经验分享
陈辞202616 小时前
【武大图书馆事件全过程】免费分享
经验分享
Cx330❀1 天前
《Linux基础入门指令》:从零开始理解Linux系统
linux·运维·服务器·经验分享
聪明的笨猪猪1 天前
Java Spring “MVC ”面试清单(含超通俗生活案例与深度理解)
java·经验分享·笔记·面试
会飞的小蛮猪1 天前
ELK运维之路(Elasticsearch7集群组建-7.17.24)
经验分享
我命由我123452 天前
Photoshop - Photoshop 工具栏(10)透视裁剪工具
经验分享·笔记·学习·ui·职场和发展·职场发展·photoshop