chyanog 发表于 2020-6-3 13:38:22

本帖最后由 chyanog 于 2020-6-3 13:50 编辑

解析解也可以用Mathematica算出来
f = Sqrt+Sqrt[(x-4)^2+y^2]+Sqrt[(x-xe)^2+(y-ye)^2];
cons = 20-6 xe+xe^2-8 ye+ye^2;
grad = D
sol = Solve==0,{x,y,xe,ye,k}]//FullSimplify
f/.sol//FullSimplify
N[%,16]
最小值为
\(\sqrt{34+16 \sqrt{3}-2 \sqrt{5 \left(29+16 \sqrt{3}\right)}}=\sqrt{16 \sqrt{3}+29}-\sqrt{5}\approx 5.2947230115731401311\)

\(\left\{x\to \frac{2}{219} \left(80 \sqrt{3}+147\right),y\to \frac{1}{219} \left(384-86 \sqrt{3}\right),\text{xe}\to 3-\sqrt{\frac{5}{73} \left(29-16 \sqrt{3}\right)},\text{ye}\to 4-2 \sqrt{\frac{5}{73} \left(4 \sqrt{3}+11\right)},k\to \frac{1}{2 \sqrt{5}}\right\}\)

mathematica 发表于 2020-6-3 13:49:11

chyanog 发表于 2020-6-3 13:38
解析解也可以用Mathematica算出来

最小值为


sol=Solve==0,{x,y,xe,ye,k}]//FullSimplify
为什么用这个能求解出来?
而用
sol=Solve//FullSimplify
求解不出来?
还有,为什么你求解出来的结果,为什么是两个?
另一个结果是什么意思?

chyanog 发表于 2020-6-3 13:54:10

本帖最后由 chyanog 于 2020-6-3 14:04 编辑

mathematica 发表于 2020-6-3 13:49
sol=Solve==0,{x,y,xe,ye,k}]//FullSimplify
为什么用这个能求解出来?
而用


4# lsr314的图中,直线DK与圆有两个交点,求解出来的恰好包括这两个交点

mathematica 发表于 2020-6-3 14:14:17

chyanog 发表于 2020-6-3 13:54
4# lsr314的图中,直线DK与圆有两个交点,求解出来的恰好包括这两个交点

sol=Solve==0,{x,y,xe,ye,k}]//FullSimplify
为什么用这个能求解出来?
而用
sol=Solve//FullSimplify
求解不出来?
这个问题呢?
GroebnerBasis这个函数特殊在什么地方?

mathematica 发表于 2020-6-3 14:18:50

本帖最后由 mathematica 于 2020-6-3 14:27 编辑

chyanog 发表于 2020-6-3 13:54
4# lsr314的图中,直线DK与圆有两个交点,求解出来的恰好包括这两个交点

(*利用拉格朗日乘子法解决问题*)
Clear["Global`*"];(*Clear all variables*)
(*初始变量赋值*)
{xa,ya}={1,3}
{xb,yb}={0,0}
{xc,yc}={4,0}
{xd,yd}={4,2}
(*利用斜率,得到135°这个约数条件,得到第一个约数条件*)
k1=(yd-ye)/(xd-xe)
k2=(ya-ye)/(xa-xe)
(*只有分子是有用的*)
cons=(k2-k1)/(1+k1*k2)+1//Together//Numerator
(*目标函数*)
f=MB+MC+ME+x1*((x-xb)^2+(y-yb)^2-MB^2)+x2*((x-xc)^2+(y-yc)^2-MC^2)+x3*((x-xe)^2+(y-ye)^2-ME^2)+x4*cons
(*对所有的目标函数求导数,然后解方程组,只选出那些距离非负数的解,并且化简*)
ans=Solve=={0,0,0,0,0,0,0,0,0,0,0},{xe,ye,x,y,MB,MC,ME,x1,x2,x3,x4}]//FullSimplify
ans//Grid
(*数值化求解结果*)
ansN=N//Grid
aaa=f/.ans//FullSimplify
N


