Intuitively, because Wright-Fisher demands that we randomly and independently
select alleles for the next generation based off the allele frequency of the present
generation, we would hope that on average this frequency would illustrate a stabilizing effect:
that is, the expected frequency in the next generation should equal the allele frequency
in the current generation. In this problem, we will see if the mathematics
matches our intuition.
For example, in the case of unweighted coin flips (i.e., p=1/2), our intuition would indicate
that E(Bin(n,1/2)) is n/2; what should be the expected value of a
binomial random variable?
Given: A positive integer n (n≤1000000) followed by an arrayP of length
m (m≤20) containing numbers between 0 and 1. Each element of P can be seen
as representing a probability corresponding to an allele frequency.
Return: An array B of length m for which B[k] is the expected value of Bin(n,P[k]);
in terms of Wright-Fisher, it represents the expected allele frequency of the next generation.