圆上离散样本点的几何中位数/中心位置随测试点变化的研究

圆上离散样本点的几何中位数/中心位置随测试点变化的研究
几何画板及绘图内容加载中,请稍等……
2020-11-21 19:47
本范例演示了在圆周上给定若干离散样本点后,如何根据一个可移动的测试点位置,动态计算并显示几何中位数(几何中心)在圆上的位置变化。核心数学概念包括几何中位数(使到各样本点距离之和最小的点)、圆的参数方程、向量运算以及最优化问题。作图要点:利用GeoGebra的Circle、Point、Sequence等命令生成圆周上的样本点集,通过Sum、Vector、Length等命令计算距离和,并使用Slider或InputBox控制测试点位置,结合If、Sort、Element等命令筛选最优解,最终以Text或TableText展示结果。该范例适合高中或大学阶段学习解析几何、向量与最优化问题的学生,也可用于数学建模中关于中心位置与鲁棒统计的直观演示。

GeoGebra 命令及参数

  1. Sum(Zip[sqrt(((R * cos(x)) - x(b))^(2) + ((R * sin(x)) - y(b))^(2)), b, lP]) → f0
  2. Circle(O, R) → g
  3. Point(g) → p0
  4. Zip(Vector[UnitVector[a - p0]], a, lP) → l1
  5. Sum(Zip[Length[a - p0], a, lP]) → sum
  6. Sum(Zip[Length[a - p0]^(2), a, lP]) → sum_q
  7. Sum(Zip[Length[a - min_q0]^(2), a, lP]) → sum1_q
  8. Sum(Zip[Length[a - max_q0]^(2), a, lP]) → sum2_q
  9. Segment(max_q0, min_q0) → h
  10. Textfield(na) → InputBox1
  11. Sequence((R; ((2 * π / na) * j)), j, 0, na) → ltest_2
  12. Zip((R; a), a, x(Extr_g)) → lZZsad'
  13. Vector(p0, p0 + UnitVector[Sum[l1]]) → l11
  14. Vector(p0, p0 + UnitVector[p0]) → l12
  15. Angle(l11, l12) → α
  16. Zip(Vector[b, b + UnitVector[Sum[Zip[UnitVector[a - b], a, lP]]]], b, lZmax') → Wi_Pmax
  17. Zip(Vector[b, b + UnitVector[Sum[Zip[UnitVector[a - b], a, lP]]]], b, lZmin') → Wi_Pmin
  18. Zip(Vector[x0, x0 + UnitVector[x0]], x0, lZmax') → Wi_Pmax'
  19. Zip(Vector[x0, x0 + UnitVector[x0]], x0, lZmin') → Wi_Pmin'
  20. Zip(Angle[a, Vector[b]], Vector[a], Wi_Pmax, Vector[b], Wi_Pmax') → Wii_pmax
  21. Zip(Angle[a, Vector[b]], Vector[a], Wi_Pmin, Vector[b], Wi_Pmin') → Wii_pmin
  22. Zip(Segment[p0, a], a, lP) → l0
  23. Zip((a, f1(a)), a, x(lExtr')) → lExtrf'
  24. Length(lExtrf') → lä
  25. Sum(Zip[((R * cos(x)) - x(b))^(2) + ((R * sin(x)) - y(b))^(2), b, lP]) → f0_q
  26. Zip((a, f1(a)), a, Zip[Angle[a], a, lZmin']) → lmin1
  27. Zip((a, f1(a)), a, Zip[Angle[a], a, lZmax']) → lmax1
  28. Zip((a, f1(a)), a, Zip[Angle[a], a, lZZsad']) → lsad
  29. Vector(C, C + (0, 0.5)) → u
  30. Vector(C_q, C_q + (0, 0.5)) → u_q
  31. Textfield(s) → InputBox2
  32. Textfield(s_q) → InputBox3
  33. TableText(Append["k", 1…Length[Wii_pmin]], Append["Δφ_k, grad", Wii_pmin], "v") → text23min
  34. TableText(Append["k", 1…Length[Wii_pmax]], Append["Δφ_k, grad", Wii_pmax], "v") → text23max
  35. Text("f(x)", (-0.1, f1(0) + 0.2)) → text6
  36. Text("f_q(x)", (-0.1, f1_q(0) + 0.2)) → text6b
  37. Element(lmax1, IndexOf[Max[y(lmax1)], y(lmax1)]) → D1
  38. Element(lmin1, IndexOf[Min[y(lmin1)], y(lmin1)]) → D2
  39. Zip(Point[a, 1], Vector[a], Wi_Pmax) → Pmax
  40. Zip(Point[a, 1], Vector[a], Wi_Pmin) → Pmin
  41. Zip(Point[a, 1], Vector[a], Wi_Pmax') → Pmax'
  42. Zip(Point[a, 1], Vector[a], Wi_Pmin') → Pmin'
  43. Point(l11, 1) → Tpoint1
  44. Point(l12, 1) → Tpoint2
  45. Zip(Text["c_" + (a) + "", b], a, 1…Length[lZmin'], b, lZmin' + (0.2, 0.2)) → txtmin
  46. Element(lZmin', IndexOf[Min[y(lmin1)], y(lmin1)]) → AGlobalmin
  47. Element(lZmax', IndexOf[Max[y(lmax1)], y(lmax1)]) → AGlobalmax
  48. RotateText(txt, 90°) → txt1
  49. Sort(Flatten[x(lExtr')]) → xlExtr'
  50. Zip((abs(a - b) / a * 100), a, xlExtr', b, xlMaxmin) → Δ
  51. Zip(ScientificText[a, 3], a, Δ) → Δ1
  52. TableText(Append["k", 1…lä], Append["δ=\frac{x_{Extr}-x_{iter}}{x_{Extr}}*100% ", Δ1], "v") → text23Δ
  53. If(p0 ≟ min_q0 ∨ p0 ≟ max_q0, true, false) → bue1
  54. Zip(Text["c_" + (a) + "", b], a, 1…Length[lZmax'], b, lZmax' + (-0.2, 0.2)) → txtmax
  55. Zip(Text["\vec{c}_ " + (a) + "", b, true, true], a, 1…Length[lZmax'], b, Pmax' + (-0.35, 0.35)) → txtPmax'
  56. Zip(Text["\vec{c}_ " + (a) + "", b, true, true], a, 1…Length[lZmax'], b, Pmin' + (-0.35, 0.35)) → txtPmin'
  57. Zip(Text["\overrightarrow{f}_" + (a) + "", b, true, true], a, 1…Length[lZmax'], b, Pmax + (-0.4, 0.2)) → txtPmax
  58. Zip(Text["\overrightarrow{f}_" + (a) + "", b, true, true], a, 1…Length[lZmax'], b, Pmin + (-0.4, 0.1)) → txtPmin
  59. UnitVector(Vector[p0, p0 - A]) → w
  60. Angle(w, l12) → β
  61. Zip(Vector[x0, x0 + UnitVector[Vector[x0, x0 - (Length[lP] * x0) - Sum[lP]]]], x0, lZ_q) → wq_i
  62. Zip(Vector[x0, x0 + UnitVector[x0]], x0, lZ_q) → wcq_i
  63. If(b, "sum of distances", "sum of the squares of distances") → txtsum
  64. Point(w, 1) → Tpoint2_q
  65. If(a, "\fgcolor{#007FFF}{f(x)}", "\fgcolor{magenta}{f_q(x)}") → text22a

AI 绘图提示语参考

在圆上放置若干固定样本点,并设一个可动测试点沿圆周移动。绘制从测试点到各样本点的连线,并计算这些线段长度的总和,该总和随测试点位置变化。在圆周上标出使总距离最小和最大的两个特殊点,并用线段连接它们。同时,在测试点处画出指向样本点方向单位向量之和的箭头,以及指向圆心方向的箭头,并显示两箭头间的夹角。此外,在圆外绘制一条表示总距离随角度变化的曲线,并标出曲线上的全局最值点。
以上提示语为根据原始绘图命令整理而来,仅供参考。