求解结果:
\[\begin{array}{ccccccccccc}
\text{xe}\to \sqrt{\frac{5}{73} \left(16 \sqrt{3}+29\right)}+3 & \text{ye}\to 2 \left(\sqrt{\frac{5}{73} \left(11-4 \sqrt{3}\right)}+2\right) & x\to \frac{2}{219} \left(147-80 \sqrt{3}\right) & y\to \frac{2}{219} \left(43 \sqrt{3}+192\right) & \text{MB}\to -4 \sqrt{\frac{1}{219} \left(95-8 \sqrt{3}\right)} & \text{MC}\to 4 \sqrt{\frac{1}{219} \left(72 \sqrt{3}+167\right)} & \text{ME}\to -\sqrt{\frac{2}{219} \left(72 \sqrt{3}+\sqrt{1095 \left(144 \sqrt{3}+2159\right)}+1627\right)} & \text{x1}\to -\frac{1}{88} \sqrt{3 \left(8 \sqrt{3}+95\right)} & \text{x2}\to \frac{1}{104} \sqrt{501-216 \sqrt{3}} & \text{x3}\to -\frac{\sqrt{\frac{3}{2} \left(-88308 \sqrt{3}-\sqrt{169134722625-66936841560 \sqrt{3}}+401743\right)}}{1832} & \text{x4}\to \frac{1}{2 \sqrt{5}} \\
\text{xe}\to \sqrt{\frac{5}{73} \left(16 \sqrt{3}+29\right)}+3 & \text{ye}\to 2 \left(\sqrt{\frac{5}{73} \left(11-4 \sqrt{3}\right)}+2\right) & x\to \frac{2}{219} \left(147-80 \sqrt{3}\right) & y\to \frac{2}{219} \left(43 \sqrt{3}+192\right) & \text{MB}\to 4 \sqrt{\frac{1}{219} \left(95-8 \sqrt{3}\right)} & \text{MC}\to -4 \sqrt{\frac{1}{219} \left(72 \sqrt{3}+167\right)} & \text{ME}\to \sqrt{\frac{2}{219} \left(72 \sqrt{3}+\sqrt{1095 \left(144 \sqrt{3}+2159\right)}+1627\right)} & \text{x1}\to \frac{1}{88} \sqrt{3 \left(8 \sqrt{3}+95\right)} & \text{x2}\to -\frac{1}{104} \sqrt{501-216 \sqrt{3}} & \text{x3}\to \frac{\sqrt{\frac{3}{2} \left(-88308 \sqrt{3}-\sqrt{169134722625-66936841560 \sqrt{3}}+401743\right)}}{1832} & \text{x4}\to -\frac{1}{2 \sqrt{5}} \\
\text{xe}\to \text{Root}\left+3 & \text{ye}\to 4-2 \sqrt{\frac{5}{73} \left(11-4 \sqrt{3}\right)} & x\to \frac{2}{219} \left(147-80 \sqrt{3}\right) & y\to \frac{2}{219} \left(43 \sqrt{3}+192\right) & \text{MB}\to -4 \sqrt{\frac{1}{219} \left(95-8 \sqrt{3}\right)} & \text{MC}\to 4 \sqrt{\frac{1}{219} \left(72 \sqrt{3}+167\right)} & \text{ME}\to -\sqrt{\frac{2}{219} \left(72 \sqrt{3}-\sqrt{1095 \left(144 \sqrt{3}+2159\right)}+1627\right)} & \text{x1}\to -\frac{1}{88} \sqrt{3 \left(8 \sqrt{3}+95\right)} & \text{x2}\to \frac{1}{104} \sqrt{501-216 \sqrt{3}} & \text{x3}\to -\frac{\sqrt{\frac{3}{2} \left(-88308 \sqrt{3}+\sqrt{169134722625-66936841560 \sqrt{3}}+401743\right)}}{1832} & \text{x4}\to -\frac{1}{2 \sqrt{5}} \\
\text{xe}\to \text{Root}\left+3 & \text{ye}\to 4-2 \sqrt{\frac{5}{73} \left(11-4 \sqrt{3}\right)} & x\to \frac{2}{219} \left(147-80 \sqrt{3}\right) & y\to \frac{2}{219} \left(43 \sqrt{3}+192\right) & \text{MB}\to 4 \sqrt{\frac{1}{219} \left(95-8 \sqrt{3}\right)} & \text{MC}\to -4 \sqrt{\frac{1}{219} \left(72 \sqrt{3}+167\right)} & \text{ME}\to \sqrt{\frac{2}{219} \left(72 \sqrt{3}-\sqrt{1095 \left(144 \sqrt{3}+2159\right)}+1627\right)} & \text{x1}\to \frac{1}{88} \sqrt{3 \left(8 \sqrt{3}+95\right)} & \text{x2}\to -\frac{1}{104} \sqrt{501-216 \sqrt{3}} & \text{x3}\to \frac{\sqrt{\frac{3}{2} \left(-88308 \sqrt{3}+\sqrt{169134722625-66936841560 \sqrt{3}}+401743\right)}}{1832} & \text{x4}\to \frac{1}{2 \sqrt{5}} \\
\text{xe}\to \sqrt{\frac{5}{73} \left(29-16 \sqrt{3}\right)}+3 & \text{ye}\to 2 \left(\sqrt{\frac{5}{73} \left(4 \sqrt{3}+11\right)}+2\right) & x\to \frac{2}{219} \left(80 \sqrt{3}+147\right) & y\to \frac{1}{219} \left(384-86 \sqrt{3}\right) & \text{MB}\to -4 \sqrt{\frac{1}{219} \left(8 \sqrt{3}+95\right)} & \text{MC}\to -4 \sqrt{\frac{1}{219} \left(167-72 \sqrt{3}\right)} & \text{ME}\to -\sqrt{\frac{2}{219} \left(-72 \sqrt{3}+\sqrt{1095 \left(2159-144 \sqrt{3}\right)}+1627\right)} & \text{x1}\to -\frac{1}{88} \sqrt{3 \left(95-8 \sqrt{3}\right)} & \text{x2}\to -\frac{1}{104} \sqrt{216 \sqrt{3}+501} & \text{x3}\to -\frac{\sqrt{\frac{3}{2} \left(88308 \sqrt{3}-\sqrt{66936841560 \sqrt{3}+169134722625}+401743\right)}}{1832} & \text{x4}\to \frac{1}{2 \sqrt{5}} \\
\text{xe}\to \sqrt{\frac{5}{73} \left(29-16 \sqrt{3}\right)}+3 & \text{ye}\to 2 \left(\sqrt{\frac{5}{73} \left(4 \sqrt{3}+11\right)}+2\right) & x\to \frac{2}{219} \left(80 \sqrt{3}+147\right) & y\to \frac{1}{219} \left(384-86 \sqrt{3}\right) & \text{MB}\to 4 \sqrt{\frac{1}{219} \left(8 \sqrt{3}+95\right)} & \text{MC}\to 4 \sqrt{\frac{1}{219} \left(167-72 \sqrt{3}\right)} & \text{ME}\to \sqrt{\frac{2}{219} \left(-72 \sqrt{3}+\sqrt{1095 \left(2159-144 \sqrt{3}\right)}+1627\right)} & \text{x1}\to \frac{1}{88} \sqrt{3 \left(95-8 \sqrt{3}\right)} & \text{x2}\to \frac{1}{104} \sqrt{216 \sqrt{3}+501} & \text{x3}\to \frac{\sqrt{\frac{3}{2} \left(88308 \sqrt{3}-\sqrt{66936841560 \sqrt{3}+169134722625}+401743\right)}}{1832} & \text{x4}\to -\frac{1}{2 \sqrt{5}} \\
\text{xe}\to \text{Root}\left+3 & \text{ye}\to 4-2 \sqrt{\frac{5}{73} \left(4 \sqrt{3}+11\right)} & x\to \frac{2}{219} \left(80 \sqrt{3}+147\right) & y\to \frac{1}{219} \left(384-86 \sqrt{3}\right) & \text{MB}\to -4 \sqrt{\frac{1}{219} \left(8 \sqrt{3}+95\right)} & \text{MC}\to -4 \sqrt{\frac{1}{219} \left(167-72 \sqrt{3}\right)} & \text{ME}\to -\sqrt{\frac{2}{219} \left(-72 \sqrt{3}-\sqrt{1095 \left(2159-144 \sqrt{3}\right)}+1627\right)} & \text{x1}\to -\frac{1}{88} \sqrt{3 \left(95-8 \sqrt{3}\right)} & \text{x2}\to -\frac{1}{104} \sqrt{216 \sqrt{3}+501} & \text{x3}\to -\frac{\sqrt{\frac{3}{2} \left(88308 \sqrt{3}+\sqrt{66936841560 \sqrt{3}+169134722625}+401743\right)}}{1832} & \text{x4}\to -\frac{1}{2 \sqrt{5}} \\
\text{xe}\to \text{Root}\left+3 & \text{ye}\to 4-2 \sqrt{\frac{5}{73} \left(4 \sqrt{3}+11\right)} & x\to \frac{2}{219} \left(80 \sqrt{3}+147\right) & y\to \frac{1}{219} \left(384-86 \sqrt{3}\right) & \text{MB}\to 4 \sqrt{\frac{1}{219} \left(8 \sqrt{3}+95\right)} & \text{MC}\to 4 \sqrt{\frac{1}{219} \left(167-72 \sqrt{3}\right)} & \text{ME}\to \sqrt{\frac{2}{219} \left(-72 \sqrt{3}-\sqrt{1095 \left(2159-144 \sqrt{3}\right)}+1627\right)} & \text{x1}\to \frac{1}{88} \sqrt{3 \left(95-8 \sqrt{3}\right)} & \text{x2}\to \frac{1}{104} \sqrt{216 \sqrt{3}+501} & \text{x3}\to \frac{\sqrt{\frac{3}{2} \left(88308 \sqrt{3}+\sqrt{66936841560 \sqrt{3}+169134722625}+401743\right)}}{1832} & \text{x4}\to \frac{1}{2 \sqrt{5}} \\
\end{array}
\]
数值化的结果
xe->4.970898080        ye->5.056201098        x->0.07704050589        y->2.433590728        MB->-2.434809863        MC->4.616489470        ME->-5.552290258        x1->-0.2053548441        x2->0.1083074062        x3->-0.09005292894        x4->0.2236067977
xe->4.970898080        ye->5.056201098        x->0.07704050589        y->2.433590728        MB->2.434809863        MC->-4.616489470        ME->5.552290258        x1->0.2053548441        x2->-0.1083074062        x3->0.09005292894        x4->-0.2236067977
xe->1.029101920        ye->2.943798902        x->0.07704050589        y->2.433590728        MB->-2.434809863        MC->4.616489470        ME->-1.080154303        x1->-0.2053548441        x2->0.1083074062        x3->-0.4628968276        x4->-0.2236067977
xe->1.029101920        ye->2.943798902        x->0.07704050589        y->2.433590728        MB->2.434809863        MC->-4.616489470        ME->1.080154303        x1->0.2053548441        x2->-0.1083074062        x3->0.4628968276        x4->0.2236067977
xe->3.296923388        ye->6.216266343        x->2.607891001        y->1.073258587        MB->-2.820102741        MC->-1.757797332        ME->-5.188958894        x1->-0.1772985051        x2->-0.2844468989        x3->-0.09635844303        x4->0.2236067977
xe->3.296923388        ye->6.216266343        x->2.607891001        y->1.073258587        MB->2.820102741        MC->1.757797332        ME->5.188958894        x1->0.1772985051        x2->0.2844468989        x3->0.09635844303        x4->-0.2236067977
xe->2.703076612        ye->1.783733657        x->2.607891001        y->1.073258587        MB->-2.820102741        MC->-1.757797332        ME->-0.7168229392        x1->-0.1772985051        x2->-0.2844468989        x3->-0.6975223206        x4->-0.2236067977
xe->2.703076612        ye->1.783733657        x->2.607891001        y->1.073258587        MB->2.820102741        MC->1.757797332        ME->0.7168229392        x1->0.1772985051        x2->0.2844468989        x3->0.6975223206        x4->0.2236067977




