Forgot password?
 Create new account
View 280|Reply 14

求解概率值

[Copy link]

1

Threads

2

Posts

16

Credits

Credits
16

Show all posts

chenyu93 Posted at 2023-5-31 10:54:10 |Read mode
设抛掷硬币时,得到正面的概率为56%,得到反面的概率为44%,连续抛掷1500次,出现连续七次反面的概率是多少?

48

Threads

969

Posts

110K

Credits

Credits
14870
QQ

Show all posts

Czhang271828 Posted at 2023-5-31 12:45:46
其实问问 GPT 就可以了, 答案 $1-(1-0.56^7)^{1500-7+1}$.

-----------------------以下是解答过程----------------------


Question A coin is tossed 1500 times, and the probability of heads is 0.56. What is the probability that there exists 7 heads in a row?

Answer by $\mathsf{ChatGPT4}$
We can approach this by calculating the probability of the complement event, which is that there are no runs of $7$ consecutive heads.
Let $q=1-p=0.44$ be the probability of tails. We can use the formula for the probability of no runs of $k$ consecutive heads in $n$ tosses, which is:
\[P(\text{no $k$ consecutive heads in $n$ tosses})=(1-p^k)^{n-k+1}.\]
So, the probability of no runs of $7$ consecutive heads in $1500$ tosses is:
\begin{align*}
&P(\text{no $7$ consecutive heads in $1500$ tosses})\\
=\,&(1-0.56^7)^{1500-7+1}\\
=\,& 0.3917409259.
\end{align*}
Therefore, the probability that there is at least one run of $7$ consecutive heads in $1500$ tosses is:
\begin{align*}
&P(\text{at least $1$ run of $7$ consecutive heads in $1500$ tosses})\\
=\,&1-P(\text{no $7$ consecutive heads in $1500$ tosses})\\
=\,& 1-0.3917409259\\
=\,& 0.6082590741.
\end{align*}

Answer
\[P(\text{at least 1 run of 7 consecutive heads in } 1500 \text{ tosses}) \approx 0.6083.\]

701

Threads

110K

Posts

910K

Credits

Credits
94167
QQ

Show all posts

kuing Posted at 2023-5-31 13:03:17
知乎有相关问题:zhihu.com/question/46388875

701

Threads

110K

Posts

910K

Credits

Credits
94167
QQ

Show all posts

kuing Posted at 2023-5-31 14:56:37
Czhang271828 发表于 2023-5-31 12:45
其实问问 GPT 就可以了, 答案 $1-(1-0.56^7)^{1500-7+1}$.

-----------------------以下是解答过程----- ...
`P(\text{no $k$ consecutive heads in $n$ tosses})=(1-p^k)^{n-k+1}` 这是为啥呢?

1

Threads

2

Posts

16

Credits

Credits
16

Show all posts

 Author| chenyu93 Posted at 2023-5-31 15:02:21
Czhang271828 发表于 2023-5-31 12:45
其实问问 GPT 就可以了, 答案 $1-(1-0.56^7)^{1500-7+1}$.

-----------------------以下是解答过程----- ...

1

Threads

2

Posts

16

Credits

Credits
16

Show all posts

 Author| chenyu93 Posted at 2023-5-31 15:02:49
kuing 发表于 2023-5-31 14:56
`P(\text{no $k$ consecutive heads in $n$ tosses})=(1-p^k)^{n-k+1}` 这是为啥呢?

84

Threads

436

Posts

5432

Credits

Credits
5432

Show all posts

tommywong Posted at 2023-5-31 15:27:58
Czhang271828 发表于 2023-5-31 12:45
其实问问 GPT 就可以了, 答案 $1-(1-0.56^7)^{1500-7+1}$.

-----------------------以下是解答过程----- ...
ChatGPT出名吹水同做錯數
$n=8$時$2p^7-p^8$
唔會係$1-(1-p^7)^{n-7+1}$

