CHAPTER 10

1

Define the transition matrix, find its dominant eigenvalue, and plot it.

matrix[r_,s_]:={{(1-s)/(2(1-r)),1/2},{s/(2r),1/2}}

eigen[r_,s_]:=Eigenvalues[matrix[r,s]]

lambda[r_,s_]:=Max[eigen[r,s]]

Do[Plot[lambda[r,s],{s,0,1}],{r,0.4,0.6,0.1}]

2

2a

Simplify the first order Taylor series expansion for the eigenvalues. [Notes: 1. Mathematica will only do the algebraic simplification if the transition matrix has been set up with exact rather than numerical expressions. 2. See the caution about the use of PowerExpand in the Mathematica book; in the present case it reverses the two eigenvalues.]

Series[eigen[r,s],{s,r,1}]

Simplify[%]

PowerExpand[%]

Simplify[%]

2b

y=D[Det[matrix[r,s]-IdentityMatrix[2]],s]

Solve[y==0,r]

3

Define the inclusive fitness and use it to find the optimal sex ratio and to check the criteria for stability. (Compare Exercise 8.11.)

Clear[r,s]
w=(r+(1-2r)s)/(2r(1-r));

Solve[(D[w,s]/.s->r)==0]

D[w,{s,2}]/.{s->1/2,r->1/2}

D[w,{s,2}]+D[w,s,r]/.{s->1/2,r->1/2}

4

Redefine matrix and then repeat the calculations in the solutions to Exercises 1 and 2.

5

Female genotypes aa, Aa, AA are numbered 1, 2, 3; male genotypes a, A are 4 and 5. The six mating types {1x1, 2x1, 3x1, 1x2, 2x2, 3x2} are numbered 1 through 6. I first generate a 6x5 matrix m giving the frequencies of offspring from the different matingtypes, with sex ratios produced by aa, Aa and AA females being r, s and t respectively:

m[r_,s_,t_] = {{1-r,0.,0.,r,0.},{.5(1-s),.5(1-s),0.,.5s,.5s},
     {0.,1-t,0.,0.,t},{0.,1-r,0.,r,0.},
     {0.,.5(1-s),.5(1-s),.5s,.5s},{0.,0.,1-t,0.,t}};

I next generate the frequencies of the six mating types, mat, in generation t given the genotype frequencies p1 through p5, with p1+p2+p3=1 and p4+p5=1 and then the standardized genotype frequencies in the next generation:

mat[p_]:=Flatten[Table[p[[i]]*p[[j+3]],{j,2},{i,3}]];
pnext[p_]:=(a=mat[p].m[r,s,t];
		a1=Sum[a[[i]],{i,3}];
		a2=Sum[a[[i]],{i,4,5}];
		Do[a[[i]]/=If[i<=3,a1,a2],{i,5}];
		a)

Simulations can be done by using NestList on the function pnext.

6, 7

Use pencil and paper.

8

8a

Use pencil and paper.

8b

See the solution to Exercise 3.

9

9a

Use pencil and paper.

9b

I reproduce the argument of Taylor and Bulmer (1980) for obtaining the predicted sex ratio under local mate competition in haplodiploids. Postulate a rare allele A and a wild type allele a acting in females. Because the population structure leads to inbreeding we have to consider AA as well as Aa females, and we suppose that A is dominant to a so that both these types of female have sex ratio s, while aa females have sex ratio r. (The argument can be repeated with different genetic assumptions and leads to the same result.) There are six types of mated female, {0,0}, {0,1}, {1,0}, {1,1}, {2,0} and {2,1}, where {i,j} denotes i A genes in the female and j A genes in the sperm in her spermatheca derived from her mate. (I assume single mating.) Denote these types of mated female 0 through 5; type 0 is common and types 1 through 5 are rare. We therefore need to consider six types of patch, types 1 through 5 with 1 mated female of type k (k going from 1 through 5) and n-1 females of type 0 and patch type 0 with n mated females of type 0. Write pk(t) for the frequency of patch type k in generation t, assumed small for k = 1 through 5. We must now find the linearized recurrence relationship for these five frequencies. 
										The function output[k] takes a patch of type k and calculates the frequencies of the different types of mutant mated females produced by this patch as follows. i and j are the numbers of A genes in the mutant foundress and her sperm respectively, and sr is the sex ratio among her offspring. f[] is the number of female offspring with 0, 1 and 2 A genes produced by the patch. (f should be multiplied by N, the total number of offspring produced by each foundress, but this cancels later and can be ignored.) m[] is the proportion of males with 0 or 1 A genes produced by the patch. Random mating within the patch then produces the result returned by the function.

output[k_]:=Module[{i,j,a,b},
		j=If[EvenQ[k],0,1];
		i=(k-j)/2;
		sr=If[i==0,r,s];
		f[0]=(n-1)(1-r)+(1-sr)(1-j)(1-i/2);
		f[1]=(1-sr)(j(1-i/2)+(1-j)i/2);
		f[2]=(1-sr)j i/2;
		m[1]=(sr i/2)/((n-1)r + sr);
		m[0]=1-m[1];
		Rest[Flatten[Table[f[a] m[b],{a,0,2},{b,0,1}]]]]

N output[k] pk(t) gives the number of mated females of different mutant types produced by patches of type k in generation t. Dividing by Nn(1-r), which is to first order the total number of mated females produced, gives the relative frequency of the different mutant types of mated female produced by patches of type k. This must be multiplied by n to give the relative frequency of patches of different mutant types in the next generation whose mutant foundress came from a patch of type k in this generation (since each such patch contains 1 mutant foundress in a group of n foundresses). Thus output[k]/(1-r) is the kth column in the transition matrix. We calculate this matrix as:

A=Transpose[Table[output[k]/(1-r),{k,5}]];

We now use Equation 10.6 to find the unbeatable sex ratio:

deriv=Simplify[D[Det[A-IdentityMatrix[5]],s]/.s->r]

ans=r/.Solve[deriv==0,r]

Factor[Numerator[ans]]/Factor[Denominator[ans]]

10

See the solution to Exercise 3.

11

Define a in Equation 43 as a function of the list of sex ratios in the three patches, r. (The relative frequencies of the patches can be ignored since they are equally frequent.)

wmale={1,1,1};
wfemale={1,2,3};
rho=wmale/wfemale;
alpha[r_List]:=wmale.r/(wfemale.(1-r))

Solve Equation 43 for the optimal sex ratio in the switch patch, assuming in turn that this is the first, second and third patch. See which assumption gives a legitimate answer.

r={x,0,0};
Solve[alpha[r]==rho[[1]],x]

r={1,x,0};
Solve[alpha[r]==rho[[2]],x]

r={1,1,x};
Solve[alpha[r]==rho[[3]],x]

12

Use pencil and paper.