- 注册时间
- 2021-11-19
- 最后登录
- 1970-1-1
- 威望
- 星
- 金币
- 枚
- 贡献
- 分
- 经验
- 点
- 鲜花
- 朵
- 魅力
- 点
- 上传
- 次
- 下载
- 次
- 积分
- 9611
- 在线时间
- 小时
|
楼主 |
发表于 2025-5-22 09:29:06
|
显示全部楼层
利用四面体体积=0为约束条件,然后拉格朗日乘子法解决问题,
奇怪的是增根怎么出现的?
- Clear["Global`*"];(*mathematica11.2,win7(64bit)Clear all variables*)
- (*子函数,四面体体积公式,a,b,c分别是从一个顶点出发的三条棱,x,y,z分别是对棱*)
- fun[a_,b_,c_,x_,y_,z_]:=Sqrt[Det[{{0,1,1,1,1},{1,0,a^2,b^2,c^2},{1,a^2,0,z^2,y^2},{1,b^2,z^2,0,x^2},{1,c^2,y^2,x^2,0}}]/288]
- (*线段长度变量赋值,AB与BA都赋值,这样使用线段长度变量时,就不用考虑线段长度变量名的两个端点哪个在前、哪个在后了*)
- AB=BA=BC=CB=CD=DC=DA=AD=a (*正方形边长=a*)
- AC=CA=BD=DB=Sqrt[2]*a
- PA=2;PB=4;(*已知条件*)
- (*约束条件*)
- cond1=fun[PA,PB,PD,BD,AD,AB]^2(*四面体PABD体积=0*)
- cond2=fun[PA,PB,PC,BC,AC,AB]^2(*四面体PABC体积=0*)
- (*拉格朗日乘子法建立目标函数*)
- f=PD/PC+t1*cond1+t2*cond2
- ans=Solve[D[f,{{PC,PD,a,t1,t2}}]==0
- &&PC>=0&&PD>=0&&a>=0 (*限制变量范围*)
- ,{PC,PD,a,t1,t2}]//FullSimplify//ToRadicals (*努力化简并转化成根式表达*)
- Grid[ans,Alignment->Left](*列表显示*)
- Grid[N@ans,Alignment->Left](*列表显示*)
- aaa=(f/.ans)//FullSimplify//ToRadicals (*求出目标函数值*)
- bbb=N@aaa
复制代码
目标函数
\[f=\frac{1}{288} \text{t2} \left(-4 a^6+4 a^4 \text{PC}^2+16 a^4-2 a^2 \text{PC}^4+64 a^2 \text{PC}^2-800 a^2\right)+\frac{1}{288} \text{t1} \left(-4 a^6+4 a^4 \text{PD}^2+64 a^4-2 a^2 \text{PD}^4+16 a^2 \text{PD}^2-320 a^2\right)+\frac{\text{PD}}{\text{PC}}\]
求偏导数解方程组,限定线段长度非负数,得到
\[\begin{array}{lllll}
\text{PC}\to 4 \sqrt{2}-2 & \text{PD}\to 4-2 \sqrt{2} & a\to 2 \sqrt{5-2 \sqrt{2}} & \text{t1}\to -\frac{9 \left(25 \sqrt{2}+37\right)}{7616} & \text{t2}\to \frac{9 \left(53 \sqrt{2}+107\right)}{186592} \\
\text{PC}\to 4 \sqrt{2}+2 & \text{PD}\to 2 \left(\sqrt{2}+2\right) & a\to 2 \sqrt{2 \sqrt{2}+5} & \text{t1}\to -\frac{9 \left(25 \sqrt{2}-37\right)}{7616} & \text{t2}\to \frac{9 \left(53 \sqrt{2}-107\right)}{186592} \\
\text{PC}\to 2 \sqrt{\frac{1}{39} \left(255-8 \sqrt{170}\right)} & \text{PD}\to 2 \sqrt{\frac{2}{39} \left(6 \sqrt{170}+85\right)} & a\to \sqrt{\frac{8 \sqrt{170}}{39}+\frac{460}{39}} & \text{t1}\to \frac{243 \sqrt{\frac{1}{17} \left(32239047-2356774 \sqrt{170}\right)}}{9943360} & \text{t2}\to \frac{243 \sqrt{\frac{1}{17} \left(161122510 \sqrt{170}+2154446583\right)}}{243612320} \\
\text{PC}\to 2 \sqrt{\frac{1}{39} \left(8 \sqrt{170}+255\right)} & \text{PD}\to 2 \sqrt{\frac{2}{39} \left(85-6 \sqrt{170}\right)} & a\to 2 \sqrt{\frac{1}{39} \left(115-2 \sqrt{170}\right)} & \text{t1}\to -\frac{243 \sqrt{\frac{1}{17} \left(2356774 \sqrt{170}+32239047\right)}}{9943360} & \text{t2}\to -\frac{243 \sqrt{\frac{1}{17} \left(2154446583-161122510 \sqrt{170}\right)}}{243612320} \\
\end{array}\]
数值化得到
\[\begin{array}{lllll}
\text{PC}\to 3.65685 & \text{PD}\to 1.17157 & a\to 2.94725 & \text{t1}\to -0.0855039 & \text{t2}\to 0.00877626 \\
\text{PC}\to 7.65685 & \text{PD}\to 6.82843 & a\to 5.59587 & \text{t1}\to 0.00194353 & \text{t2}\to -0.00154573 \\
\text{PC}\to 3.93137 & \text{PD}\to 5.78646 & a\to 3.80387 & \text{t1}\to 0.00728459 & \text{t2}\to 0.0157813 \\
\text{PC}\to 6.07059 & \text{PD}\to 1.1784 & a\to 3.01999 & \text{t1}\to -0.0470335 & \text{t2}\to -0.00177228 \\
\end{array}\]
目标函数值
\[\left\{\frac{1}{7} \left(3 \sqrt{2}-2\right),\frac{1}{7} \left(3 \sqrt{2}+2\right),\frac{1}{7} \left(2 \sqrt{5}+\sqrt{34}\right),\frac{1}{7} \left(\sqrt{34}-2 \sqrt{5}\right)\right\}\]
数值化
\[\{0.320377,0.891806,1.47187,0.194117\}\]
问题来了,第三行第四行的解居然比最小值还小,比最大值还大。怎么来的? |
|