二项分布概率演示与柱状图
2011-06-17 02:29
本GeoGebra范例动态演示了二项分布的概率计算与可视化。通过滑块调节试验次数n和成功概率p,实时生成二项分布的柱状图,并计算显示期望值与标准差σ。该模型直观展示了离散型随机变量的概率分布规律,适用于概率统计教学。
<?xml version="1.0" encoding="utf-8"?>
<geogebra format="3.3" xsi:noNamespaceSchemaLocation="http://www.geogebra.org/ggb.xsd" xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<gui>
<window width="703" height="470" /> <perspectives>
<perspective id="tmp">
<panes>
<pane location="" divider="0.2844950213371266" orientation="1" />
</panes>
<views>
<view id="4" toolbar="66" visible="false" inframe="false" stylebar="false" location="1,1" size="200" window="0,0,400,400" />
<view id="1" visible="true" inframe="false" stylebar="false" location="1" size="695" window="0,0,400,400" />
<view id="2" visible="false" inframe="false" stylebar="false" location="3" size="200" window="0,0,200,400" />
<view id="8" toolbar="1001 1002 1003 || 1005 | 1004 || 1006 | 1007 || 1008 1009" visible="false" inframe="true" stylebar="false" location="1" size="150" window="50,50,500,500" />
<view id="16" visible="false" inframe="true" stylebar="false" location="1" size="150" window="50,50,500,500" />
</views>
<toolbar show="false" items="0 39 59 || 1 501 5 19 67 | 2 15 45 18 , 7 37 | 4 3 8 9 , 13 44 , 58 , 47 || 16 51 64 65 | 10 34 53 11 , 24 20 22 , 21 23 | 55 56 57 , 12 || 36 46 , 38 49 50 | 30 29 54 32 31 33 | 25 , 17 26 62 , 14 66 | 52 60 61 || 40 41 42 , 27 28 35 , 6 || 100001 100002 100003 " />
<input show="false" cmd="true" top="false" />
</perspective>
</perspectives>
<labelingStyle val="3"/>
</gui>
<euclidianView>
<size width="695" height="391"/>
<coordSystem xZero="225.0" yZero="255.0" scale="19.457875457875456" yscale="663.8006644518273"/>
<evSettings axes="true" grid="false" gridIsBold="false" pointCapturing="3" rightAngleStyle="1" checkboxSize="13" 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="0" grid="10"/>
<axis id="0" show="true" label="" unitLabel="" tickStyle="1" showNumbers="true" tickDistance="1.0" axisCross="0.0" positiveAxis="true"/>
<axis id="1" show="true" label="" unitLabel="" tickStyle="0" showNumbers="true" axisCross="0.0" positiveAxis="true"/>
</euclidianView>
<spreadsheetView>
<size width="0" height="0"/>
<spreadsheetColumn id="0" width="75"/>
<spreadsheetColumn id="1" width="75"/>
<spreadsheetColumn id="2" width="75"/>
<spreadsheetColumn id="3" width="75"/>
<spreadsheetColumn id="4" width="75"/>
<spreadsheetColumn id="5" width="75"/>
<spreadsheetColumn id="6" width="75"/>
<spreadsheetColumn id="7" width="75"/>
<spreadsheetColumn id="8" width="75"/>
<spreadsheetColumn id="9" width="75"/>
<spreadsheetColumn id="10" width="75"/>
<spreadsheetColumn id="11" width="75"/>
<spreadsheetColumn id="12" width="75"/>
<spreadsheetColumn id="13" width="75"/>
<spreadsheetColumn id="14" width="75"/>
<spreadsheetColumn id="15" width="75"/>
<spreadsheetColumn id="16" width="75"/>
<spreadsheetColumn id="17" width="75"/>
<spreadsheetColumn id="18" width="75"/>
<spreadsheetColumn id="19" width="75"/>
<spreadsheetColumn id="20" width="75"/>
<spreadsheetColumn id="21" width="75"/>
<spreadsheetColumn id="22" width="75"/>
<spreadsheetColumn id="23" width="75"/>
<spreadsheetColumn id="24" width="75"/>
<spreadsheetColumn id="25" width="75"/>
<selection hScroll="0" vScroll="0" column="0" row="0"/>
<layout showGrid="true" showHScrollBar="true" showVScrollBar="true" showBrowserPanel="false" showColumnHeader="true" showRowHeader ="true" allowSpecialEditor="false"/>
<spreadsheetBrowser default="true"/>
</spreadsheetView>
<kernel>
<continuous val="false"/>
<decimals val="2"/>
<angleUnit val="degree"/>
<algebraStyle val="0"/>
<coordStyle val="0"/>
</kernel>
<construction title="" author="" date="">
<element type="numeric" label="p">
<value val="0.5"/>
<show object="true" label="true" ev="2"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
<layer val="5"/>
<labelMode val="1"/>
<slider min="0.0" max="1.0" absoluteScreenLocation="true" width="100.0" x="56.0" y="282.0" fixed="false" horizontal="true"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<animation step="0.05" speed="1.0" type="0" playing="false"/>
</element>
<expression label="q" exp="1.0 - p" />
<element type="numeric" label="q">
<value val="0.5"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
</element>
<element type="numeric" label="n">
<value val="23.0"/>
<show object="true" label="true"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
<layer val="5"/>
<labelMode val="1"/>
<slider min="1.0" max="50.0" absoluteScreenLocation="true" width="100.0" x="49.0" y="85.0" fixed="false" horizontal="true"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<animation step="1.0" speed="1.0" type="0" playing="false"/>
</element>
<element type="numeric" label="r">
<value val="0.36"/>
<show object="true" label="false"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
<layer val="5"/>
<labelMode val="0"/>
<slider min="0.0" max="1.0" absoluteScreenLocation="true" width="100.0" x="53.0" y="194.0" fixed="false" horizontal="true"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<animation step="0.01" speed="1.0" type="0" playing="false"/>
</element>
<expression label="k" exp="floor(r * n)" />
<element type="numeric" label="k">
<value val="8.0"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
</element>
<element type="numeric" label="panelWidth">
<value val="200.0"/>
<show object="false" label="false"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
<layer val="5"/>
<labelMode val="1"/>
<animation step="0.1" speed="1.0" type="0" playing="false"/>
</element>
<command name="LeftPanel">
<input a0="panelWidth"/>
<output a0="LPanel"/>
</command>
<element type="polygon" label="LPanel">
<lineStyle thickness="2" type="1" typeHidden="1"/>
<show object="true" label="false"/>
<objColor r="204" g="204" b="255" alpha="1.0"/>
<layer val="1"/>
<labelMode val="0"/>
<fixed val="true"/>
<selectionAllowed val="false"/>
</element>
<expression label="文字1" exp=""k = " + k + """ />
<element type="text" label="文字1">
<show object="true" label="false"/>
<objColor r="0" g="0" b="0" alpha="0.0"/>
<layer val="5"/>
<labelMode val="0"/>
<absoluteScreenLocation x="77" y="167"/>
</element>
<expression label="p_k" exp="Binomial[n, k] * p^(k) * q^(n - k)" />
<element type="numeric" label="p_k">
<value val="0.05844998359680176"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
<selectionAllowed val="false"/>
</element>
<element type="image" label="dot">
<file name="ea31fb275932629d5633815ee3492f4e\clipboard.png"/>
<inBackground val="false"/>
<absoluteScreenLocation x="20" y="337"/> <show object="true" label="false"/>
<objColor r="0" g="0" b="0" alpha="1.0"/>
<layer val="5"/>
<labelMode val="0"/>
<fixed val="true"/>
</element>
<element type="image" label="labelProb">
<file name="2c2be77eb9d1c4538458202001193e68\clipboard.png"/>
<inBackground val="false"/>
<absoluteScreenLocation x="58" y="340"/> <show object="true" label="false" ev="2"/>
<objColor r="0" g="0" b="0" alpha="1.0"/>
<layer val="6"/>
<labelMode val="0"/>
<fixed val="true"/>
</element>
<element type="image" label="圖片4">
<file name="25ba70cf36c183d174363ecbae4e7998\clipboard.png"/>
<inBackground val="false"/>
<absoluteScreenLocation x="49" y="42"/> <show object="true" label="false"/>
<objColor r="0" g="0" b="0" alpha="1.0"/>
<layer val="5"/>
<labelMode val="0"/>
<fixed val="true"/>
</element>
<element type="image" label="圖片5">
<file name="cad97eeeb222d08f784ddb17d4f29736\clipboard.png"/>
<inBackground val="false"/>
<absoluteScreenLocation x="48" y="139"/> <show object="true" label="false"/>
<objColor r="0" g="0" b="0" alpha="1.0"/>
<layer val="5"/>
<labelMode val="0"/>
<fixed val="true"/>
</element>
<element type="image" label="圖片6">
<file name="20e15424054da4401571a02f2ebed64c\clipboard.png"/>
<inBackground val="false"/>
<absoluteScreenLocation x="19" y="137"/> <show object="true" label="false"/>
<objColor r="0" g="0" b="0" alpha="1.0"/>
<layer val="5"/>
<labelMode val="0"/>
<fixed val="true"/>
</element>
<element type="image" label="圖片7">
<file name="5c620c99f3a5387375acd057a37c7112\clipboard.png"/>
<inBackground val="false"/>
<absoluteScreenLocation x="19" y="41"/> <show object="true" label="false"/>
<objColor r="0" g="0" b="0" alpha="1.0"/>
<layer val="5"/>
<labelMode val="0"/>
<fixed val="true"/>
</element>
<element type="image" label="圖片1">
<file name="6cb3cd98708758e4a0823c08464a0e04\clipboard.png"/>
<inBackground val="false"/>
<absoluteScreenLocation x="19" y="241"/> <show object="true" label="false" ev="2"/>
<objColor r="0" g="0" b="0" alpha="1.0"/>
<layer val="6"/>
<labelMode val="0"/>
<fixed val="true"/>
</element>
<element type="image" label="圖片2">
<file name="be608d109dcc850133930f9335908c4f\clipboard.png"/>
<inBackground val="false"/>
<absoluteScreenLocation x="49" y="242"/> <show object="true" label="false" ev="2"/>
<objColor r="0" g="0" b="0" alpha="1.0"/>
<layer val="6"/>
<labelMode val="0"/>
<fixed val="true"/>
</element>
<expression label="文字3" exp=""" + k" />
<element type="text" label="文字3">
<show object="true" label="false" ev="2"/>
<objColor r="0" g="0" b="204" alpha="0.0"/>
<layer val="6"/>
<labelMode val="0"/>
<font serif="false" size="4" style="1"/>
<absoluteScreenLocation x="38" y="336"/>
</element>
<expression label="文字2" exp=""C^{" + n + "}_{" + k + "} (" + p + ")^{" + k + "} (" + (1.0 - p) + ")^{" + (n - k) + "} \\=" + p_k" />
<element type="text" label="文字2">
<show object="true" label="false" ev="2"/>
<objColor r="0" g="0" b="153" alpha="0.0"/>
<layer val="5"/>
<labelMode val="0"/>
<isLaTeX val="true"/>
<font serif="false" size="-2" style="0"/>
<decimals val="3"/>
<absoluteScreenLocation x="41" y="350"/>
</element>
<command name="Sequence">
<input a0="j" a1="j" a2="0.0" a3="n"/>
<output a0="heads"/>
</command>
<element type="list" label="heads">
<objColor r="0" g="110" b="0" alpha="0.1"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<pointSize val="3"/>
<pointStyle val="-1"/>
</element>
<command name="Sequence">
<input a0="Binomial[n, j] * p^(j) * (1.0 - p)^(n - j)" a1="j" a2="0.0" a3="n"/>
<output a0="chances"/>
</command>
<element type="list" label="chances">
<objColor r="0" g="110" b="0" alpha="0.1"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<pointSize val="3"/>
<pointStyle val="-1"/>
</element>
<command name="BarChart">
<input a0="heads" a1="chances" a2="0.2"/>
<output a0="bars"/>
</command>
<element type="numeric" label="bars">
<value val="0.2"/>
<show object="true" label="false" ev="2"/>
<objColor r="255" g="204" b="102" alpha="0.75"/>
<layer val="6"/>
<labelMode val="1"/>
<lineStyle thickness="0" type="0" typeHidden="1"/>
</element>
<command name="BarChart">
<input a0="{k, k + 1.0}" a1="{p_k, 0.0}" a2="0.2"/>
<output a0="bar_k"/>
</command>
<element type="numeric" label="bar_k">
<value val="0.011689996719360352"/>
<show object="true" label="false" ev="2"/>
<objColor r="153" g="51" b="0" alpha="0.25"/>
<layer val="6"/>
<labelMode val="1"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
</element>
<element type="textfield" label="txt_n">
<show object="true" label="true" ev="2"/>
<objColor r="0" g="0" b="0" alpha="0.0"/>
<layer val="6"/>
<labelOffset x="223" y="313"/>
<labelMode val="0"/>
<animation step="1.0" speed="1.0" type="0" playing="false"/>
<linkedGeo exp="n"/>
<ggbscript val="n=%0 "/>
<caption val="n ="/>
</element>
<element type="textfield" label="txt_p">
<show object="true" label="true" ev="2"/>
<objColor r="0" g="0" b="0" alpha="0.0"/>
<layer val="6"/>
<labelOffset x="223" y="343"/>
<labelMode val="0"/>
<animation step="1.0" speed="1.0" type="0" playing="false"/>
<linkedGeo exp="p"/>
<ggbscript val="A=(3,4) "/>
<caption val="p ="/>
</element>
<expression label="ev" exp="n * p" />
<element type="numeric" label="ev">
<value val="11.5"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
</element>
<expression label="σ" exp="sqrt(n * p * q)" />
<element type="numeric" label="σ">
<value val="2.3979157616563596"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
</element>
<element type="numeric" label="offset">
<value val="-0.04"/>
<show object="false" label="false" ev="2"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
<layer val="6"/>
<labelMode val="1"/>
<animation step="0.01" speed="1" type="0" playing="false"/>
</element>
<element type="numeric" label="h">
<value val="0.01"/>
<show object="false" label="false" ev="2"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
<layer val="6"/>
<labelMode val="1"/>
<animation step="0.01" speed="1" type="0" playing="false"/>
</element>
<command name="Sequence">
<input a0="Segment[(ev + j * σ, offset + h / 2.0), (ev + j * σ, offset - h / 2.0)]" a1="j" a2="-1.0" a3="1.0"/>
<output a0="集合1"/>
</command>
<element type="list" label="集合1">
<show object="true" label="false" ev="2"/>
<objColor r="51" g="0" b="255" alpha="0.0"/>
<layer val="6"/>
<labelMode val="0"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<pointSize val="3"/>
<pointStyle val="-1"/>
</element>
<command name="Segment">
<input a0="(ev - σ, offset)" a1="(ev + σ, offset)"/>
<output a0="a"/>
</command>
<element type="segment" label="a">
<show object="true" label="false" ev="2"/>
<objColor r="51" g="0" b="255" alpha="0.0"/>
<layer val="6"/>
<labelMode val="0"/>
<coords x="0.0" y="4.795831523312721" z="0.1918332609325088"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<eqnStyle style="implicit"/>
<outlyingIntersections val="false"/>
<keepTypeOnTransform val="true"/>
</element>
<expression label="txtSigma" exp=""σ = " + σ" />
<element type="text" label="txtSigma">
<show object="true" label="false" ev="2"/>
<objColor r="255" g="51" b="51" alpha="0.0"/>
<layer val="6"/>
<labelMode val="0"/>
<font serif="true" size="0" style="0"/>
<startPoint exp="(ev, offset - 2.0 * h)"/>
</element>
</construction>
</geogebra>