20
Monte Carlo模拟 1. 引言(introduction) 2. 均匀随机数的产生(Random number generation) 3. 任意分布的随机变量的抽样 4. Monte Carlo积分法 5. 常用Monte Carlo模拟软件的使用 2013/3/1 1 Monte Carlo模拟

蒙特卡罗方法 (Monte Carlo simulation)hepg.sdu.edu.cn/~zhangxy/Education/MonteCarlo/2013/ch01/... · 2014-03-31 · 1.Monte Carlo方法 2013/3/1 Monte Carlo模拟 3 •Monte

  • Upload
    others

  • View
    4

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 蒙特卡罗方法 (Monte Carlo simulation)hepg.sdu.edu.cn/~zhangxy/Education/MonteCarlo/2013/ch01/... · 2014-03-31 · 1.Monte Carlo方法 2013/3/1 Monte Carlo模拟 3 •Monte

Monte Carlo模拟

1. 引言(introduction)

2. 均匀随机数的产生(Random number generation)

3. 任意分布的随机变量的抽样

4. Monte Carlo积分法

5. 常用Monte Carlo模拟软件的使用

2013/3/1 1Monte Carlo模拟

Page 2: 蒙特卡罗方法 (Monte Carlo simulation)hepg.sdu.edu.cn/~zhangxy/Education/MonteCarlo/2013/ch01/... · 2014-03-31 · 1.Monte Carlo方法 2013/3/1 Monte Carlo模拟 3 •Monte

Monte Carlo模拟

第一章 引言

(Introduction)

1. Monte Carlo方法2. Monte Carlo方法简史3. Monte Carlo模拟的应用4. Monte Carlo算法的主要组成部分

2013/3/1 2Monte Carlo模拟

Page 3: 蒙特卡罗方法 (Monte Carlo simulation)hepg.sdu.edu.cn/~zhangxy/Education/MonteCarlo/2013/ch01/... · 2014-03-31 · 1.Monte Carlo方法 2013/3/1 Monte Carlo模拟 3 •Monte

1.Monte Carlo方法

2013/3/1 3Monte Carlo模拟

•Monte Carlo方法:

亦称统计模拟方法(statistical simulation method)

一种采用统计抽样理论近似地求解物理或数学问题的方法

Page 4: 蒙特卡罗方法 (Monte Carlo simulation)hepg.sdu.edu.cn/~zhangxy/Education/MonteCarlo/2013/ch01/... · 2014-03-31 · 1.Monte Carlo方法 2013/3/1 Monte Carlo模拟 3 •Monte

1.Monte Carlo方法

2013/3/1 4Monte Carlo模拟

•基本思想:

1. 建立与待解问题相似或相关联的概率模型或概率过程,利用这种相似性把概率模型的某些特征量与待求解问题的解联系起来:

概率模型: 待求解问题的解:

随机事件的概率 定积分的值

随机变量的数学期望值 微分方程的解

2. 对概率模型进行随机模拟或统计抽样,用所得样本得到这些特征量的估计值问题的近似解

Page 5: 蒙特卡罗方法 (Monte Carlo simulation)hepg.sdu.edu.cn/~zhangxy/Education/MonteCarlo/2013/ch01/... · 2014-03-31 · 1.Monte Carlo方法 2013/3/1 Monte Carlo模拟 3 •Monte

Monte Carlo模拟

第一章 引言

(Introduction)

1. Monte Carlo方法2. Monte Carlo方法简史3. Monte Carlo模拟的应用4. Monte Carlo算法的主要组成部分

2013/3/1 5Monte Carlo模拟

Page 6: 蒙特卡罗方法 (Monte Carlo simulation)hepg.sdu.edu.cn/~zhangxy/Education/MonteCarlo/2013/ch01/... · 2014-03-31 · 1.Monte Carlo方法 2013/3/1 Monte Carlo模拟 3 •Monte

2.Monte Carlo方法简史

2013/3/1 6Monte Carlo模拟

Buffon投针实验

1768年,法国数学家Comte de Buffon利用投针实验估计的值

dL

p

2

d

L

Page 7: 蒙特卡罗方法 (Monte Carlo simulation)hepg.sdu.edu.cn/~zhangxy/Education/MonteCarlo/2013/ch01/... · 2014-03-31 · 1.Monte Carlo方法 2013/3/1 Monte Carlo模拟 3 •Monte

