菜兄高见!
登录 | 论坛导航 -> 华新鲜事 -> 创业求职 | 本帖共有 1 楼,分 1 页, 当前显示第 1 页 : 本帖树形列表 : 刷新 : 返回上一页
<<始页  [1]  末页>>
作者: (等级:3 - 略知一二,发帖:385) 发表:2008-06-15 12:42:58  楼主  关注此帖
我靠,难啊,解得是6设expect number = E, 扔两次正好如果正好是都是正面那么就赢了,之后不再需要扔了。 设扔两次后第二次硬币是反面的情况下再需要扔的expect number = a, 这种情况的几率是50% 设扔两次后在第一次是反面第二次是正面的情况下再需要扔的expect number = b,这种情况的几率是25% 那么E = 25%x2 + 50%(2+a) + 25%(2+b) 显然a = E (重头再来) 而b = 50%x1 + 50%x(E+1) 注:50%x1就是一般机会一扔是正面,成功;50%x(E+1)就是另一半机会一扔是反面白白增加了一个扔硬币(+1)次数后重新回到起点E 所以:E=25%x2 + 50%(2+E) + 25%[2+50%x1+50%(E+1)] 解得:E=6 这种题如果是填空题的话根本快不了。
菜兄高见!
Expected Tosses for Consecutive Heads with a Fair Coin
Date: 06/29/2004 at 23:35:35
From: Adrian
Subject: Coin Toss

What is the expected number of times a person must toss a fair coin
to get 2 consecutive heads? I'm having difficulty in finding the
probabilty when the number of tosses gets bigger.

Here's my thinking:

1) You will only stop when the last two tosses are heads.
2) The random variable should be # of tosses


# of tosses 1 2 3 4 5
Prob 0 P(HH) P(THH) P(TTHH)+P(HTHH) and so on....

However I get 2(1/4)+ 3(1/8) + 4(2/16) + 5(4/32) + ....

Am I doing something wrong here?



--------------------------------------------------------------------------------


Date: 07/01/2004 at 19:23:53
From: Doctor Mitteldorf
Subject: Re: Coin Toss

Hi Adrian -


Your thinking is very good and clear. But the calculation you have
set up is potentially infinite. Sometimes that's ok, and you can get
very close with just the first few terms; in this case, you'll have to
go out past 20, taking 2^20 possibilities into account in order to get
a reasonably accurate number. So we might look for a trick or
shortcut.

In this case, the standard trick is "recursion". Try to write the
probability after a certain number of flips in terms of itself. Let's
let X = the expected count (the thing we're looking for). Start the
way you started:

X = [2(1/4) for HH] + [something for HT] + [something for TT]
+ [something for TH]

Here's how we can evaluate the "something" for HT. There's a 1/4
probability of getting there. And once you've gotten there, you're
exactly where you were when you started, except you've wasted 2
flips. So for that "something" I'm going to write (1/4)(X + 2). The
1/4 says that you have a 1/4 chance of flipping HT. The (X + 2) says
that we have the same expectation now as we did when we started (X)
except that we've wasted two flips.

Similarly, the [something for TT] becomes another (1/4)(X + 2), just
the same as HT.

The last term, TH, is a little trickier, because we're NOT in the same
position we started in, because we've got one H "in the bank". We
have a 1/2 chance of getting another head on the 3rd flip, so that
gives a contribution of (1/4)(1/2)(3). We also have a 1/2 chance of
getting a tail on the 3d flip, leaving us in the same position we
started, except that we've wasted 3 flips now. So that is
represented by (1/4)(1/2)(X + 3).

Put all this together now to make an equation for X:

X = 2(1/4) + (1/4)(X+2) + (1/4)(X+2) + (1/4)(1/2)3 + (1/4)(1/2)(X+3)

What I would do at this point is first to solve for X, and see if I
got a reasonable answer. A reasonable answer is something bigger than
4 and smaller than 10. Next, I wouldn't trust my abstract reasoning -
I'd go write a computer program to check the value that I got from the
algebra.

Will you let me know if this works out?


--------------------------------------------------------------------------------


Date: 07/01/2004 at 20:22:46
From: Doctor Anthony
Subject: Re: Coin Toss

Hi Adrian -

A difference equation is often useful here.

Let a = expected number of throws to first head.

We must make 1 throw at least and we have probability 1/2 of a head
and probability 1/2 of returning to a, so

a = (1/2)1 + (1/2)(1 + a)

(1/2)a = 1

a = 2.

Let E = expected number of throws to 2 consecutive heads.

Consider that we have just thrown a head and what happens on the next
throw. We are dealing with the (a + 1)th throw, with probability 1/2
this is not a head and we return to E.

So E = (1/2)(a + 1) + (1/2)(a + 1 + E)

(1/2)E = a + 1

E = 2(a + 1)

and now putting in the value a = 2 we get E = 2(3) = 6

Expected throws to 2 consecutive heads is 6.


--------------------------------------------------------------------------------


Date: 07/03/2004 at 01:20:24
From: Adrian
Subject: Thank you (Coin Toss)

Thanks. The answer is indeed 6. I've got a simple C++ program to
show this...

//------------------------------------
#include <iostream>
#include <cmath>
#include <ctime>
using namespace std;

int flips();

void main()
{ int result = 0;
int i;
srand(time(NULL));

for (i = 1; i < 999999; i++)
result += flips();

cout << "Expected value = "<< result / i << endl;
}


int flips()
{ int i, j, counter;
i = 0;
j = rand() % 2;
counter = 1;

while ((i+j) != 2)
{ i = j;
j = rand() % 2;
counter++;
}
return counter;
}
//---------------------------







http://mathforum.org/library/drmath/view/65495.html
Experience is the best dividend payer while observation is the best tips giver.
欢迎来到华新中文网,踊跃发帖是支持我们的最好方法!原文 / 传统版 / WAP版所有回复从这里展开收起列表
论坛导航 -> 华新鲜事 -> 创业求职 | 返回上一页 | 本主题共有 1 篇文章,分 1 页, 当前显示第 1 页 | 回到顶部
<<始页  [1]  末页>>

请登录后回复:帐号   密码