Rosalind第61题:Independent Segregation of Chromosomes

Problem

Consider a collection of coin flips. One of the most natural questions we can ask is if we flip a coin 92 times, what is the probability of obtaining 51 "heads", vs. 27 "heads", vs. 92 "heads"?

Each coin flip can be modeled by a uniform random variable in which each of the two outcomes ("heads" and "tails") has probability equal to 1/2. We may assume that these random variables are independent (see “Independent Alleles”); in layman's terms, the outcomes of the two coin flips do not influence each other.

binomial random variable  takes a value of  if  consecutive "coin flips" result in  total "heads" and  total "tails." We write that .

Given: A positive integer .

Return: An array  of length  in which  represents the common logarithm of the probability that two diploid siblings share at least  of their  chromosomes (we do not consider recombination for now).

考虑硬币翻转的集合。我们可以问的最自然的问题之一是,如果我们掷硬币92次,获得51个“正面”,27个“正面”和92个“正面”的概率是多少?

每次掷硬币都可以用一个统一的随机变量建模,其中两个结果(“正面”和“反面”)的概率均等于1/2。我们可以假设这些随机变量是独立的(请参阅“独立等位基因”);用外行的话来说,两次掷硬币的结果不会互相影响。

一个二项式随机变量  取值为  如果  连续的“硬币翻转”导致  总“头”和 总“尾巴”。我们写。

给定:正整数。

返回:一个数组  长度  在其中 表示 两个二倍体同胞至少共享一个概率的常用对数 他们的 染色体(我们暂时不考虑 重组)。

Sample Dataset

5

Sample Output

0.000 -0.004 -0.024 -0.082 -0.206 -0.424 -0.765 -1.262 -1.969 -3.010
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值