高尔顿钉板试验模拟_第1页
高尔顿钉板试验模拟_第2页
高尔顿钉板试验模拟_第3页
高尔顿钉板试验模拟_第4页
高尔顿钉板试验模拟_第5页
已阅读5页,还剩4页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

1、X高尔顿钉板试验模拟(程序).这是我2005年12的课程设计中程序的核心部分,写完后自己非常得意,等着老师表扬。等啊等, 等待现在也没等到:em16:现将它献给大家.(若有版权那遵守BSD吧)注1:程序以前是用Matlab写的现用Java重写注2:原程序中galton返回值为int grid、没有输出结果”部分public void galton(int sumOfGrid, int sumOfBall)int grid = new intsumOfGrid;int number = 0;一个小球从顶端落下过程中向右偏移的总次数int rand ;/随机数,取值范围为0,1,为0、为1的概率相

2、等for( int counter_ball = 1; counter_ball = sumOfBall; counter_ball+ )/ (sumOfGrid - 1)为钉板的层数for( int times = 1; times = ( sumOfGrid - 1 ); times+ )rand = (int)( Math.random()*2 );number += rand;gridnumber+;number = 0;/输出结果System.out.println(小球的总数为+sumOfBall+t 格子的个数为+sumOfGrid );for( int index = 0; i

3、ndex grid.length; index+ )System.out.println( (index+1)+号格子中的小球数为:t+gridindex);/end of metod galton补充:(谢谢2楼提醒:-D )高尔顿钉板试验:自板上端放入一小球,任其自由落下.在下落过程中,当小球碰到钉子时,从左边落 下与从右边落下的机会相等.碰到下一排钉子也是如此.自板上端放入n(n自行输入)个小球,观察小球 落下后呈现曲线并统计小球落入各个格子的频率.1 I . 4.1 .I ,., .i .ri. * 44 . a.1 1.* 9 0(Po % IooooOo% ooo钉子小球格子In高

4、尔顿钉板试验可见概率论(复旦大学李贤平)当小球数量少时分布无明显特征,当小球数量多时(100)分布近似正态分布。(即两边对称:-D) 当时为了证明服从正态分布投1千万个小球(计算机模拟:-D)Galton BoardThe Galton board, also known as a quincunx or bean machine, is a device for statistical experiments named after English scientist Sir Francis Galton. It consists of an upright board with evenl

5、y spaced nails (or pegs) driven into its upper half, where the nails are arranged in staggered order, and a lower half divided into a number of evenly-spaced rectangular slots. The front of the device is covered with a glass cover to allow viewing of both nails and slots. In the middle of the upper

6、edge, there is a funnel into which balls can be poured, where the diameter of the balls must be much smaller than the distance between the nails. The funnel is located precisely above the central nail of the second row so that each ball, if perfectly centered, would fall vertically and directly onto

7、 the uppermost point of this nails surface (Kozlov and Mitrofanova 2002). The figure above shows a variant of the board in which only the nails that can potentially be hit by a ball dropped from the funnel are included, leading to a triangular array instead of a rectangular one.Each time a ball hits one of the nails, it can bounce right (or left) with some probability p ( and q = 1 - p ).For symmetrically placed nails, balls will bounce left or right with equal probability, so p = q = 1/2. If the rows are numbered from 0 to N -1, he path of each falling ball is a Bernoulli trial consi

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论