Problem
In “The Wright-Fisher Model of Genetic Drift”, we generalized the concept of a binomial random variable as a "weighted coin flip." It is only natural to calculate the expected value of such a random variable.
For example, in the case of unweighted coin flips (i.e., ), our intuition would indicate that is ; what should be the expected value of a binomial random variable?
Given: A positive integer () followed by an array of length () containing numbers between and . Each element of can be seen as representing a probability corresponding to an allele frequency.
Return: An array of length for which is the expected value of ; in terms of Wright-Fisher, it represents the expected allele frequency of the next generation.
在“遗传漂移的Wright-Fisher模型”中,我们概括了二项式随机变量的概念 作为“加权硬币翻转”。计算这种随机变量的期望值是很自然的。
例如,对于未加权的硬币翻转(即, ),我们的直觉表明 是 ; 二项式随机变量的期望值应该是多少?
给定:正整数 ()后跟一个数组 长度 ()之间包含数字 和 。每个元素 可以看作代表等位基因频率的概率。
返回:数组 长度 为此 是的期望值 ; 就赖特·费舍尔而言,它代表了下一代的预期等位基因频率。
Sample Dataset
17
0.1 0.2 0.3
Sample Output
1.7 3.4 5.1