I am trying to solve an exercise from the rosalind project, but apparently make a mistake. The full text is available here , but my shorter abstract interpretation and attempt is as follows. Please help me find what I'm doing wrong:
We have a group of 3 elements: AA, AA, AA. We start at 1 in AAand do kiterations of generating new elements. At each iteration, each element in the group:
AAcan produce: AA(25%), AA(50%), AA(25%)AAcan produce: AA(50%), AA(50%)AAcan produce: AA(50%), AA(50%)
As a result of the iteration, we calculate the expected number of elements for each group, assuming that we generate 2 new elements from each in the previous iteration. Thus, we get:
- 0th inertia:
AA: 0 AA: 1 AA: 0 - 1st inertia:
AA.5, AA1, AA.5 - Iter 2nd:
AA: 1 AA: 2 AA: 1 - etc .. - the proportions remain at 1: 2: 1 between the groups.
The sum of the expected values / population at each iteration is equal 2^iteration, and the probability that the element in the group is AAalways equal to 50%.
, , : N , AA, , . ( : N AaBb, AaBb, AaBb,.... )
, , AA, 50%, ( 2^iteration) scipy (k = 2, N = 1) AA:
In [75]: bin = scipy.stats.binom(4, .5)
In [76]: sum(b.pmf(x) for x in range(1, 4+1))
Out[76]: 0.93750000000000022
, , AaBb:
In [77]: sum(b.pmf(x) for x in range(1, 4+1))**2
Out[77]: 0.87890625000000044
: 0.684
? ( , , , , , ).