CHAPTER 8

Procedures for use in evolutionary game theory

The package GameTheory contains four procedures, AllEquilibria, NashEquilibria, ESState and ESStrategy. Each procedure takes the payoff matrix of a game as its argument and returns a list of the corresponding equilibria. First read in the package and find further information about the procedues:

<<GameTheory.m

?AllEquilibria

These procedures are only used explicitly in these solutions in Exercise 6, but you may like to use them for other examples.

1

Use pencil and paper.

2

For the dynamic stability we evaluate dp/dt = f(p) from Equations 7.5 and 8.15, check that there is an equilibrium at p = 0.5, and find f'(p) at this point.

whawk=-p+2(1-p);
wdove=1-p;

wbar=p whawk + (1-p) wdove;

f=(whawk-wbar)p;

Solve[f==0,p]

D[f,p]/.p->0.5

3

Use pencil and paper.

4

The following is a general method for studying dynamic stability

A={{0,5,-4},{-7,0,8},{-1,2,0}};

Clear[p]
freq=Array[p,3];
w=A.freq;
wbar=w.freq;

jac=Table[D[(w[[i]]-wbar)p[i],p[j]]
			-D[(w[[i]]-wbar)p[i],p[3]],
				{i,2},{j,2}];

Eigenvalues[jac/.{p[1]->1/3,p[2]->1/3,p[3]->1/3}]

We now calculate the payoffs for strategies I and J

stratI={1/3,1/3,1/3};
stratJ={0,1/2,1/2};

stratI.A.stratI

stratJ.A.stratI

stratI.A.stratJ

stratJ.A.stratJ

5

The following program solves the continuous time differential equation numerically from an appropriate set of initial values. [This calculation uses a lot of memory. If you don't have enough, reduce the time span to, say, 5.]

A={{1,10,-10},{-10,1,10},{10,-10,1}};
x={p[t],q[t],r[t]};
w=100+A.x/.r[t]->1-p[t]-q[t];
wbar=w.x/.r[t]->1-p[t]-q[t];
soln=NDSolve[{p'[t]==(w[[1]]-wbar) p[t],
	q'[t]==(w[[2]]-wbar) q[t],
		p[0]==q[0]==.2},
		{p,q},{t,10}]
Plot[Evaluate[p[t]/.soln],{t,0,10}]
Plot[Evaluate[q[t]/.soln],{t,0,10}]
Plot[Evaluate[1-p[t]-q[t]/.soln],{t,0,10}]

6

I use the game with payoff matrix (9) as an example:

A={{1,4},{0,2}};

NashEquilibria[A]

ESState[A]

ESStrategy[A]

7, 8, 9, 10

Use pencil and paper.

11

Find the equilibrium value:

w=(1-(1-x)(1-y)/2)(1-x^2);

diff=D[w,x]/.y->x

vstar=x/.FindRoot[diff==0,{x,.5}]

Check that it is a Nash equilibrium:

D[w,{x,2}]/.{x->vstar,y->vstar}

Check for continuous stability:

D[w,{x,2}]+D[w,x,y]/.{x->vstar,y->vstar}

Plot the best-reply function:

d=D[w,x]

v[y_]:=x/.FindRoot[d==0,{x,.5}]

Plot[{v[y],y},{y,0.01,0.99}]