F**********3 发帖数: 319 | 1 Every time a man can step to his left side or right side. 50% chance on each
side.
Question: how far is the man from his original position after 1000 steps?
I thought the answer is zero, but it's not.
I even wrote a two line code to test it out. The result was not zero, but I
still don't understand.
Please help. It drives me crazy... |
v*****s 发帖数: 20290 | 2 布朗运动,和sqrt(T)成正比
each
I
【在 F**********3 的大作中提到】 : Every time a man can step to his left side or right side. 50% chance on each : side. : Question: how far is the man from his original position after 1000 steps? : I thought the answer is zero, but it's not. : I even wrote a two line code to test it out. The result was not zero, but I : still don't understand. : Please help. It drives me crazy...
|
F**********3 发帖数: 319 | 3 why it's 布朗运动?
And my results don't seem to 成正比 with sqrt(steps). Anything I miss here?
【在 v*****s 的大作中提到】 : 布朗运动,和sqrt(T)成正比 : : each : I
|
p****u 发帖数: 2422 | 4 平均值是零,方差不是
each
I
【在 F**********3 的大作中提到】 : Every time a man can step to his left side or right side. 50% chance on each : side. : Question: how far is the man from his original position after 1000 steps? : I thought the answer is zero, but it's not. : I even wrote a two line code to test it out. The result was not zero, but I : still don't understand. : Please help. It drives me crazy...
|
g*r 发帖数: 67 | |
k*******2 发帖数: 4163 | 6 关键是你这个how far,是距离,而距离永远是正的。所以这个题求的
是|x|的expectation value, 而不是 x 的expectation.
比方说就走两步,那么几种可能:LL,LR,RL,RR.
其中各1/4几率,其expectation:
2(LL)×1/4 + 0(LR+RL)×1/2 + 2(RR)×1/4 = 1
而不是0。
走1000步,只有很小的概率是左右各500步,其他的绝大多数概率都是正数,
所以expectation不可能是0。
each
I
【在 F**********3 的大作中提到】 : Every time a man can step to his left side or right side. 50% chance on each : side. : Question: how far is the man from his original position after 1000 steps? : I thought the answer is zero, but it's not. : I even wrote a two line code to test it out. The result was not zero, but I : still don't understand. : Please help. It drives me crazy...
|
T*****u 发帖数: 7103 | |
F**********3 发帖数: 319 | 8 你这个解释我能理解,可是实际不是|x|,而是x啊
在我的code里面,RR会是-2而不是2
但是我的结果也不是零
而且我的结果确实是和steps正相关,虽然(看起来)不是线性或者平方根
【在 k*******2 的大作中提到】 : 关键是你这个how far,是距离,而距离永远是正的。所以这个题求的 : 是|x|的expectation value, 而不是 x 的expectation. : 比方说就走两步,那么几种可能:LL,LR,RL,RR. : 其中各1/4几率,其expectation: : 2(LL)×1/4 + 0(LR+RL)×1/2 + 2(RR)×1/4 = 1 : 而不是0。 : 走1000步,只有很小的概率是左右各500步,其他的绝大多数概率都是正数, : 所以expectation不可能是0。 : : each
|
v***r 发帖数: 1046 | 9 they already todl you the answer, the variance is linear of steps.
【在 F**********3 的大作中提到】 : 你这个解释我能理解,可是实际不是|x|,而是x啊 : 在我的code里面,RR会是-2而不是2 : 但是我的结果也不是零 : 而且我的结果确实是和steps正相关,虽然(看起来)不是线性或者平方根
|
f*****g 发帖数: 3086 | 10 恩,那证明你的2-line code有bug
【在 F**********3 的大作中提到】 : 你这个解释我能理解,可是实际不是|x|,而是x啊 : 在我的code里面,RR会是-2而不是2 : 但是我的结果也不是零 : 而且我的结果确实是和steps正相关,虽然(看起来)不是线性或者平方根
|
|
|
F**********3 发帖数: 319 | 11 呵呵,我也觉得,不然太不可思议了
【在 f*****g 的大作中提到】 : 恩,那证明你的2-line code有bug
|
n*******r 发帖数: 2010 | 12 debug很简单啊, 你把1000换成2, 看看跑出来x的期望是不是0.
【在 F**********3 的大作中提到】 : 呵呵,我也觉得,不然太不可思议了
|
v***r 发帖数: 1046 | 13 不一定是bug, steps 越多,std 越大 (more flat),你跑出来的平均值的方差也大,
所以你看到它也有变化.要增加仿真次数。
try this: steps=1000; x=sum((rand(10000,steps)-0.5)*2,2); mean(x)
【在 F**********3 的大作中提到】 : 呵呵,我也觉得,不然太不可思议了
|
l*******s 发帖数: 7316 | |
i***a 发帖数: 698 | 15 每一步是Bernoulli trial X1 = (-1,1), p=0.5.
能走多远是 S = X1+X2+...Xn.
S 的均值是0, 方差是n. E(S) = 0, Var(S) = n
S 是二项分布,n 足够大,S趋近正态分布 S ~ N(0,n)
每次实验限定n, 比如 n = 10000.
重复此实验m次, 比如 m = 1000.
每次实验结果是以0为中心的正态分布。结果取到0,但概率很小,可以估算为0.004。
所以取0,很不常见,一千次实验大概能看到4次。但可以估算一定范围的概率。比如-
100,到 100 的概率是 0.7.
总之,均值是0,不代表能取到0,因为样本很大。 数值变大,是方差变大的表象。 |
s*****m 发帖数: 8094 | 16 贴code吧
【在 F**********3 的大作中提到】 : 你这个解释我能理解,可是实际不是|x|,而是x啊 : 在我的code里面,RR会是-2而不是2 : 但是我的结果也不是零 : 而且我的结果确实是和steps正相关,虽然(看起来)不是线性或者平方根
|