平均数、中位数与众数的几何作图示例

平均数、中位数与众数的几何作图示例
几何画板及绘图内容加载中,请稍等……
2018-11-29 02:02
本范例通过GeoGebra演示平均数、中位数和众数的计算方法。核心数学概念包括统计学中的集中趋势度量、几何图形与数据分布的关系。作图要点包括使用Textfield、Remove、Flatten、Sequence、If、DotPlot、Zip、Line、Sort、UnicodeToText、BoxPlot等命令,以及ds1、ds2、plot1、plot2等对象。适合初中生学习统计基础,或高中生进行数据分析实践。

GeoGebra 命令及参数

  1. Textfield(ds1Text) → InputBox1
  2. Remove(TextToUnicode[ds1Text], Sequence[32, i, 1, Length[TextToUnicode[ds1Text]]]) → unicode1
  3. Flatten(Join[{{{0}, Remove[Sequence[If[Element[unicode1, i] ≟ 44, i, 0], i, 1, Length[unicode1]], Sequence[0, i, 1, Length[unicode1]]]}, {Length[unicode1] + 1}}]) → locationOfCommas1
  4. Sequence(Take[unicode1, Element[locationOfCommas1, i] + 1, Element[locationOfCommas1, i + 1] - 1], i, 1, Length[locationOfCommas1] - 1) → removedCommas1
  5. Sequence(UnicodeToText[Element[removedCommas1, i]], i, 1, Length[removedCommas1]) → backToNumbers1
  6. If(Length[ds1Text] > 0, RemoveUndefined[Sort[Zip[FromBase[A, 10], A, backToNumbers1]]], {}) → ds1
  7. Textfield(ds2Text) → InputBox2
  8. Remove(TextToUnicode[ds2Text], Sequence[32, i, 1, Length[TextToUnicode[ds2Text]]]) → unicode2
  9. Flatten(Join[{{{0}, Remove[Sequence[If[Element[unicode2, i] ≟ 44, i, 0], i, 1, Length[unicode2]], Sequence[0, i, 1, Length[unicode2]]]}, {Length[unicode2] + 1}}]) → locationOfCommas2
  10. Sequence(Take[unicode2, Element[locationOfCommas2, i] + 1, Element[locationOfCommas2, i + 1] - 1], i, 1, Length[locationOfCommas2] - 1) → removedCommas2
  11. Sequence(UnicodeToText[Element[removedCommas2, i]], i, 1, Length[removedCommas2]) → backToNumbers2
  12. If(Length[ds2Text] > 0, RemoveUndefined[Sort[Zip[FromBase[A, 10], A, backToNumbers2]]], {}) → ds2
  13. DotPlot(ds1) → plot1
  14. DotPlot(ds2) → plot2
  15. If(Defined[Min[Join[{ds1, ds2}]]], Min[Join[{ds1, ds2}]], 0) → min
  16. If(Defined[Max[Join[{ds1, ds2}]]], Max[Join[{ds1, ds2}]], 10) → max
  17. If(Defined[Max[{Max[Frequency[ds1]], Max[Frequency[ds2]], 3}]], Max[{Max[Frequency[ds1]], Max[Frequency[ds2]], 3}], 3) → height
  18. Zip(Line[(A, 0), x = 0], A, Mode[ds1]) → mode1
  19. Zip(Line[(A, 0), x = 0], A, Mode[ds2]) → mode2
  20. Line((mean[ds1], 0), x = 0) → mean1
  21. Line((mean[ds2], 0), x = 0) → mean2
  22. Line((Median[ds1], 0), x = 0) → med1
  23. Line((Median[ds2], 0), x = 0) → med2
  24. Sort(Sequence[Random[0, 30], i, 1, Random[8, 16]]) → random1
  25. Sort(Sequence[Random[0, 30], i, 1, Random[10, 20]]) → random2
  26. Flatten(Sequence[TextToUnicode[Text[Element[random1, i] + ","]], i, 1, Length[random1]]) → random1asText
  27. UnicodeToText(First[random1asText, Length[random1asText] - 1]) → ds1Random
  28. BoxPlot(height / 2, height / 5, ds1) → boxPlot1
  29. BoxPlot(height / 2, height / 5, ds2) → boxPlot2
  30. Flatten(Sequence[TextToUnicode[Text[Element[random2, i] + ","]], i, 1, Length[random2]]) → random2asText
  31. UnicodeToText(First[random2asText, Length[random2asText] - 1]) → ds2Random