开发者

There are n runs and x is a probability of minimum one occurrence of a event in n runs

开发者 https://www.devze.com 2023-04-05 16:15 出处:网络
There is one problem to implement in a module at which i m stuck . There are n runs and x is a probability of minimum one occurrence of a event in n 开发者_运维问答runs. How do i implement it in a pro

There is one problem to implement in a module at which i m stuck . There are n runs and x is a probability of minimum one occurrence of a event in n 开发者_运维问答runs. How do i implement it in a program. Can anyone help me out with it.


look at binomial distribution of parameter n qnd p :

http://en.wikipedia.org/wiki/Binomial_distribution

and you're looking for P(X>=1) = 1 - P(X=0)

each event is a Bernoulli trial .

i.e the probability of each event to occure is p, and you're doing n trials.

Therefore according to the wikipedia articles:

x=1-(1-p)^n

in python for example:

def B1(n,p):
   return 1-(1-p)**n

where p is the proba of one event to happen and n the number of trials

hope it helps

0

精彩评论

暂无评论...
验证码 换一张
取 消