集中趋势的量度:平均数、中位数与众数
2015-11-24 12:19
本 GeoGebra 范例生动演示了统计学中集中趋势的量度。通过 Mean、Median 和 Mode 等命令,模型自动计算并展示数据集的平均数、中位数与众数。用户可通过交互按钮生成或打乱数据序列,直观观察数据排序、频率分布及核心统计指标的变化,是学习概率统计的实用工具。
<?xml version="1.0" encoding="utf-8"?>
<geogebra format="5.0" version="5.0.284.0" id="b0d9539a-eb18-4b12-901e-a748f33cadf1" xsi:noNamespaceSchemaLocation="http://www.geogebra.org/ggb.xsd" xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<gui>
<window width="960" height="660" />
<perspectives>
<perspective id="tmp">
<panes>
<pane location="" divider="0.5" orientation="0" />
<pane location="1" divider="0.33181818181818185" orientation="0" />
</panes>
<views>
<view id="4097" visible="false" inframe="true" stylebar="true" location="1,1,1,1" size="400" window="14,63,1124,613" />
<view id="8" toolbar="1001 | 1002 | 1003 || 1005 | 1004 || 1006 | 1007 | 1010 || 1008 1009 || 66 68 || 6" visible="false" inframe="false" stylebar="false" location="1,3" size="300" window="100,100,600,400" />
<view id="16" visible="true" inframe="false" stylebar="false" location="2,2" size="320" window="262,79,500,500" />
<view id="1" visible="true" inframe="false" stylebar="false" location="0" size="330" window="100,100,600,400" />
<view id="4" toolbar="0 || 2020 , 2021 , 2022 , 66 || 2001 , 2003 , 2002 , 2004 , 2005 || 2040 , 2041 , 2042 , 2044 , 2043" visible="false" inframe="false" stylebar="true" location="1" size="291" window="100,100,600,400" />
<view id="2" visible="false" inframe="false" stylebar="false" location="1" size="167" window="100,100,250,400" />
<view id="32" visible="false" inframe="false" stylebar="true" location="1" size="150" window="50,50,500,500" />
<view id="64" toolbar="0" visible="false" inframe="true" stylebar="true" location="1" size="150" window="50,50,500,500" />
<view id="128" visible="false" inframe="true" stylebar="false" location="1" size="480" window="50,50,500,500" />
<view id="70" toolbar="0 || 2020 || 2021 || 2022" visible="false" inframe="true" stylebar="true" location="1" size="150" window="50,50,500,500" />
<view id="43" visible="false" inframe="false" stylebar="false" location="1" size="450" window="50,50,500,500" />
<view id="512" toolbar="0 | 1 501 5 19 , 67 | 2 15 45 18 , 7 37 | 514 3 9 , 13 44 , 47 | 16 | 551 550 11 , 22 , 23 , 55 56 57 , 12 | 69 | 510 511 , 512 513 | 533 531 , 534 532 , 522 523 , 537 536 , 535 | 521 520 | 36 , 38 49 560 | 571 30 29 570 31 33 | 17 | 540 40 41 42 , 27 28 35 , 6 , 502" visible="false" inframe="false" stylebar="true" location="1" size="1107" window="100,100,600,400" />
</views>
<toolbar show="false" items="0 39 | 1 501 67 , 5 19 , 72 | 2 15 45 , 18 65 , 7 37 | 4 3 8 9 , 13 44 , 58 , 47 | 16 51 64 , 70 | 10 34 53 11 , 24 20 22 , 21 23 | 55 56 57 , 12 | 36 46 , 38 49 50 , 71 | 30 29 54 32 31 33 | 17 26 62 73 , 14 68 | 25 52 60 61 | 40 41 42 , 27 28 35 , 6" position="1" help="false" />
<input show="false" cmd="true" top="true" />
<dockBar show="false" east="false" />
</perspective>
</perspectives>
<labelingStyle val="3"/>
<font size="24"/>
</gui>
<euclidianView>
<viewNumber viewNo="1"/>
<size width="958" height="330"/>
<coordSystem xZero="25.96170512264036" yZero="205.5853878760056" scale="44.725033824568456" yscale="38.26739960831403"/>
<evSettings axes="true" grid="false" gridIsBold="false" pointCapturing="2" rightAngleStyle="1" checkboxSize="26" gridType="0"/>
<bgColor r="255" g="255" b="255"/>
<axesColor r="0" g="0" b="0"/>
<gridColor r="192" g="192" b="192"/>
<lineStyle axes="3" grid="10"/>
<axis id="0" show="true" label="" unitLabel="" tickStyle="1" showNumbers="true" tickDistance="1" tickExpression="" positiveAxis="true"/>
<axis id="1" show="false" label="" unitLabel="" tickStyle="1" showNumbers="true" positiveAxis="true"/>
<grid distX="1" distY="0.25" distTheta="0.5235987755982988"/>
</euclidianView>
<euclidianView>
<viewNumber viewNo="2"/>
<size width="958" height="320"/>
<coordSystem xZero="176.48283404100633" yZero="87.20407625272901" scale="43.042987832800215" yscale="43.04298783280036"/>
<evSettings axes="false" grid="false" gridIsBold="false" pointCapturing="0" rightAngleStyle="1" checkboxSize="26" gridType="0"/>
<bgColor r="255" g="250" b="205"/>
<axesColor r="0" g="0" b="0"/>
<gridColor r="192" g="192" b="192"/>
<lineStyle axes="1" grid="0"/>
<axis id="0" show="false" label="" unitLabel="" tickStyle="1" showNumbers="true"/>
<axis id="1" show="false" label="" unitLabel="" tickStyle="1" showNumbers="true"/>
<grid distX="1" distY="0.25" distTheta="0.5235987755982988"/>
</euclidianView>
<kernel>
<continuous val="false"/>
<usePathAndRegionParameters val="true"/>
<decimals val="2"/>
<angleUnit val="degree"/>
<algebraStyle val="0" spreadsheet="0"/>
<coordStyle val="0"/>
<angleFromInvTrig val="false"/>
</kernel>
<scripting blocked="false" disabled="false"/>
<construction title="" author="" date="">
<element type="boolean" label="sorted">
<value val="false"/>
<show object="true" label="true" ev="3"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<layer val="9"/>
<labelOffset x="4" y="16"/>
<labelMode val="3"/>
<checkbox fixed="true"/>
<caption val="Sort"/>
</element>
<element type="numeric" label="seperation">
<value val="0.4"/>
<show object="false" label="true"/>
<objColor r="0" g="0" b="255" alpha="0.1"/>
<layer val="0"/>
<labelMode val="1"/>
<slider min="-5" max="5" absoluteScreenLocation="true" width="200" x="30" y="90" fixed="false" horizontal="true" showAlgebra="false"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<animation step="1" speed="1" type="0" playing="false"/>
</element>
<expression label ="listNx" exp="{5, 6, 7, 8, 9, 10, 11, 12}"/>
<element type="list" label="listNx">
<show object="true" label="true" ev="4"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
<bgColor r="255" g="255" b="255" alpha="255"/>
<layer val="9"/>
<labelOffset x="21" y="263"/>
<labelMode val="3"/>
<animation step="1" speed="1" type="0" playing="false"/>
<ggbscript onUpdate="RunClickScript[button1]"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<ggbscript onUpdate="RunClickScript[button1]"/>
<selectedIndex val="2"/>
<comboBox val="true"/>
<pointSize val="3"/>
<pointStyle val="-1"/>
<caption val="Number of data="/>
</element>
<command name="SelectedElement">
<input a0="listNx"/>
<output a0="nX"/>
</command>
<element type="numeric" label="nX">
<value val="7"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
<selectionAllowed val="false"/>
</element>
<command name="Sequence">
<input a0="Segment[(0, i), (20, i)]" a1="i" a2="seperation" a3="(12 * seperation)" a4="seperation"/>
<output a0="listGridX"/>
</command>
<element type="list" label="listGridX">
<show object="true" label="true" ev="8"/>
<objColor r="192" g="192" b="192" alpha="0"/>
<bgColor r="255" g="255" b="255" alpha="255"/>
<layer val="0"/>
<labelMode val="0"/>
<selectionAllowed val="false"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<pointSize val="3"/>
<pointStyle val="-1"/>
</element>
<command name="Point">
<input a0="listGridX"/>
<output a0="A"/>
</command>
<element type="point" label="A">
<show object="true" label="false" ev="4"/>
<objColor r="128" g="128" b="128" alpha="0"/>
<layer val="9"/>
<labelOffset x="21" y="47"/>
<labelMode val="0"/>
<animation step="0.1" speed="1" type="1" playing="false"/>
<coords x="12.999999999999998" y="0.8" z="1"/>
<pointSize val="6"/>
<pointStyle val="0"/>
</element>
<command name="Point">
<input a0="listGridX"/>
<output a0="B"/>
</command>
<element type="point" label="B">
<show object="true" label="false" ev="4"/>
<objColor r="128" g="128" b="128" alpha="0"/>
<layer val="9"/>
<labelMode val="0"/>
<animation step="0.1" speed="1" type="1" playing="false"/>
<coords x="9" y="0.4" z="1"/>
<pointSize val="6"/>
<pointStyle val="0"/>
</element>
<command name="Point">
<input a0="listGridX"/>
<output a0="C"/>
</command>
<element type="point" label="C">
<show object="true" label="false" ev="4"/>
<objColor r="128" g="128" b="128" alpha="0"/>
<layer val="9"/>
<labelOffset x="-8" y="0"/>
<labelMode val="0"/>
<animation step="0.1" speed="1" type="1" playing="false"/>
<coords x="18" y="0.4" z="1"/>
<pointSize val="6"/>
<pointStyle val="0"/>
</element>
<command name="Point">
<input a0="listGridX"/>
<output a0="D"/>
</command>
<element type="point" label="D">
<show object="true" label="false" ev="4"/>
<condition showObject="nX ≥ 4"/>
<objColor r="128" g="128" b="128" alpha="0"/>
<layer val="9"/>
<labelMode val="0"/>
<animation step="0.1" speed="1" type="1" playing="false"/>
<coords x="10" y="0.4" z="1"/>
<pointSize val="6"/>
<pointStyle val="0"/>
</element>
<command name="Point">
<input a0="listGridX"/>
<output a0="E"/>
</command>
<element type="point" label="E">
<show object="true" label="false" ev="4"/>
<condition showObject="nX ≥ 5"/>
<objColor r="128" g="128" b="128" alpha="0"/>
<layer val="9"/>
<labelMode val="0"/>
<animation step="0.1" speed="1" type="1" playing="false"/>
<coords x="11" y="0.4" z="1"/>
<pointSize val="6"/>
<pointStyle val="0"/>
</element>
<command name="Point">
<input a0="listGridX"/>
<output a0="F"/>
</command>
<element type="point" label="F">
<show object="false" label="false" ev="4"/>
<condition showObject="nX ≥ 6"/>
<objColor r="128" g="128" b="128" alpha="0"/>
<layer val="9"/>
<labelMode val="0"/>
<animation step="0.1" speed="1" type="1" playing="false"/>
<coords x="10" y="0.8" z="1"/>
<pointSize val="6"/>
<pointStyle val="0"/>
</element>
<command name="Point">
<input a0="listGridX"/>
<output a0="G"/>
</command>
<element type="point" label="G">
<show object="true" label="false" ev="4"/>
<condition showObject="nX ≥ 7"/>
<objColor r="128" g="128" b="128" alpha="0"/>
<layer val="9"/>
<labelMode val="0"/>
<animation step="0.1" speed="1" type="1" playing="false"/>
<coords x="13" y="0.4" z="1"/>
<pointSize val="6"/>
<pointStyle val="0"/>
</element>
<command name="Point">
<input a0="listGridX"/>
<output a0="H"/>
</command>
<element type="point" label="H">
<show object="true" label="false" ev="4"/>
<condition showObject="nX ≥ 8"/>
<objColor r="128" g="128" b="128" alpha="0"/>
<layer val="9"/>
<labelMode val="0"/>
<animation step="0.1" speed="1" type="1" playing="false"/>
<coords x="0" y="0.4" z="1"/>
<pointSize val="6"/>
<pointStyle val="0"/>
</element>
<command name="Point">
<input a0="listGridX"/>
<output a0="I"/>
</command>
<element type="point" label="I">
<show object="true" label="false" ev="4"/>
<condition showObject="nX ≥ 9"/>
<objColor r="128" g="128" b="128" alpha="0"/>
<layer val="9"/>
<labelMode val="0"/>
<animation step="0.1" speed="1" type="1" playing="false"/>
<coords x="0" y="0.4" z="1"/>
<pointSize val="6"/>
<pointStyle val="0"/>
</element>
<command name="Point">
<input a0="listGridX"/>
<output a0="J"/>
</command>
<element type="point" label="J">
<show object="true" label="false" ev="4"/>
<condition showObject="nX ≥ 10"/>
<objColor r="128" g="128" b="128" alpha="0"/>
<layer val="9"/>
<labelMode val="0"/>
<animation step="0.1" speed="1" type="1" playing="false"/>
<coords x="0" y="0.4" z="1"/>
<pointSize val="6"/>
<pointStyle val="0"/>
</element>
<command name="Point">
<input a0="listGridX"/>
<output a0="K"/>
</command>
<element type="point" label="K">
<show object="true" label="false" ev="4"/>
<condition showObject="nX ≥ 11"/>
<objColor r="128" g="128" b="128" alpha="0"/>
<layer val="9"/>
<labelMode val="0"/>
<animation step="0.1" speed="1" type="1" playing="false"/>
<coords x="0" y="0.4" z="1"/>
<pointSize val="6"/>
<pointStyle val="0"/>
</element>
<command name="Point">
<input a0="listGridX"/>
<output a0="L"/>
</command>
<element type="point" label="L">
<show object="true" label="false" ev="4"/>
<condition showObject="nX ≥ 12"/>
<objColor r="128" g="128" b="128" alpha="0"/>
<layer val="9"/>
<labelMode val="0"/>
<animation step="0.1" speed="1" type="1" playing="false"/>
<coords x="0" y="0.4" z="1"/>
<pointSize val="6"/>
<pointStyle val="0"/>
</element>
<expression label="listDataX" exp="round(Take[x({A, B, C, D, E, F, G, H, I, J, K, L}), 1, nX])" />
<element type="list" label="listDataX">
<objColor r="0" g="0" b="0" alpha="0"/>
<bgColor r="255" g="255" b="255" alpha="255"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<pointSize val="3"/>
<pointStyle val="-1"/>
</element>
<command name="Sort">
<input a0="listDataX"/>
<output a0="listDataXsorted"/>
</command>
<element type="list" label="listDataXsorted">
<objColor r="0" g="100" b="0" alpha="0"/>
<bgColor r="255" g="255" b="255" alpha="255"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<pointSize val="3"/>
<pointStyle val="-1"/>
</element>
<command name="Mean">
<input a0="listDataX"/>
<output a0="meanX"/>
</command>
<element type="numeric" label="meanX">
<value val="12"/>
<objColor r="0" g="0" b="255" alpha="0.1"/>
<selectionAllowed val="false"/>
</element>
<element type="boolean" label="box1">
<value val="false"/>
<show object="true" label="true" ev="3"/>
<objColor r="255" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelOffset x="5" y="132"/>
<labelMode val="3"/>
<checkbox fixed="true"/>
<caption val="Arithmetic Mean"/>
</element>
<element type="boolean" label="box2">
<value val="false"/>
<show object="true" label="true" ev="3"/>
<objColor r="0" g="0" b="255" alpha="0"/>
<layer val="0"/>
<labelOffset x="6" y="244"/>
<labelMode val="3"/>
<checkbox fixed="true"/>
<caption val="Median"/>
</element>
<element type="button" label="button1">
<show object="true" label="true"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<bgColor r="255" g="255" b="0" alpha="255"/>
<layer val="0"/>
<labelOffset x="325" y="263"/>
<labelMode val="3"/>
<animation step="1" speed="1" type="0" playing="false"/>
<auxiliary val="true"/>
<ggbscript val="UpdateConstruction[] SetValue[A,listPosition(1)] SetValue[B,listPosition(2)] SetValue[C,listPosition(3)] SetValue[D,listPosition(4)] SetValue[E,listPosition(5)] SetValue[F,listPosition(6)] SetValue[G,listPosition(7)] SetValue[H,listPosition(8)] SetValue[I,listPosition(9)] SetValue[J,listPosition(10)] SetValue[K,listPosition(11)] SetValue[L,listPosition(12)] SetValue[box1,false] SetValue[box2,false] SetValue[box3,false] SetValue[Q_2,(0,0)] SetValue[sorted,false]"/>
<font serif="false" sizeM="2" size="24" style="0"/>
<caption val="Random data"/>
</element>
<element type="boolean" label="box3">
<value val="false"/>
<show object="true" label="true" ev="3"/>
<objColor r="0" g="153" b="0" alpha="0"/>
<layer val="0"/>
<labelOffset x="392" y="244"/>
<labelMode val="3"/>
<checkbox fixed="true"/>
<caption val="Mode"/>
</element>
<element type="button" label="button2">
<show object="true" label="true"/>
<condition showObject="¬reachMax"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<bgColor r="153" g="255" b="255" alpha="255"/>
<layer val="0"/>
<labelOffset x="547" y="263"/>
<labelMode val="3"/>
<animation step="1" speed="1" type="0" playing="false"/>
<auxiliary val="true"/>
<ggbscript val="SetValue[A,A+(1,0)] SetValue[B,B+(1,0)] SetValue[C,C+(1,0)] SetValue[D,D+(1,0)] SetValue[E,E+(1,0)] SetValue[F,F+(1,0)] SetValue[G,G+(1,0)] SetValue[H,H+(1,0)] SetValue[I,I+(1,0)] SetValue[J,J+(1,0)] SetValue[K,K+(1,0)] SetValue[L,L+(1,0)]"/>
<font serif="false" sizeM="1.4" size="10" style="0"/>
<caption val="Add 1 to all data"/>
</element>
<element type="button" label="button3">
<show object="true" label="true"/>
<condition showObject="¬reachMin"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<bgColor r="153" g="255" b="255" alpha="255"/>
<layer val="0"/>
<labelOffset x="708" y="263"/>
<labelMode val="3"/>
<animation step="1" speed="1" type="0" playing="false"/>
<auxiliary val="true"/>
<ggbscript val="SetValue[A,A-(1,0)] SetValue[B,B-(1,0)] SetValue[C,C-(1,0)] SetValue[D,D-(1,0)] SetValue[E,E-(1,0)] SetValue[F,F-(1,0)] SetValue[G,G-(1,0)] SetValue[H,H-(1,0)] SetValue[I,I-(1,0)] SetValue[J,J-(1,0)] SetValue[K,K-(1,0)] SetValue[L,L-(1,0)]"/>
<font serif="false" sizeM="1.4" size="10" style="0"/>
<caption val="Subtract 1 from all data"/>
</element>
<expression label="reachMin" exp="Min[listDataX] ≤ 0" />
<element type="boolean" label="reachMin">
<value val="false"/>
<show object="false" label="true"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<checkbox fixed="true"/>
</element>
<expression label="reachMax" exp="Max[listDataX] ≥ 20" />
<element type="boolean" label="reachMax">
<value val="false"/>
<show object="false" label="true"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<layer val="0"/>
<labelMode val="0"/>
<checkbox fixed="true"/>
</element>
<command name="If">
<input a0="nX ≥ 11" a1="0.7" a2="If[nX ≥ 9, 0.85, 1]"/>
<output a0="scale"/>
</command>
<element type="numeric" label="scale">
<value val="1"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
<selectionAllowed val="false"/>
</element>
<command name="Median">
<input a0="listDataX"/>
<output a0="q2"/>
</command>
<element type="numeric" label="q2">
<value val="11"/>
<objColor r="255" g="127" b="0" alpha="0.1"/>
<selectionAllowed val="false"/>
</element>
<command name="Ray">
<input a0="(0, 0)" a1="(1, 0)"/>
<output a0="b"/>
</command>
<element type="ray" label="b">
<show object="false" label="false" ev="7"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<layer val="9"/>
<labelMode val="0"/>
<selectionAllowed val="false"/>
<coords x="0" y="1" z="0"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<outlyingIntersections val="false"/>
<keepTypeOnTransform val="true"/>
</element>
<command name="Point">
<input a0="b"/>
<output a0="Q_2"/>
</command>
<element type="point" label="Q_2">
<show object="true" label="false" ev="7"/>
<objColor r="0" g="0" b="255" alpha="0"/>
<layer val="9"/>
<labelOffset x="78" y="20"/>
<labelMode val="0"/>
<animation step="0.1" speed="1" type="1" playing="false"/>
<coords x="0" y="0" z="1"/>
<pointSize val="6"/>
<pointStyle val="0"/>
</element>
<command name="Vector">
<input a0="Q_2" a1="Q_2 + (0, 0.8)"/>
<output a0="v"/>
</command>
<element type="vector" label="v">
<show object="true" label="false" ev="7"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<layer val="9"/>
<labelMode val="0"/>
<selectionAllowed val="false"/>
<coords x="0" y="0.8" z="0"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<coordStyle style="cartesian"/>
<startPoint exp="Q_2"/>
</element>
<command name="Sequence">
<input a0="Text[Element[If[sorted, listDataXsorted, listDataX], i]] + "+"" a1="i" a2="1" a3="nX - 1"/>
<output a0="list1"/>
</command>
<element type="list" label="list1">
<show object="false" label="false" ev="11"/>
<objColor r="0" g="100" b="0" alpha="0"/>
<bgColor r="255" g="255" b="255" alpha="255"/>
<layer val="9"/>
<labelMode val="0"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<pointSize val="3"/>
<pointStyle val="-1"/>
</element>
<expression label="sumText" exp=""" + (Sum[list1] + (Text[Element[If[sorted, listDataXsorted, listDataX], nX]])) + """ />
<element type="text" label="sumText">
<show object="false" label="false" ev="11"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<layer val="9"/>
<labelMode val="0"/>
<selectionAllowed val="false"/>
<absoluteScreenLocation x="285" y="142"/>
</element>
<expression label="textMean" exp=""=\frac{" + (LaTeX[sumText]) + "}{" + (LaTeX[nX]) + "}\\ =" + (LaTeX[Mean[listDataX]]) + """ />
<element type="text" label="textMean">
<show object="true" label="true" ev="11"/>
<condition showObject="box1"/>
<objColor r="255" g="0" b="0" alpha="0"/>
<layer val="9"/>
<labelMode val="0"/>
<selectionAllowed val="false"/>
<isLaTeX val="true"/>
<font serif="true" sizeM="1" size="0" style="0"/>
<absoluteScreenLocation x="234" y="117"/>
</element>
<expression label="textMedianOdd" exp=""=" + (LaTeX[Text[q2]]) + """ />
<element type="text" label="textMedianOdd">
<show object="true" label="true" ev="11"/>
<condition showObject="Mod[nX, 2] ≟ 1 ∧ box2"/>
<objColor r="0" g="0" b="255" alpha="0"/>
<layer val="9"/>
<labelMode val="0"/>
<selectionAllowed val="false"/>
<isLaTeX val="true"/>
<font serif="true" sizeM="1" size="0" style="0"/>
<absoluteScreenLocation x="132" y="244"/>
</element>
<expression label="textMedianEven" exp=""=\frac{" + (LaTeX[Element[listDataXsorted, nX / 2]]) + "+" + (LaTeX[Element[listDataXsorted, nX / 2 + 1]]) + "}{2}=" + (LaTeX[Text[q2]]) + """ />
<element type="text" label="textMedianEven">
<show object="false" label="true" ev="11"/>
<condition showObject="Mod[nX, 2] ≟ 0 ∧ box2"/>
<objColor r="0" g="0" b="255" alpha="0"/>
<layer val="9"/>
<labelMode val="0"/>
<selectionAllowed val="false"/>
<isLaTeX val="true"/>
<font serif="true" sizeM="1" size="0" style="0"/>
<absoluteScreenLocation x="133" y="230"/>
</element>
<command name="Mode">
<input a0="listDataX"/>
<output a0="listMode"/>
</command>
<element type="list" label="listMode">
<objColor r="0" g="100" b="0" alpha="0.1"/>
<bgColor r="255" g="255" b="255" alpha="255"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<pointSize val="3"/>
<pointStyle val="-1"/>
</element>
<element type="button" label="button0">
<show object="true" label="true" ev="3"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<layer val="8"/>
<labelOffset x="851" y="276"/>
<labelMode val="3"/>
<fixed val="true"/>
<auxiliary val="true"/>
<ggbscript val="SetValue[lang,If[lang==1,2,1]] RunClickScript[buttonLang]"/>
<font serif="false" sizeM="1.4" size="10" style="0"/>
<caption val="中文"/>
</element>
<element type="button" label="buttonLang">
<show object="false" label="true" ev="3"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<layer val="8"/>
<labelOffset x="546" y="303"/>
<labelMode val="0"/>
<animation step="1" speed="1" type="0" playing="false"/>
<auxiliary val="true"/>
<ggbscript val="SetCaption[button0,If[lang==1,"ENG","中文"]] SetCaption[listNx,If[lang==1,"數據數目=","Number of data="]] SetCaption[button2,If[lang==1,"所有數據加1","Add 1 to all data"]] SetCaption[button3,If[lang==1,"所有數據減1","Subtract 1 from all data"]] SetCaption[button1,If[lang==1,"隨機數據","Random data"]] SetCaption[sorted,If[lang==1,"排序","Sort"]] SetCaption[box1,If[lang==1,"算術平均數","Arithmetic Mean"]] SetCaption[box2,If[lang==1,"中位數","Median"]] SetCaption[box3,If[lang==1,"眾數","Mode"]]"/>
<font serif="false" sizeM="2" size="24" style="0"/>
</element>
<element type="numeric" label="lang">
<value val="2"/>
<symbolic val="true" />
<show object="false" label="true"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
<layer val="8"/>
<labelMode val="1"/>
<animation step="1" speed="1" type="0" playing="false"/>
</element>
<expression label="textData" exp=""\text{" + (LaTeX[If[lang ≟ 1, "數據", "Data"]]) + ":} " + (LaTeX[TableText[{If[sorted, listDataXsorted, listDataX]}, "c"]]) + """ />
<element type="text" label="textData">
<show object="true" label="true" ev="11"/>
<objColor r="0" g="0" b="0" alpha="0"/>
<bgColor r="153" g="255" b="255" alpha="255"/>
<layer val="0"/>
<labelMode val="0"/>
<selectionAllowed val="false"/>
<isLaTeX val="true"/>
<font serif="true" sizeM="1" size="0" style="1"/>
<absoluteScreenLocation x="106" y="18"/>
</element>
<expression label="textMode" exp=""" + (LaTeX[If[listMode ≟ {}, "\text{" + (If[lang ≟ 1, "沒有眾數", "undefined"]) + "}", "=" + (Take[Text[listMode], 2, Length[Text[listMode]] - 1])]]) + """ />
<element type="text" label="textMode">
<show object="true" label="true" ev="11"/>
<condition showObject="box3"/>
<objColor r="0" g="153" b="0" alpha="0"/>
<layer val="9"/>
<labelMode val="0"/>
<selectionAllowed val="false"/>
<isLaTeX val="true"/>
<font serif="true" sizeM="1" size="0" style="0"/>
<absoluteScreenLocation x="500" y="244"/>
</element>
<command name="Sequence">
<input a0="Random[0, 20]" a1="i" a2="1" a3="nX"/>
<output a0="listRand"/>
</command>
<element type="list" label="listRand">
<objColor r="255" g="0" b="255" alpha="0.1"/>
<bgColor r="255" g="255" b="255" alpha="255"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<pointSize val="3"/>
<pointStyle val="-1"/>
</element>
<command name="Frequency">
<input a0="listRand"/>
<output a0="listFreq"/>
</command>
<element type="list" label="listFreq">
<objColor r="255" g="0" b="255" alpha="0.1"/>
<bgColor r="255" g="255" b="255" alpha="255"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<pointSize val="3"/>
<pointStyle val="-1"/>
</element>
<command name="Sort">
<input a0="listRand"/>
<output a0="listRandSort"/>
</command>
<element type="list" label="listRandSort">
<objColor r="255" g="0" b="255" alpha="0.1"/>
<bgColor r="255" g="255" b="255" alpha="255"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<pointSize val="3"/>
<pointStyle val="-1"/>
</element>
<command name="Flatten">
<input a0="Zip[Sequence[(seperation * i), i, 1, k], k, listFreq]"/>
<output a0="listHeight"/>
</command>
<element type="list" label="listHeight">
<objColor r="255" g="0" b="255" alpha="0.1"/>
<bgColor r="255" g="255" b="255" alpha="255"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<pointSize val="3"/>
<pointStyle val="-1"/>
</element>
<command name="Shuffle">
<input a0="Zip[(h, k), h, listRandSort, k, listHeight]"/>
<output a0="listPosition"/>
</command>
<element type="list" label="listPosition">
<show object="false" label="false" ev="4"/>
<objColor r="255" g="0" b="255" alpha="0"/>
<bgColor r="255" g="255" b="255" alpha="255"/>
<layer val="8"/>
<labelMode val="0"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<pointSize val="3"/>
<pointStyle val="-1"/>
</element>
<command name="Segment">
<input a0="(meanX, 0)" a1="(meanX, 4)"/>
<output a0="sMean"/>
</command>
<element type="segment" label="sMean">
<show object="true" label="false" ev="4"/>
<condition showObject="box1"/>
<objColor r="255" g="0" b="0" alpha="0"/>
<layer val="5"/>
<labelMode val="0"/>
<selectionAllowed val="false"/>
<coords x="-4" y="0" z="48"/>
<lineStyle thickness="9" type="0" typeHidden="1"/>
<outlyingIntersections val="false"/>
<keepTypeOnTransform val="true"/>
</element>
<command name="Segment">
<input a0="(q2, 0)" a1="(q2, 3.5)"/>
<output a0="sMedian"/>
</command>
<element type="segment" label="sMedian">
<show object="true" label="false" ev="8"/>
<condition showObject="box2"/>
<objColor r="0" g="0" b="255" alpha="0"/>
<layer val="6"/>
<labelMode val="0"/>
<selectionAllowed val="false"/>
<coords x="-3.5" y="0" z="38.5"/>
<lineStyle thickness="9" type="0" typeHidden="1"/>
<outlyingIntersections val="false"/>
<keepTypeOnTransform val="true"/>
</element>
<command name="Zip">
<input a0="Segment[(k, 0), (k, 3)]" a1="k" a2="listMode"/>
<output a0="listModeSegment"/>
</command>
<element type="list" label="listModeSegment">
<show object="true" label="true" ev="4"/>
<condition showObject="box3"/>
<objColor r="51" g="153" b="0" alpha="0"/>
<bgColor r="255" g="255" b="255" alpha="255"/>
<layer val="7"/>
<labelMode val="0"/>
<selectionAllowed val="false"/>
<lineStyle thickness="9" type="0" typeHidden="1"/>
<pointSize val="3"/>
<pointStyle val="-1"/>
</element>
</construction>
</geogebra>