模拟随机变量的总和分布
2013-12-11 13:30
本范例用于观察和模拟多个随机变量之和的概率分布。通过调整随机变量的数量和抽样次数,用户可以直观地看到随机变量总和的分布情况,帮助深入理解概率统计中的分布规律与相关概念。
GeoGebra 画板及绘图内容加载中,请稍等……
<?xml version="1.0" encoding="utf-8"?>
<geogebra format="4.4" version="4.4.0.0" id="d895bbbf-1aa2-4338-b3e5-6d07ea7a127a" xsi:noNamespaceSchemaLocation="http://www.geogebra.org/ggb.xsd" xmlns="" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" >
<gui>
<window width="821" height="642" />
<perspectives>
<perspective id="tmp">
<panes>
<pane location="" divider="0.243605359317905" orientation="1" />
</panes>
<views>
<view id="4097" visible="false" inframe="true" stylebar="true" location="1,1,1" size="400" window="965,53,700,806" />
<view id="4" toolbar="0 59 || 2020 , 2021 , 2022 , 66 || 2001 , 2003 , 2002 , 2004 , 2005 || 2040 , 2041 , 2042 , 2044 , 2043" visible="false" inframe="false" stylebar="false" location="1,1" size="300" window="100,100,600,400" />
<view id="8" toolbar="1001 | 1002 | 1003 || 1005 | 1004 || 1006 | 1007 | 1010 | 1011 || 1008 1009 || 6" visible="false" inframe="false" stylebar="false" location="1,3" size="300" window="100,100,600,400" />
<view id="1" visible="true" inframe="false" stylebar="true" location="1" size="810" window="100,100,600,400" />
<view id="2" visible="false" inframe="true" stylebar="true" location="3" size="200" window="606,257,250,592" />
<view id="16" visible="false" inframe="false" stylebar="false" location="1" size="150" window="50,50,500,500" />
<view id="32" visible="false" inframe="false" stylebar="true" location="1" size="150" window="50,50,500,500" />
<view id="64" visible="false" inframe="true" stylebar="true" location="1" size="150" 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" />
</views>
<toolbar show="true" items="0 39 59 | 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 66 68 | 25 52 60 61 | 40 41 42 , 27 28 35 , 6" position="1" help="false" />
<input show="true" cmd="true" top="false" />
<dockBar show="true" east="true" />
</perspective>
</perspectives>
<labelingStyle val="3"/>
<font size="12"/>
<graphicsSettings javaLatexFonts="false"/>
</gui>
<euclidianView>
<size width="810" height="505"/>
<coordSystem xZero="147.69092919437617" yZero="226.31471345394417" scale="22.631013934168678" yscale="22.631013934168696"/>
<evSettings axes="false" grid="false" gridIsBold="false" pointCapturing="3" 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="1" grid="10"/>
<axis id="0" show="false" label="" unitLabel="" tickStyle="1" showNumbers="true"/>
<axis id="1" show="false" label="" unitLabel="" tickStyle="1" showNumbers="true"/>
</euclidianView>
<kernel>
<continuous val="false"/>
<usePathAndRegionParameters val="true"/>
<decimals val="2"/>
<angleUnit val="degree"/>
<algebraStyle val="0"/>
<coordStyle val="0"/>
<angleFromInvTrig val="false"/>
</kernel>
<scripting language="zh" blocked="false" disabled="false"/>
<construction title="" author="" date="">
<element type="numeric" label="pad">
<value val="0.05"/>
<show object="false" label="true"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
<layer val="0"/>
<labelMode val="1"/>
<animation step="1" speed="1" type="0" playing="false"/>
</element>
<element type="numeric" label="maxNum">
<value val="5.0"/>
<show object="false" label="true"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
<layer val="0"/>
<labelMode val="1"/>
<slider min="1" max="20" absoluteScreenLocation="true" width="200.0" x="0.0" y="0.0" fixed="false" horizontal="true"/>
<lineStyle thickness="10" type="0" typeHidden="1"/>
<animation step="1" speed="1" type="0" playing="false"/>
<javascript onUpdate="resample();"/>
</element>
<command name="Corner">
<input a0="5"/>
<output a0="Pixels"/>
</command>
<element type="point" label="Pixels">
<show object="false" label="true"/>
<objColor r="68" g="68" b="68" alpha="0.0"/>
<layer val="0"/>
<labelMode val="0"/>
<coords x="810.0" y="505.0" z="1.0"/>
<pointSize val="3"/>
<pointStyle val="0"/>
</element>
<command name="Sequence">
<input a0="k" a1="k" a2="0" a3="maxNum"/>
<output a0="numbers"/>
</command>
<element type="list" label="numbers">
<objColor r="0" g="100" b="0" alpha="0.1"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<pointSize val="3"/>
<pointStyle val="-1"/>
</element>
<command name="LaTeX">
<input a0="numbers" a1="true" a2="false"/>
<output a0="txtMaxNum"/>
</command>
<element type="text" label="txtMaxNum">
<show object="true" label="false"/>
<objColor r="0" g="0" b="255" alpha="0.0"/>
<layer val="0"/>
<labelMode val="0"/>
<selectionAllowed val="false"/>
<isLaTeX val="true"/>
<font serif="true" sizeM="1.4" size="5" style="0"/>
<absoluteScreenLocation x="161" y="9"/>
</element>
<element type="numeric" label="numVar">
<value val="12.0"/>
<show object="false" label="true"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
<layer val="0"/>
<labelMode val="1"/>
<slider min="2" max="50" absoluteScreenLocation="true" width="200.0" x="0.0" y="0.0" fixed="false" horizontal="true"/>
<lineStyle thickness="10" type="0" typeHidden="1"/>
<animation step="1" speed="1" type="0" playing="false"/>
<javascript onUpdate="resample();"/>
</element>
<element type="numeric" label="times">
<value val="500.0"/>
<show object="false" label="true"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
<layer val="0"/>
<labelMode val="1"/>
<slider min="10" max="2000" absoluteScreenLocation="true" width="200.0" x="0.0" y="0.0" fixed="false" horizontal="true"/>
<lineStyle thickness="10" type="0" typeHidden="1"/>
<animation step="1" speed="1" type="0" playing="false"/>
<javascript onUpdate="resample();"/>
</element>
<expression label="winW" exp="x(Corner[2] - Corner[1])" />
<element type="numeric" label="winW">
<value val="35.879965535880345"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
</element>
<expression label="winH" exp="y(Corner[4] - Corner[1])" />
<element type="numeric" label="winH">
<value val="22.402884885087836"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
</element>
<expression label="pixelsPerUnitX" exp="x(Pixels) / winW" />
<element type="numeric" label="pixelsPerUnitX">
<value val="22.57527252053772"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
</element>
<expression label="pixelsPerUnitY" exp="y(Pixels) / winH" />
<element type="numeric" label="pixelsPerUnitY">
<value val="22.541739717465855"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
</element>
<expression label="unitsPerPixelX" exp="1 / pixelsPerUnitX" />
<element type="numeric" label="unitsPerPixelX">
<value val="0.044296253748000426"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
</element>
<expression label="unitsPerPixelY" exp="1 / pixelsPerUnitY" />
<element type="numeric" label="unitsPerPixelY">
<value val="0.04436214828730265"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
</element>
<expression label="padPixels" exp="(pad * x(Pixels))" />
<element type="numeric" label="padPixels">
<value val="40.5"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
</element>
<expression label="A" exp="Corner[1] + (padPixels * (unitsPerPixelX, unitsPerPixelY))" type="point" />
<element type="point" label="A">
<show object="false" label="true"/>
<objColor r="68" g="68" b="68" alpha="0.0"/>
<layer val="0"/>
<labelMode val="0"/>
<coords x="-4.776230066792487" y="-10.56182861279441" z="1.0"/>
<pointSize val="3"/>
<pointStyle val="0"/>
</element>
<expression label="B" exp="Corner[1] + (((x(Pixels) - padPixels) * unitsPerPixelX), (padPixels * unitsPerPixelY))" type="point" />
<element type="point" label="B">
<show object="false" label="true"/>
<objColor r="68" g="68" b="68" alpha="0.0"/>
<layer val="0"/>
<labelMode val="0"/>
<coords x="27.515738915499828" y="-10.56182861279441" z="1.0"/>
<pointSize val="3"/>
<pointStyle val="0"/>
</element>
<expression label="C" exp="Corner[1] + (((x(Pixels) - padPixels) * unitsPerPixelX), ((y(Pixels) - padPixels) * unitsPerPixelY))" type="point" />
<element type="point" label="C">
<show object="false" label="true"/>
<objColor r="68" g="68" b="68" alpha="0.0"/>
<layer val="0"/>
<labelMode val="0"/>
<coords x="27.515738915499828" y="8.247722261021915" z="1.0"/>
<pointSize val="3"/>
<pointStyle val="0"/>
</element>
<expression label="D" exp="Corner[1] + ((padPixels * unitsPerPixelX), ((y(Pixels) - padPixels) * unitsPerPixelY))" type="point" />
<element type="point" label="D">
<show object="false" label="true"/>
<objColor r="68" g="68" b="68" alpha="0.0"/>
<layer val="0"/>
<labelMode val="0"/>
<coords x="-4.776230066792487" y="8.247722261021915" z="1.0"/>
<pointSize val="3"/>
<pointStyle val="0"/>
</element>
<expression label="figW" exp="x(B - A)" />
<element type="numeric" label="figW">
<value val="32.29196898229232"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
</element>
<expression label="figH" exp="y(D - A)" />
<element type="numeric" label="figH">
<value val="18.809550873816324"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
</element>
<expression label="E" exp="A + (0, (padPixels * unitsPerPixelY))" type="point" />
<element type="point" label="E">
<show object="false" label="true"/>
<objColor r="68" g="68" b="68" alpha="0.0"/>
<layer val="0"/>
<labelMode val="0"/>
<coords x="-4.776230066792487" y="-8.765161607158651" z="1.0"/>
<pointSize val="3"/>
<pointStyle val="0"/>
</element>
<expression label="F" exp="B + (0, (padPixels * unitsPerPixelY))" type="point" />
<element type="point" label="F">
<show object="false" label="true"/>
<objColor r="68" g="68" b="68" alpha="0.0"/>
<layer val="0"/>
<labelMode val="0"/>
<coords x="27.515738915499828" y="-8.765161607158651" z="1.0"/>
<pointSize val="3"/>
<pointStyle val="0"/>
</element>
<expression label="maxX" exp="(maxNum * numVar)" />
<element type="numeric" label="maxX">
<value val="60.0"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
</element>
<expression label="dW" exp="figW / (maxX + 1)" />
<element type="numeric" label="dW">
<value val="0.5293765406933166"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
</element>
<command name="Sequence">
<input a0="E + (dW / 2 + (k * dW), 0)" a1="k" a2="0" a3="maxX"/>
<output a0="ticksX"/>
</command>
<element type="list" label="ticksX">
<show object="false" label="false"/>
<objColor r="0" g="100" b="0" alpha="0.0"/>
<layer val="0"/>
<labelMode val="0"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<pointSize val="3"/>
<pointStyle val="-1"/>
</element>
<element type="button" label="run">
<show object="true" label="false"/>
<objColor r="255" g="102" b="153" alpha="1.0"/>
<bgColor r="255" g="102" b="153" alpha="255"/>
<layer val="0"/>
<labelOffset x="127" y="133"/>
<labelMode val="0"/>
<animation step="1" speed="1" type="0" playing="false"/>
<auxiliary val="true"/>
<javascript val="resample();"/>
<font serif="false" sizeM="2.0" size="12" style="0"/>
<file name="/geogebra/main/nav_play.png"/>
</element>
<expression label ="sample" exp="{0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 1, 4, 9, 5, 9, 9, 16, 14, 19, 21, 29, 26, 37, 36, 22, 23, 49, 24, 26, 17, 23, 24, 13, 13, 6, 6, 4, 3, 2, 2, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}"/>
<element type="list" label="sample">
<objColor r="0" g="100" b="0" alpha="0.1"/>
<animation step="1" speed="1" type="0" playing="false"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<pointSize val="3"/>
<pointStyle val="-1"/>
</element>
<element type="numeric" label="maxFreq">
<value val="49.0"/>
<show object="false" label="true"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
<layer val="0"/>
<labelMode val="1"/>
<animation step="1" speed="1" type="0" playing="false"/>
</element>
<expression label="maxH" exp="((y(Pixels) - (4 * padPixels)) * unitsPerPixelY)" />
<element type="numeric" label="maxH">
<value val="15.21621686254481"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
</element>
<command name="Sequence">
<input a0="Element[ticksX, k] + (0, (Element[sample, k] * maxH / maxFreq))" a1="k" a2="1" a3="maxX + 1"/>
<output a0="ticksY"/>
</command>
<element type="list" label="ticksY">
<show object="false" label="false"/>
<objColor r="0" g="0" b="255" alpha="0.0"/>
<layer val="2"/>
<labelMode val="0"/>
<selectionAllowed val="false"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<pointSize val="4"/>
<pointStyle val="0"/>
</element>
<command name="Sequence">
<input a0="Segment[Element[ticksX, k], Element[ticksY, k]]" a1="k" a2="1" a3="maxX + 1"/>
<output a0="poles"/>
</command>
<element type="list" label="poles">
<show object="true" label="false"/>
<objColor r="125" g="125" b="255" alpha="0.0"/>
<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="Textfield">
<input a0="times"/>
<output a0="inSampleSize"/>
</command>
<element type="textfield" label="inSampleSize">
<show object="true" label="true"/>
<objColor r="0" g="0" b="0" alpha="0.0"/>
<layer val="0"/>
<labelOffset x="47" y="92"/>
<labelMode val="0"/>
<animation step="1" speed="1" type="0" playing="false"/>
<auxiliary val="true"/>
<linkedGeo exp="times"/>
<length val="3"/>
<caption val="丟擲次數:"/>
</element>
<command name="Textfield">
<input a0="maxNum"/>
<output a0="inMaxNum"/>
</command>
<element type="textfield" label="inMaxNum">
<show object="true" label="true"/>
<objColor r="0" g="0" b="0" alpha="0.0"/>
<layer val="0"/>
<labelOffset x="47" y="12"/>
<labelMode val="0"/>
<animation step="1" speed="1" type="0" playing="false"/>
<auxiliary val="true"/>
<linkedGeo exp="maxNum"/>
<length val="3"/>
<caption val="骰子點數:"/>
</element>
<command name="Textfield">
<input a0="numVar"/>
<output a0="inNumVar"/>
</command>
<element type="textfield" label="inNumVar">
<show object="true" label="true"/>
<objColor r="0" g="0" b="0" alpha="0.0"/>
<layer val="0"/>
<labelOffset x="47" y="52"/>
<labelMode val="0"/>
<animation step="1" speed="1" type="0" playing="false"/>
<auxiliary val="true"/>
<linkedGeo exp="numVar"/>
<length val="3"/>
<caption val="骰子個數:"/>
</element>
<command name="Segment">
<input a0="E" a1="F"/>
<output a0="segX"/>
</command>
<element type="segment" label="segX">
<show object="true" label="false"/>
<objColor r="0" g="0" b="0" alpha="0.0"/>
<layer val="1"/>
<labelMode val="0"/>
<selectionAllowed val="false"/>
<coords x="0.0" y="32.29196898229232" z="283.04432674314666"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<outlyingIntersections val="false"/>
<keepTypeOnTransform val="true"/>
</element>
<command name="Sequence">
<input a0=""X_{" + (k) + "}"" a1="k" a2="1" a3="numVar"/>
<output a0="strVars"/>
</command>
<element type="list" label="strVars">
<show object="false" label="false"/>
<objColor r="0" g="100" b="0" alpha="0.0"/>
<layer val="1"/>
<labelMode val="0"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<pointSize val="3"/>
<pointStyle val="-1"/>
</element>
<expression label="strRV" exp=""X=X_1" + (Sum[Sequence["+" + (Element[strVars, k]), k, 2, numVar]])" />
<element type="text" label="strRV">
<show object="false" label="false"/>
<objColor r="0" g="0" b="0" alpha="0.0"/>
<layer val="1"/>
<labelMode val="0"/>
<startPoint x="12.637925620018397" y="-4.014139039917159" z="1.0"/>
</element>
<expression label="text1" exp=""" + (LaTeX[strRV]) + """ />
<element type="text" label="text1">
<show object="true" label="false"/>
<objColor r="255" g="0" b="0" alpha="0.0"/>
<layer val="1"/>
<labelMode val="0"/>
<selectionAllowed val="false"/>
<isLaTeX val="true"/>
<font serif="true" sizeM="1.4" size="5" style="0"/>
<absoluteScreenLocation x="165" y="48"/>
</element>
<element type="point" label="OffPixels">
<show object="false" label="true"/>
<objColor r="0" g="0" b="255" alpha="0.0"/>
<layer val="1"/>
<labelMode val="0"/>
<animation step="0.1" speed="1" type="1" playing="false"/>
<coords x="-5.0" y="-20.0" z="1.0"/>
<pointSize val="3"/>
<pointStyle val="0"/>
</element>
<element type="numeric" label="switch">
<value val="1.0"/>
<show object="true" label="false"/>
<objColor r="102" g="153" b="0" alpha="0.1"/>
<layer val="1"/>
<labelMode val="1"/>
<slider min="0" max="1" absoluteScreenLocation="true" width="30.0" x="53.0" y="150.0" fixed="false" horizontal="true"/>
<lineStyle thickness="10" type="0" typeHidden="1"/>
<animation step="1" speed="1" type="0" playing="false"/>
<javascript onUpdate="resample();"/>
</element>
<command name="Max">
<input a0="1" a1="ceil(maxX / 30)"/>
<output a0="padX"/>
</command>
<element type="numeric" label="padX">
<value val="2.0"/>
<objColor r="0" g="0" b="0" alpha="0.1"/>
</element>
<command name="Sequence">
<input a0="Text[k - 1, Element[ticksX, k] + ((x(OffPixels) * unitsPerPixelX), (y(OffPixels) * unitsPerPixelY))]" a1="k" a2="1" a3="maxX + 1" a4="padX"/>
<output a0="txtX"/>
</command>
<element type="list" label="txtX">
<show object="true" label="false"/>
<objColor r="255" g="0" b="0" alpha="0.0"/>
<layer val="1"/>
<labelMode val="0"/>
<selectionAllowed val="false"/>
<lineStyle thickness="2" type="0" typeHidden="1"/>
<pointSize val="3"/>
<pointStyle val="-1"/>
</element>
</construction>
</geogebra>