我遇到以下问题,并且无法理解方程的一部分:
估计积分的蒙特卡罗方法基本上是采用大量随机样本并确定加权平均值。 例如,f(x) 的积分可以通过
r 估计="nofollow noreferrer">替代文本 http://www.goftam.com/images/area.gif
表示 xr 在 [x1, x2] 范围内的均匀概率分布。 由于每个
函数求值 f(xr) 是独立的,很容易分配这项工作
超过一组流程。
我不明白 f(xr) 应该做什么? 它是否反馈到同一个方程中? 那不是无限循环吗?
I have the following problem, and am having trouble understanding part of the equation:
Monte Carlo methods to estimate an integral is basically, take a lot of random samples and determined a weighted average. For example, the integral of f(x) can be estimated from N independent random samples xr by
alt text http://www.goftam.com/images/area.gif
for a uniform probability distribution of xr in the range [x1, x2]. Since each
function evaluation f(xr) is independent, it is easy to distribute this work
over a set of processes.
What I don't understand is what f(xr) is supposed to do? Does it feed back into the same equation? Wouldn't that be an infinite loop?
发布评论
评论(5)
应该说 f(xi)
f() 是我们尝试通过数值蒙特卡罗方法积分的函数,该方法通过评估积分中随机选择的点来估计积分(及其误差)地区。
参考。
It should say f(xi)
f() is the function we are trying to integrate via the numerical monte carlo method, which estimates an integral (and its error) by evaluating randomly choosen points from the integration region.
Ref.
您的目标是计算
f
从x1
到x2
的积分。 例如,您可能希望计算sin(x)
从0
到pi
的积分。使用蒙特卡洛积分,您可以通过在区间
[x1,x2]
中采样随机点并在这些点评估f
来近似这一点。 也许您想将此称为MonteCarloIntegrate( f, x1, x2 )
。所以,
MonteCarloIntegrate
不会“反馈”到自身。 它调用函数f
,即您尝试进行数值积分的函数,例如sin
。Your goal is to compute the integral of
f
fromx1
tox2
. For example, you may wish to compute the integral ofsin(x)
from0
topi
.Using Monte Carlo integration, you can approximate this by sampling random points in the interval
[x1,x2]
and evaluatingf
at those points. Perhaps you'd like to call thisMonteCarloIntegrate( f, x1, x2 )
.So no,
MonteCarloIntegrate
does not "feed back" into itself. It calls a functionf
, the function you are trying to numerically integrate, e.g.sin
.将
f(x_r)
替换为f(x_r_i)
(阅读:f 在x
subr
sub我)。
r_i
是从区间[x_1, x_2]
中均匀随机选择的。要点是:
[x_1, x_2]
上f
下的面积等于(x_2 - x_1)
乘以的平均值>f
位于区间[x_1, x_2]
上。 也就是说,方括号中的部分是
[x_1, x_2]
上f
的平均值,我们将其表示为avg(f)
。 我们如何估计f
的平均值? 通过在N
个随机点进行采样,并取在这些随机点评估的f
的平均值。 也就是说:其中
x_r_1, x_r_2, ..., x_r_N
是从[x_1, x_2]中均匀随机选择的点。那么
这里是思考这个方程的另一种方式:区间
[x_1, x_2]
上f
下的面积与长度为的矩形的面积相同>(x_2 - x_1)
且高度等于f
的平均高度。f
的平均高度大约是我们之前生成的值。
Replace
f(x_r)
byf(x_r_i)
(read: f evaluated atx
subr
subi
). Ther_i
are chosen uniformly at random from the interval[x_1, x_2]
.The point is this: the area under
f
on[x_1, x_2]
is equal to(x_2 - x_1)
times the average off
on the interval[x_1, x_2]
. That isThe portion in square brackets is the average of
f
on[x_1, x_2]
which we will denoteavg(f)
. How can we estimate the average off
? By sampling it atN
random points and taking the average value off
evaluated at those random points. To wit:where
x_r_1, x_r_2, ..., x_r_N
are points chosen uniformly at random from [x_1, x_2].Then
Here is another way to think about this equation: the area under
f
on the interval[x_1, x_2]
is the same as the area of a rectangle with length(x_2 - x_1)
and height equal to the average height off
. The average height off
is approximatelywhich is value that we produced previously.
无论是 xi 还是 xr 都无关紧要——它是我们输入到函数 f() 中的随机数。
我更有可能将函数(除了格式之外)编写如下:
(x2-x1) * sum(f(xi))/N
这样,我们可以看到我们取 f(x) N 个样本的平均值来获得函数的平均高度,然后乘以宽度 (x2-x1)。
因为归根结底,积分只是计算曲线下的面积。 (漂亮的图片位于 http://hyperphysicals.phy-astr.gsu。 edu/Hbase/integ.html#c4。
Whether it's xi or xr is irrelevant - it's the random number that we're feeding into function f().
I'm more likely to write the function (aside from formatting) as follows:
(x2-x1) * sum(f(xi))/N
That way, we can see that we're taking the average of N samples of f(x) to get an average height of the function, then multiplying by the width (x2-x1).
Because, after all, integration is just calculating area under the curve. (Nice pictures at http://hyperphysics.phy-astr.gsu.edu/Hbase/integ.html#c4.
x_r 是积分范围内的随机值。
用 Random(x_1, x_2) 替换 x_r 将给出等效方程。
x_r is a random value from the integral's range.
Substituting Random(x_1, x_2) for x_r would give an equivalent equation.