| 
注册时间2021-11-19最后登录1970-1-1威望 星金币 枚贡献 分经验 点鲜花 朵魅力 点上传 次下载 次积分9916在线时间 小时 
 | 
 
 发表于 2023-8-4 09:34:09
|
显示全部楼层 
| 本帖最后由 nyy 于 2023-8-4 09:40 编辑 
 复制代码Clear["Global`*"];(*清除所有变量*)
f=(2*x*y+3)/(x*y^2)+(y^2+x*y)/(x+3*y)
fx=D[f,x]
fy=D[f,y]
ans=Solve[{fx,fy}==0,{x,y},Reals]
aaa=Append[#,FullSimplify[f/.#]]&/@ans
(f/.ans)//FullSimplify(*目标函数值*)
Grid[N@aaa,Alignment->Left](*列表显示*)
可能的四个极值
 \[\left\{\frac{1}{9} (-4) \sqrt{20 \sqrt{\frac{2}{3}}-2 \sqrt{6 \sqrt{6}+\frac{38}{3}}+18},\frac{4}{9} \sqrt{20 \sqrt{\frac{2}{3}}-2 \sqrt{6 \sqrt{6}+\frac{38}{3}}+18},\frac{4}{9} \sqrt{\frac{2}{3} \left(10 \sqrt{6}+\sqrt{6 \left(9 \sqrt{6}+19\right)}+27\right)},\frac{1}{9} (-4) \sqrt{\frac{2}{3} \left(10 \sqrt{6}+\sqrt{6 \left(9 \sqrt{6}+19\right)}+27\right)}\right\}\]
 
 矩阵数值,第一列x,第二列y,第三列函数值
 \[\begin{array}{lll}
 x\to -1.32415 & y\to -3.1621 & -2.17132 \\
 x\to 1.32415 & y\to 3.1621 & 2.17132 \\
 x\to -10.7376 & y\to 0.948736 & 2.97452 \\
 x\to 10.7376 & y\to -0.948736 & -2.97452 \\
 \end{array}\]
 
 代码再改进改进
 
 复制代码Clear["Global`*"];(*清除所有变量*)
f=(2*x*y+3)/(x*y^2)+(y^2+x*y)/(x+3*y)
fx=D[f,x]
fy=D[f,y]
ans=Solve[{fx,fy}==0,{x,y},Reals]//FullSimplify
aaa=Append[#,FullSimplify[f/.#]]&/@ans
Grid[aaa,Alignment->Left](*列表显示*)
Grid[N@aaa,Alignment->Left](*列表显示*)
 第一列x,第二列y,第三列函数值
 \[\begin{array}{lll}
 x\to -\sqrt{\frac{3}{5} \left(19 \sqrt{6}-\sqrt{30 \left(61 \sqrt{6}+149\right)}+51\right)} & y\to -\sqrt{\sqrt{6}+\sqrt{6 \left(\sqrt{6}+1\right)}+3} & \frac{1}{9} (-4) \sqrt{20 \sqrt{\frac{2}{3}}-2 \sqrt{6 \sqrt{6}+\frac{38}{3}}+18} \\
 x\to \sqrt{\frac{3}{5} \left(19 \sqrt{6}-\sqrt{30 \left(61 \sqrt{6}+149\right)}+51\right)} & y\to \sqrt{\sqrt{6}+\sqrt{6 \left(\sqrt{6}+1\right)}+3} & \frac{4}{27} \sqrt{60 \sqrt{6}-6 \sqrt{6 \left(9 \sqrt{6}+19\right)}+162} \\
 x\to -\sqrt{\frac{3}{5} \left(19 \sqrt{6}+\sqrt{30 \left(61 \sqrt{6}+149\right)}+51\right)} & y\to \sqrt{\sqrt{6}-\sqrt{6 \left(\sqrt{6}+1\right)}+3} & \frac{4}{9} \sqrt{\frac{2}{3} \left(10 \sqrt{6}+\sqrt{6 \left(9 \sqrt{6}+19\right)}+27\right)} \\
 x\to \sqrt{\frac{3}{5} \left(19 \sqrt{6}+\sqrt{30 \left(61 \sqrt{6}+149\right)}+51\right)} & y\to -\sqrt{\sqrt{6}-\sqrt{6 \left(\sqrt{6}+1\right)}+3} & \frac{1}{9} (-4) \sqrt{\frac{2}{3} \left(10 \sqrt{6}+\sqrt{6 \left(9 \sqrt{6}+19\right)}+27\right)} \\
 \end{array}\]
 
 数值值
 \[\begin{array}{lll}
 x\to -1.3241533520525920905 & y\to -3.1621003372960161574 & -2.1713230852996915144 \\
 x\to 1.3241533520525920905 & y\to 3.1621003372960161574 & 2.1713230852996915144 \\
 x\to -10.737550187808406456 & y\to 0.94873649789537297262 & 2.9745248662862202539 \\
 x\to 10.737550187808406456 & y\to -0.94873649789537297262 & -2.9745248662862202539 \\
 \end{array}\]
 
 
 | 
 |