帮助解答概率方程

发布于 2024-07-30 01:34:31 字数 307 浏览 1 评论 0原文

我正在尝试组装一个有趣的应用程序,其中有一个场景,我需要找出以下场景的概率方程:

假设我对某件事进行了多次尝试,并且每次尝试都有一个成功率(提前已知) )。 做了所有这些尝试后成功的几率有多大?

例如,有 3 次尝试(所有尝试均将单独进行)。

已知第一个成功率是 60%。 据了解,第二种方法的成功率为 30%。 据了解,第三种的成功率高达 75%。 如果三种尝试都进行,成功的几率有多大?

我已经尝试了多种公式,但无法确定正确的公式。

谢谢您的帮助!

I'm trying to put together an app for fun that has a scenario where I need to figure out a probability equation for the following scenario:

Suppose I have a number of attempts at something and each attempt has a success rate (known ahead of time). What are the odds after doing all those attempts that a success happens?

For example there are three attempts (all will be taken individually).

The first is known to have a 60% success rate.
The second is known to have a 30% success rate.
The third is known to have a 75% success rate.
What are the odds of a success occurring if all three attempts are made?

I've tried several formulas and can't pinpoint the correct one.

Thanks for the help!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

围归者 2024-08-06 01:34:31

获胜的概率是三个都不输的概率:
1 - (1 - 0.6)(1 - 0.3)(1 - 0.75)

Probability of winning is probability of not losing all three:
1 - (1 - 0.6)(1 - 0.3)(1 - 0.75)

孤独患者 2024-08-06 01:34:31

1 - .4 * .7 * .25

即,找到所有尝试都失败的概率,并将其反转。 因此,一般来说,给定概率为 P[i] 的有限事件序列,至少一个事件成功的概率为 1 - (1 - P[0]) * (1 - P[1]) * ... * (1 - P[n])

这是一个用于计算该值的 Perl 单行代码:(输入是以空格分隔的成功率列表)

 perl -0777 -ane '$p=1; $p*=1-$_ foreach @F; print 1-$p . "\n"'

1 - .4 * .7 * .25

That is, find the probability that all attempts fail, and invert it. So in general, given a finite sequence of events with probabilities P[i], the probability that at least one event is successful is 1 - (1 - P[0]) * (1 - P[1]) * ... * (1 - P[n])

And here's a perl one-liner to compute the value: (input is white-space separated list of success rates)

 perl -0777 -ane '$p=1; $p*=1-$_ foreach @F; print 1-$p . "\n"'
青瓷清茶倾城歌 2024-08-06 01:34:31

计算“所有失败”的几率(所有 1-pj 的乘积,其中 pj 是第 j 个成功的机会 - 将概率表示为除 0 到 1 之间的数字之外的任何内容的概率计算都是疯狂的,所以如果您绝对需要百分比,而不是输入或输出在开始或结束时进行转换!)并且“至少 1 次成功”的概率是 1 减去该乘积。

编辑:这里有一些可执行的伪代码——即Python——以百分比作为输入和输出,使用您的数字(原始数字和您在评论中更改的数字):

$ cat proba.py
def totprob(*percents):
  totprob_failure = 1.0
  for pc in percents:
    prob_this_failure = 1.0 - pc/100.0
    totprob_failure *= prob_this_failure
  return 100.0 * (1.0 - totprob_failure)
$ python -c'import proba; print proba.totprob(60,30,75)'
93.0
$ python -c'import proba; print proba.totprob(2,30,75)'
82.85
$

Compute the chance of "all failures" (product of all the 1-pj where pj is the jth chance of success -- probability computations that represent probabilities as anything but numbers between 0 and 1 are crazy, so if you absolutely need percentages instead as input or output do your transformations at the start or end!) and the probability of "at least 1 success" is 1 minus that product.

Edit: here's some executable pseudocode -- i.e., Python -- with percentages as input and output, using your numbers (the original ones and the ones you changed in a comment):

$ cat proba.py
def totprob(*percents):
  totprob_failure = 1.0
  for pc in percents:
    prob_this_failure = 1.0 - pc/100.0
    totprob_failure *= prob_this_failure
  return 100.0 * (1.0 - totprob_failure)
$ python -c'import proba; print proba.totprob(60,30,75)'
93.0
$ python -c'import proba; print proba.totprob(2,30,75)'
82.85
$
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文