另外人哋係問緊連續七次反面,唔係正面
现充已死,エロ当立。
维基用户页:https://zh.wikipedia.org/wiki/User:Tttfffkkk
Notable algebra methods:https://artofproblemsolving.com/community/c728438
《方幂和及其推广和式》 数学学习与研究2016.

701

Threads

110K

Posts

910K

Credits

Credits
94167
QQ

Show all posts

kuing Posted at 2023-5-31 15:42:10
记 `a=0.44` 为反面概率,记 `P(n)` 为抛 `n` 次出现连续七次反面的概率。

显然当 `n<7` 时 `P(n)=0`,及 `P(7)=a^7`。

当 `n>7` 时,出现连续七次反面这个事件包含两种情况:

(1)前 `n-1` 次内已经出现连续七次反面;

(2)直至抛完最后一次才出现连续七次反面。

情况(1)概率就是 `P(n-1)`,至于情况(2),那就是前 `n-8` 次内都没有出现且最后 `8` 次为正反反反反反反反,因此概率为 `\bigl(1-P(n-8)\bigr)\cdot(1-a)a^7`。

综上,有
\[P(n)=P(n-1)+\bigl(1-P(n-8)\bigr)\cdot(1-a)a^7.\]

48

Threads

969

Posts

110K

Credits

Credits
14870
QQ

Show all posts

Czhang271828 Posted at 2023-5-31 16:25:38
Last edited by Czhang271828 at 2023-5-31 17:23:00$\mathsf{GPT}$ 确实问题一堆. 可以尝试把
  1. M = Matrix([
  2.     [0.56 ,0.56 ,0.56 ,0.56 ,0.56 ,0.56 ,0.56 ,0],
  3.     [0.44 ,0    ,0    ,0    ,0    ,0    ,0    ,0],
  4.     [0    ,0.44 ,0    ,0    ,0    ,0    ,0    ,0],
  5.     [0    ,0    ,0.44 ,0    ,0    ,0    ,0    ,0],
  6.     [0    ,0    ,0    ,0.44 ,0    ,0    ,0    ,0],
  7.     [0    ,0    ,0    ,0    ,0.44 ,0    ,0    ,0],
  8.     [0    ,0    ,0    ,0    ,0    ,0.44 ,0    ,0],
  9.     [0    ,0    ,0    ,0    ,0    ,0    ,0.44 ,1]
  10. ]);
  11. V = Matrix([[1],[0],[0],[0],[0],[0],[0],[0]]);
  12. Out = (M^1500)*V;
  13. Out[-1]
Copy the Code

扔给 $\texttt{sage}$ 在线计算, 得到答案:
  1. (0.933403093589771)
Copy the Code

701

Threads

110K

Posts

910K

Credits

Credits
94167
QQ

Show all posts

kuing Posted at 2023-5-31 17:05:00
按 8# 的递推方法,在 MMA 里用如下命令
  1. a = 0.44;
  2. Do[P[n] = 0, {n, 0, 6}]
  3. P[7] = a^7;
  4. Do[P[n] = P[n - 1] + (1 - P[n - 8]) (1 - a) a^7, {n, 8, 1500}]
  5. P[1500]
Copy the Code

输出结果是 0.933403,不知会不会有数值误差……

3146

Threads

8493

Posts

610K

Credits

Credits
66158
QQ

Show all posts

hbghlyj Posted at 2023-5-31 17:13:45
kuing 发表于 2023-5-31 10:05
按 8# 的递推方法,在 MMA 里用如下命令

输出结果是 0.933403,不知会不会有数值误差…… ...

101341nkws2szktl32tm33.png In SageMath, (Python syntax) you need to initialize the list P with zeros using multiplication [0] * 7 and access the elements using square brackets P[n]. The rest of the code remains mostly unchanged.

  1. a = 0.44
  2. P = [0] * 7
  3. P.append(a**7)
  4. for n in range(8, 1501):
  5.     P.append(P[n-1] + (1 - P[n-8]) * (1 - a) * a**7)
  6. P[1500]
Copy the Code

