Account Options

  1. Sign in
The old Google Groups will be going away soon.
Switch to the new Google Groups.
Google Groups Home
« Groups Home
080108统计模拟法计算pai的近似值.xls
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  5 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
forcode(奇想录)  
View profile   Translate to Translated (View Original)
 More options Jan 7 2008, 11:25 am
From: "forcode(奇想录)" <woodph...@gmail.com>
Date: Tue, 8 Jan 2008 00:25:38 +0800
Local: Mon, Jan 7 2008 11:25 am
Subject: 080108统计模拟法计算pai的近似值.xls

前天在广州图书馆看ross的《统计模拟》里的一个例题,今天按照回忆在excel里弄出来了计算pai值的办法,可见模拟法还是挺有用的。
原理很简单:
一个边长为2的正方形,面积也就是4,中间有一个半径为1的圆,按照公式,圆的面积是pai,那么,模拟正方形内N个均匀分布的随机点,如果落在圆内就编码为1 ,如果落在圆外的正方形内,就编码为0,然后所有编码值加起来除以N,就是圆的面积占正方形的面积的近似比例,也等于pai/4,这样,N越大,算出来的pai 值越精确,我模拟了1000个点,
刚好算出来pai值等于3.14,
因为我将这1000个随机点距离圆心的距离排序之后,第785个值开始大于1,意味着786之后的点都落在圆外,785×4/1000=3.14
。如果模拟更多的点,就可以得到更加精确的pai值。
附件里是excel表格,有兴趣可以看看。
我今天从图书馆借了《复杂系统建模与仿真》这本书,寒假好好看看。

  080108统计模拟法计算pai的近似值.xls
313K Download

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
曹政  
View profile   Translate to Translated (View Original)
 More options Jan 7 2008, 11:37 am
From: "曹政" <johnofch...@gmail.com>
Date: Tue, 8 Jan 2008 00:37:40 +0800
Local: Mon, Jan 7 2008 11:37 am
Subject: Re: 080108统计模拟法计算pai的近似值.xls

吴兄,信都已收到,非常感谢!关于excel的分析,看到了3.14,却不知是如何每一个点的概率的,请指教,谢谢!

在08-1-8,forcode(奇想录) <woodph...@gmail.com> 写道:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
forcode(奇想录)  
View profile   Translate to Translated (View Original)
 More options Jan 7 2008, 11:46 am
From: "forcode(奇想录)" <woodph...@gmail.com>
Date: Tue, 8 Jan 2008 00:46:14 +0800
Local: Mon, Jan 7 2008 11:46 am
Subject: Re: 080108统计模拟法计算pai的近似值.xls

你看我每列的公式就知道了。
A这列用:=rand()生成了1000个0~1之间的随机数
B这格用:=2*$a1生成了1000个0~2之间的随机数
C这格用:=$b1-1生成了1000个-1~+1之间的随机数,用于模拟随机点的X坐标
D格同C类似,用于模拟随机点的Y坐标
然后E格用X、Y坐标来计算该点距离圆心的距离。
然后F格排序,计算距离圆心小于1的点(也就是落在圆内的点)的数量,也就是圆的面积与正方形面积的近似比例。

On Jan 8, 2008 12:37 AM, 曹政 <johnofch...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
曹政  
View profile   Translate to Translated (View Original)
 More options Jan 7 2008, 11:51 am
From: "曹政" <johnofch...@gmail.com>
Date: Tue, 8 Jan 2008 00:51:24 +0800
Local: Mon, Jan 7 2008 11:51 am
Subject: Re: 080108统计模拟法计算pai的近似值.xls

这些都看到了,就是rand(),2*$a1,$b1-1不太清楚是什么意思,呵呵


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Hu, Jiangtang  
View profile   Translate to Translated (View Original)
 More options Jan 7 2008, 9:58 pm
From: "Hu, Jiangtang" <jiangtan...@gmail.com>
Date: Tue, 8 Jan 2008 10:58:00 +0800
Subject: Re: 080108统计模拟法计算pai的近似值.xls

这就是传说中的蒙特卡罗模拟了。

On Jan 8, 2008 12:25 AM, forcode(奇想录) <woodph...@gmail.com> wrote:

> 前天在广州图书馆看ross的《统计模拟》里的一个例题,今天按照回忆在excel里弄出来了计算pai值的办法,可见模拟法还是挺有用的。
> 原理很简单:
> 一个边长为2的正方形,面积也就是4,中间有一个半径为1的圆,按照公式,圆的面积是pai,那么,模拟正方形内N个均匀分布的随机点,如果落在圆内就编码为1 ,如果落在圆外的正方形内,就编码为0,然后所有编码值加起来除以N,就是圆的面积占正方形的面积的近似比例,也等于pai/4,这样,N越大,算出来的pai 值越精确,我模拟了1000个点,
> 刚好算出来pai值等于3.14,
> 因为我将这1000个随机点距离圆心的距离排序之后,第785个值开始大于1,意味着786之后的点都落在圆外,785×4/1000=3.14
> 。如果模拟更多的点,就可以得到更加精确的pai值。
> 附件里是excel表格,有兴趣可以看看。
> 我今天从图书馆借了《复杂系统建模与仿真》这本书,寒假好好看看。

--
胡江堂
北京大学软件与微电子学院06硕
生活博客(读书、见闻): http://panshanghu.spaces.live.com/
技术博客(数据挖掘、金融计算、SAS、etc.): http://johnthu.spaces.live.com/

 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »