Monte Carlo Integration

Posted wevolf

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Monte Carlo Integration相关的知识,希望对你有一定的参考价值。

Monte Carlo Integration

Monte Carlo integration uses a different perspective from Quadrature Integration to consider the problem of integration. Quadrature Integration from discrete to continuous, mainly uses the concept of limit convergence and continuous. Monte Carlo integral extended sampling and mathematical expectation of random variables.

Probability Background

Cumulative Distributions and Density Functions

The cumulative distribution function, or CDF, of a random variable (X) is the probability that a value chosen from the variable’s distribution is less than or equal to some thresold (x):

[cdf(X) = Pr{X leq x } ]

The corresponding probability density function, or PDF, is the derivative of the CDF:

[pdfleft( x ight) = frac{d}{d_x}cdfleft( x ight) ]

and we can calculate the probility within an interval:

[Prleft{ ale Xle b ight} = int_a^b{pdfleft( x ight) dx} ]

Expected Values and Variance

The expected value or expectation of a random variable (Y = f(x)) over a domain (mu(x)) is defined as:

[Eleft[ Y ight] = int_{mu left( x ight)}{fleft( x ight) cdot pdfleft( x ight) dmu left( x ight)} ]

while its variance is:

[sigma ^2left[ Y ight] = Eleft[ left( Y-Eleft[ Y ight] ight) ^2 ight] ]

The basic knowledge of probability statistics is this, and we will explain it when we use if have others

TheMonte Carlo Estimator

The Basic Estimator

Monte Carlo integration uses random sampling of a function to numerically compute an estimate of its integral. Suppose that we want to integrate the one-dimensional function (f (x)) from (a) to (b):

[F = int_a^b{fleft( x ight) dx} ]

We can approximate this integral by averaging samples of the function (f) at uniform random points within the interval. Given a set of (N) uniform random variables (X_iin left[ a,b ight)) with a corresponding PDF of (1/(b-a)), theMonte Carlo estimator for computing (F) is:

[leftlangle F^{N} ight angle=(b-a) frac{1}{N-1} sum_{i=0}^{N} fleft(X_{i} ight) ag{1} ]

I think using an example directly, with (N=4) and interval ([a,b)), using uniformly distributed probability density, using random sampling can explain this formula very well.

技术图片

We use random sampling to get the value of random variable as shown above, as (f(X_0)), (f(X_1)), (f(X_2)), (f(X_3)).

Then we use the following picture to simulate integration.

技术图片

But this integration process is a combination of sampling and statistical calculation of digital characteristics, which is Expected Values. This process is the process of formula (1). If we extend the number 4 to (N), we get the result of formula(1).

Expected Value and Convergence

我们怎样证明

以上是关于Monte Carlo Integration的主要内容,如果未能解决你的问题,请参考以下文章

python inefficient_monte_carlo.py

python monte_carlo_integration2.py

Experiment 22 - Monte Carlo Simulation

Monte Carlo Tree Search – beginners guide

python利用Monte Carlo方法计算圆周率

蒙特卡洛(Monte Carlo)方法求面积