Screenshot 2023-05-31 at 10-24-20 Octave Online · Cloud IDE compatible with MATLAB.png In Matlab / Octave, indexing starts from 1 instead of 0, so the range in the for loop starts from 9 instead of 8. The initial list P is initialized with zeros using zeros function, and P(8) is assigned the value a^7 instead of using append. The rest of the code remains the same.

  1. a = 0.44;
  2. P = zeros(1, 1501);
  3. P(8) = a^7;
  4. for n = 9:1501
  5.     P(n) = P(n-1) + (1 - P(n-8)) * (1 - a) * a^7;
  6. end
  7. P(1501)
Copy the Code

84

Threads

436

Posts

5432

Credits

Credits
5432

Show all posts

tommywong Posted at 2023-5-31 17:17:33
#10同#11都冇錯,但#9唔知係乜

Comment

#9 已修正:)  Posted at 2023-5-31 17:46
现充已死,エロ当立。
维基用户页:https://zh.wikipedia.org/wiki/User:Tttfffkkk
Notable algebra methods:https://artofproblemsolving.com/community/c728438
《方幂和及其推广和式》 数学学习与研究2016.

3146

Threads

8493

Posts

610K

Credits

Credits
66158
QQ

Show all posts

hbghlyj Posted at 2023-5-31 17:18:28
Czhang271828 发表于 2023-5-31 09:25
$\mathsf{GPT}$ 确实问题一堆. 可以尝试把

扔给 $\texttt{sage}$ 在线计算, 得到答案.  ...

In Matlab / Octave, you can directly perform matrix multiplication using the * operator. The end keyword is used to refer to the last element of a vector or the last row/column of a matrix. Screenshot 2023-05-31 at 10-29-01 Octave Online · Cloud IDE compatible with MATLAB.png

  1. M = [0.56 ,0.56 ,0.56 ,0.56 ,0.56 ,0.56 ,0.56 ,0;
  2.      0.44 ,0    ,0    ,0    ,0    ,0    ,0    ,0;
  3.      0    ,0.44 ,0    ,0    ,0    ,0    ,0    ,0;
  4.      0    ,0    ,0.44 ,0    ,0    ,0    ,0    ,0;
  5.      0    ,0    ,0    ,0.44 ,0    ,0    ,0    ,0;
  6.      0    ,0    ,0    ,0    ,0.44 ,0    ,0    ,0;
  7.      0    ,0    ,0    ,0    ,0    ,0.44 ,0    ,0;
  8.      0    ,0    ,0    ,0    ,0    ,0    ,0.44 ,1];
  9. V = [1;0;0;0;0;0;0;0];
  10. Out = M^1500 * V;
  11. Out(end)
Copy the Code
In Mathematica, MatrixPower[M, n] is used to raise a matrix M to the power n, and Last[out] or out[[-1]] is equivalent to Out(end) in MATLAB, giving the last element of the vector out.
  1. M = {{0.56, 0.56, 0.56, 0.56, 0.56, 0.56, 0.56, 0},
  2.      {0.44, 0,    0,    0,    0,    0,    0,    0},
  3.      {0,    0.44, 0,    0,    0,    0,    0,    0},
  4.      {0,    0,    0.44, 0,    0,    0,    0,    0},
  5.      {0,    0,    0,    0.44, 0,    0,    0,    0},
  6.      {0,    0,    0,    0,    0.44, 0,    0,    0},
  7.      {0,    0,    0,    0,    0,    0.44, 0,    0},
  8.      {0,    0,    0,    0,    0,    0,    0.44, 1}};
  9. V = {1, 0, 0, 0, 0, 0, 0, 0};
  10. out = MatrixPower[M, 1500].V;
  11. out[[-1]]
Copy the Code

25

Threads

1020

Posts

110K

Credits

Credits
12672

Show all posts

战巡 Posted at 2023-5-31 18:20:34
搞这么复杂...就很简单的一个随机过程而已啊
p0191.png

手机版Mobile version|Leisure Math Forum

2025-4-20 21:56 GMT+8

Powered by Discuz!

× Quick Reply To Top Return to the list