2.Monte Carlo方法简史

2013/3/1 7Monte Carlo模拟

Problem of Buffon’s needle:

If a needle of length l is dropped at random on the middle of a horizontal surface ruled with parallel lines a distance d > l apart, what is the probability that the needle will cross one of the lines?

Page 8: 蒙特卡罗方法 (Monte Carlo simulation)hepg.sdu.edu.cn/~zhangxy/Education/MonteCarlo/2013/ch01/... · 2014-03-31 · 1.Monte Carlo方法 2013/3/1 Monte Carlo模拟 3 •Monte

2.Monte Carlo方法简史

2013/3/1 8Monte Carlo模拟

Solution:

• The positioning of the needle relative to nearby lines can be described with a random vector which has components:

),0[

),0[

dA

• The random vector is uniformly distributed on the region [0,d)×[0,). Accordingly, it has probability density function 1/d.

• The probability that the needle will cross one of the lines is given by the integral

d

ldAdp

l

d

2

0

sin

0

1

Page 9: 蒙特卡罗方法 (Monte Carlo simulation)hepg.sdu.edu.cn/~zhangxy/Education/MonteCarlo/2013/ch01/... · 2014-03-31 · 1.Monte Carlo方法 2013/3/1 Monte Carlo模拟 3 •Monte

2.Monte Carlo方法简史

2013/3/1 9Monte Carlo模拟

• 1930年,利用Monte Carlo方法研究中子的扩散

Enrico Fermi

• 并设计了一个Monte Carlo机械装置,Fermiac,用于计算核反应堆的临界状态

Page 10: 蒙特卡罗方法 (Monte Carlo simulation)hepg.sdu.edu.cn/~zhangxy/Education/MonteCarlo/2013/ch01/... · 2014-03-31 · 1.Monte Carlo方法 2013/3/1 Monte Carlo模拟 3 •Monte

2.Monte Carlo方法简史

2013/3/1 10Monte Carlo模拟

Stanislaw Ulam (1909-1984)

S. Ulam is credited as the inventor of Monte Carlo method in 1940s, which solves mathematical problems using statistical sampling.

Page 11: 蒙特卡罗方法 (Monte Carlo simulation)hepg.sdu.edu.cn/~zhangxy/Education/MonteCarlo/2013/ch01/... · 2014-03-31 · 1.Monte Carlo方法 2013/3/1 Monte Carlo模拟 3 •Monte

2.Monte Carlo方法简史

2013/3/1 11Monte Carlo模拟

Nicholas Metropolis (1915-1999)

The algorithm by Metropolis (and A Rosenbluth, M Rosenbluth, A Teller and E Teller, 1953) has been cited as among the top 10 algorithms having the "greatest influence on the development and practice of science and engineering in the 20th century."

Page 12: 蒙特卡罗方法 (Monte Carlo simulation)hepg.sdu.edu.cn/~zhangxy/Education/MonteCarlo/2013/ch01/... · 2014-03-31 · 1.Monte Carlo方法 2013/3/1 Monte Carlo模拟 3 •Monte

2.Monte Carlo方法简史

2013/3/1 12Monte Carlo模拟

Metropolis coined the name “Monte Carlo”, from its gambling Casino.

Monte-Carlo, Monaco

The Name of the Game

Page 13: 蒙特卡罗方法 (Monte Carlo simulation)hepg.sdu.edu.cn/~zhangxy/Education/MonteCarlo/2013/ch01/... · 2014-03-31 · 1.Monte Carlo方法 2013/3/1 Monte Carlo模拟 3 •Monte

Monte Carlo模拟

第一章 引言

(Introduction)

1. Monte Carlo方法2. Monte Carlo方法简史3. Monte Carlo模拟的应用4. Monte Carlo算法的主要组成部分

2013/3/1 13Monte Carlo模拟

Page 14: 蒙特卡罗方法 (Monte Carlo simulation)hepg.sdu.edu.cn/~zhangxy/Education/MonteCarlo/2013/ch01/... · 2014-03-31 · 1.Monte Carlo方法 2013/3/1 Monte Carlo模拟 3 •Monte

3.Monte Carlo模拟的应用

2013/3/1 14Monte Carlo模拟

Monte Carlo模拟的应用:

自然现象的模拟:

宇宙射线在地球大气中的传输过程;

高能物理实验中的核相互作用过程;

实验探测器的模拟

数值分析:

利用Monte Carlo方法求积分

Page 15: 蒙特卡罗方法 (Monte Carlo simulation)hepg.sdu.edu.cn/~zhangxy/Education/MonteCarlo/2013/ch01/... · 2014-03-31 · 1.Monte Carlo方法 2013/3/1 Monte Carlo模拟 3 •Monte

3.Monte Carlo模拟的应用

2013/3/1 15Monte Carlo模拟

Monte Carlo模拟在物理研究中的作用

Page 16: 蒙特卡罗方法 (Monte Carlo simulation)hepg.sdu.edu.cn/~zhangxy/Education/MonteCarlo/2013/ch01/... · 2014-03-31 · 1.Monte Carlo方法 2013/3/1 Monte Carlo模拟 3 •Monte

3.Monte Carlo模拟的应用

2013/3/1 16Monte Carlo模拟

注意以下两点:

Monte Carlo方法与数值解法的不同:

Monte Carlo方法利用随机抽样的方法来求解物理问题;

数值解法:从一个物理系统的数学模型出发,通过求解一系列的微分方程来的导出系统的未知状态;

Monte Carlo方法并非只能用来解决包含随机的过程的问题:

许多利用Monte Carlo方法进行求解的问题中并不包含随机过程

例如:用Monte Carlo方法计算定积分.对这样的问题可将其转换成相关的随机过程, 然后用Monte Carlo方法进行求解

Page 17: 蒙特卡罗方法 (Monte Carlo simulation)hepg.sdu.edu.cn/~zhangxy/Education/MonteCarlo/2013/ch01/... · 2014-03-31 · 1.Monte Carlo方法 2013/3/1 Monte Carlo模拟 3 •Monte

Monte Carlo模拟

第一章 引言

(Introduction)

1. Monte Carlo方法2. Monte Carlo方法简史3. Monte Carlo模拟的应用4. Monte Carlo算法的主要组成部分

2013/3/1 17Monte Carlo模拟

Page 18: 蒙特卡罗方法 (Monte Carlo simulation)hepg.sdu.edu.cn/~zhangxy/Education/MonteCarlo/2013/ch01/... · 2014-03-31 · 1.Monte Carlo方法 2013/3/1 Monte Carlo模拟 3 •Monte

4.Monte Carlo算法的主要组成部分

2013/3/1 18Monte Carlo模拟

Monte Carlo模拟的步骤:

1. 根据欲研究的物理系统的性质,建立能够描述该系统特性的理论模型,导出该模型的某些特征量的概率密度函数;

2. 从概率密度函数出发进行随机抽样,得到特征量的一些模拟结果;

3. 对模拟结果进行分析总结,预言物理系统的某些特性。

Page 19: 蒙特卡罗方法 (Monte Carlo simulation)hepg.sdu.edu.cn/~zhangxy/Education/MonteCarlo/2013/ch01/... · 2014-03-31 · 1.Monte Carlo方法 2013/3/1 Monte Carlo模拟 3 •Monte

4.Monte Carlo算法的主要组成部分

2013/3/1 19Monte Carlo模拟

Monte Carlo算法的主要组成部分

概率密度函数(pdf)

随机数产生器

抽样规则

模拟结果记录

记录一些感兴趣的量的模拟结果

如何从在区间[0,1]上均匀分布的随机数出发,随机抽取服从给定的pdf的随机变量;

能够产生在区间[0,1]上均匀分布的随机数

必须给出描述一个物理系统的一组概率密度函数;

Page 20: 蒙特卡罗方法 (Monte Carlo simulation)hepg.sdu.edu.cn/~zhangxy/Education/MonteCarlo/2013/ch01/... · 2014-03-31 · 1.Monte Carlo方法 2013/3/1 Monte Carlo模拟 3 •Monte

4.Monte Carlo算法的主要组成部分

2013/3/1 20Monte Carlo模拟

误差估计

减少方差的技术

并行和矢量化

可以在先进的并行计算机上运行的有效算法

利用该技术可减少模拟过程中计算的次数;

必须确定统计误差(或方差)随模拟次数以及其它一些量的变化;