» 蒙特卡罗估计 Pi

蒙特卡罗估计 Pi

1950
Classroom demonstration of Monte Carlo method for estimating Pi in numerical analysis.

A classic illustration of the Monte Carlo method is estimating the value of [latex]\pi[/latex]. By inscribing a circle of radius [latex]r[/latex] within a square of side length [latex]2r[/latex], the ratio of their areas is [latex]\frac{\pi r^2}{(2r)^2} = \frac{\pi}{4}[/latex]. Randomly scattering points within the square and counting the fraction [latex]p[/latex] that fall inside the circle provides an estimate: [latex]\pi \approx 4p[/latex].

The procedure for estimating [乳胶]\pi[/latex] is straightforward and highlights the core Monte Carlo principle. Consider a unit square in the Cartesian plane with vertices at (0,0), (1,0), (1,1), and (0,1). A quarter circle of radius 1 is inscribed within this square, centered at the origin. The area of the square is 1, and the area of the quarter circle is [latex]\frac{\pi(1)^2}{4} = \frac{\pi}{4}[/latex]. The ratio of the quarter circle’s area to the square’s area is therefore [latex]\frac{\pi}{4}[/latex].

To estimate this ratio, we generate a large number, [latex]N[/latex], of random points [latex](x, y)[/latex] where both [latex]x[/latex] and [latex]y[/latex] are uniformly distributed between 0 and 1. Each point has an equal chance of landing anywhere within the square. A point [latex](x, y)[/latex] falls inside the quarter circle if its distance from the origin is less than or equal to 1, which is determined by the condition [latex]x^2 + y^2 \le 1[/latex]. We count the number of points, [latex]M[/latex], that satisfy this condition. The ratio [latex]\frac{M}{N}[/latex] is an estimate of the ratio of the areas, [latex]\frac{\pi}{4}[/latex]. Therefore, we can approximate [latex]\pi[/latex] as [latex]\pi \approx 4 \frac{M}{N}[/latex]. According to the law of large numbers, as [latex]N[/latex] approaches infinity, this approximation converges to the true value of [latex]\pi[/latex]. However, the convergence is slow, with the error decreasing proportionally to [latex]\frac{1}{\sqrt{N}}[/latex], making it a very inefficient 方法 for calculating [latex]\pi[/latex] to high precision compared to deterministic algorithms.

UNESCO Nomenclature: 1202
– Computer sciences

类型

软件/算法

中断

递增

使用方法

广泛使用

前体

  • concept of pi as the ratio of a circle’s circumference to its diameter
  • cartesian coordinate system
  • 勾股定理
  • 均匀概率分布
  • 伪随机数生成器的开发

应用

  • 用于教授概率和模拟的教学工具
  • 随机数生成器的简单基准
  • 计算科学课程的入门问题

专利:

NA

潜在的创新想法

级别需要会员

您必须是!!等级!!会员才能访问此内容。

立即加入

已经是会员? 在此登录
Related to: pi, estimation, Monte Carlo, simulation, random numbers, area, probability, numerical integration, circle, square.

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

迎接新挑战
机械工程师、项目、工艺工程师或研发经理
有效的产品开发

可在短时间内接受新的挑战。
通过 LinkedIn 联系我
塑料金属电子集成、成本设计、GMP、人体工程学、中高容量设备和耗材、精益制造、受监管行业、CE 和 FDA、CAD、Solidworks、精益西格玛黑带、医疗 ISO 13485

我们正在寻找新的赞助商

 

您的公司或机构从事技术、科学或研究吗?
> 给我们发送消息 <

接收所有新文章
免费,无垃圾邮件,电子邮件不分发也不转售

或者您可以免费获得完整会员资格以访问所有受限制的内容>这里<

历史背景

(如果日期不详或不相关,例如 "流体力学",则对其显著出现的时间作了四舍五入的估计)。

相关发明、创新和技术原理

滚动至顶部

你可能还喜欢