极值情况
\[\left\{-\sqrt{2 \left(-8 \sqrt{3}+\sqrt{145-80 \sqrt{3}}+17\right)},\sqrt{2 \left(-8 \sqrt{3}+\sqrt{145-80 \sqrt{3}}+17\right)},\sqrt{-16 \sqrt{3}-2 \sqrt{145-80 \sqrt{3}}+34},-\sqrt{-16 \sqrt{3}-2 \sqrt{145-80 \sqrt{3}}+34},-\sqrt{2 \left(8 \sqrt{3}+\sqrt{80 \sqrt{3}+145}+17\right)},\sqrt{2 \left(8 \sqrt{3}+\sqrt{80 \sqrt{3}+145}+17\right)},-\sqrt{16 \sqrt{3}-2 \sqrt{80 \sqrt{3}+145}+34},\sqrt{16 \sqrt{3}-2 \sqrt{80 \sqrt{3}+145}+34}\right\}\]
数值化后
{-3.3706106513988208313,3.3706106513988208313,1.1015253036007585615,-1.1015253036007585615,-9.7668589665727195239,9.7668589665727195239,-5.2947230115731401311,5.2947230115731401311}

由于MB MC ME距离都是非负数,所以只有
第六与第八个结果有意义,
没想到mathematica也能把这方程组求解出来!

