\begingroup
设 为圆心(奥)(哦)(O)和两点一个一个A,乙乙B在圆圈之外。找到点碳碳C在(奥)(哦)(O)因此总和碳A + C型乙碳一个+碳乙CA + CB获取最大值和最小值并绘制通过三点的椭圆一个一个A,乙乙B,碳碳C喜欢这张照片。
我试过
Clear["Global`*"]
a = {6, 8};
b = {3, 10};
r = 5;
c = {r Cos[t], r Sin[t]};
mymin = NMinimize[{EuclideanDistance[a, c] + EuclideanDistance[b, c],
0 <= t <= 2 Pi}, t];
mymax = NMaximize[{EuclideanDistance[a, c] + EuclideanDistance[b, c],
0 <= t <= 2 Pi}, t];
cmax = c /. mymax[[2]];
cmin = c /. mymin[[2]];
Graphics[{Circle[{0, 0}, r], PointSize[Large], Blue, Point[a],
Point[b], Point[cmax], Point[cmin]}]
\endgroup
1
最佳答案
2
\begingroup
ContourPlot
。
ellips =
ContourPlot[
EuclideanDistance[{x, y}, a] + EuclideanDistance[{x, y}, b] ==
EuclideanDistance[cmin,a] + EuclideanDistance[cmin,b], {x, -20,
20}, {y, -20, 20}];
Graphics[{Circle[{0, 0}, r], PointSize[Large], Blue, Point[a],
Point[b], Point[cmax], Point[cmin], ellips[[1]]}, PlotRange -> All]
- 当我们设置
a = {-1, 8};b = {5, 6};
\endgroup
|
\begingroup
只是一个变体:
gs[a_, b_, rad_, rg_] := Module[{t, xp, d, r, ell, cp},
xp = Norm[rad {Cos[t], Sin[t]} - a] + Norm[rad {Cos[t], Sin[t]} - b];
{d, r} = Minimize[xp, t];
ell = Norm[{x, y} - a] + Norm[{x, y} - b] == d;
cp = rad {Cos[t], Sin[t]} /. r;
ContourPlot[ell, {x, -rg, rg}, {y, -rg, rg},
Epilog -> {Point[{{0, 0}, a, b, cp}], Text["O", {0, 0}, {-2, 0}],
Text["A", a, {-2, 0}], Text["B", b, {-2, 0}],
Text["C", cp, {-2, -2}], Circle[{0, 0}, rad]}]]
使用其他答案中的测试 a,b:
a = {6, 8};
b = {3, 10};
gs[a, b, 5, 15]
gs[{-1, 8}, {5, 6}, 5, 10]
\endgroup
|
\endgroup
–
|