mathematica 发表于 2020-6-3 14:49:16

本帖最后由 mathematica 于 2020-6-3 15:09 编辑

chyanog 发表于 2020-6-3 13:38
解析解也可以用Mathematica算出来

最小值为


帮你把你的代码完整化
(*利用拉格朗日乘子法解决问题*)
Clear["Global`*"];(*Clear all variables*)
(*初始变量赋值*)
{xa,ya}={1,3}
{xb,yb}={0,0}
{xc,yc}={4,0}
{xd,yd}={4,2}
(*利用斜率,得到135°这个约数条件,得到第一个约数条件*)
k1=(yd-ye)/(xd-xe)
k2=(ya-ye)/(xa-xe)
(*只有分子是有用的,形成约束条件*)
cons=(k2-k1)/(1+k1*k2)+1//Together//Numerator
(*目标函数*)
f=Sqrt+Sqrt[(x-4)^2+y^2]+Sqrt[(x-xe)^2+(y-ye)^2];
(*加上约束条件,求解偏导数*)
grad=D
(*利用GroebnerBasis求解方程组,这样求解快,具体快的原因不知道*)
ans=Solve==0,{x,y,xe,ye,k}]//FullSimplify
ans//ToRadicals//Grid
(*数值化*)
N
aaa=f/.ans//FullSimplify
(*数值化*)
N

方程组求解结果
\[
\begin{array}{ccccc}
x\to \frac{2}{219} \left(80 \sqrt{3}+147\right) & y\to \frac{1}{219} \left(384-86 \sqrt{3}\right) & \text{xe}\to 3-\sqrt{\frac{5}{73} \left(29-16 \sqrt{3}\right)} & \text{ye}\to 4-2 \sqrt{\frac{5}{73} \left(4 \sqrt{3}+11\right)} & k\to \frac{1}{2 \sqrt{5}} \\
x\to \frac{2}{219} \left(80 \sqrt{3}+147\right) & y\to \frac{1}{219} \left(384-86 \sqrt{3}\right) & \text{xe}\to \sqrt{\frac{5}{73} \left(29-16 \sqrt{3}\right)}+3 & \text{ye}\to 2 \left(\sqrt{\frac{5}{73} \left(4 \sqrt{3}+11\right)}+2\right) & k\to -\frac{1}{2 \sqrt{5}} \\
\end{array}
\]

数值化
x->2.6078910009635633195        y->1.0732585869820847158        xe->2.7030766116408897290        ye->1.7837336573765902675        k->0.22360679774997896964
x->2.6078910009635633195        y->1.0732585869820847158        xe->3.2969233883591102710        ye->6.2162663426234097325        k->-0.22360679774997896964



目标函数值
\[\left\{\sqrt{16 \sqrt{3}-2 \sqrt{80 \sqrt{3}+145}+34},\sqrt{2 \left(8 \sqrt{3}+\sqrt{80 \sqrt{3}+145}+17\right)}\right\}\]
数值化
{5.2947230115731401311,9.7668589665727195239}

lsr314 发表于 2020-6-3 15:16:18

lsr314 发表于 2020-6-2 14:23
这道题和https://bbs.emath.ac.cn/thread-17297-1-1.html完全一样,就是求一点使之到两点和一圆的圆心距离 ...

H同时也是三角形GFD的费马点

王守恩 发表于 2020-6-3 15:24:56

可以有吗?详见 1 #

\(BC=2\ \ \ \ \ \ CD=4\ \ \ \ AB=\sqrt{10}\)

\(\tan∠ABC=3\ \ \ ∠BCD=90^\circ\ \ \ ∠AED=135^\circ\)

M 为任意一点,MB+MC+ME 的最小值为?

lsr314 发表于 2020-6-3 15:49:10

三角形三个角都小于120°的情况下,费马点到三个顶点的距离之和为$L=sqrt((a^2+b^2+c^2)/2+2sqrt(3)S)$.
本题$a=4,b=sqrt(17),c=5,S=4*4/2=8$,代入即可。

lsr314 发表于 2020-6-3 16:03:52

王守恩 发表于 2020-6-3 15:24
可以有吗?详见 1 #

\(BC=2\ \ \ \ \ \ CD=4\ \ \ \ AB=\sqrt{10}\)


公式参考我上一个回复,结果为$sqrt(19+8sqrt(3))-1$
页: 1 [2] 3
查看完整版本: 又遇上了mathematica的bug