CHAPTER 6

1

I write a function to evaluate r[n] from the formula and assign values to the parameters:

r[n_]:=(p Sum[e[i],{i,n}] - eb - p ew(n-1) - p n ef - ee(1-p))/
	(tb + p tw(n-1) + p n tf + te(1-p))

e[i_]:=20.19 - 1.7 i
p=0.375;
eb=0.09;tb=4.4;
ew=0.07;tw=3.3;
ef=0.02;tf=14.7;
ee=0.01;te=8.9;

I evaluate r[n] as a function of n and I then evaluate the marginal value as a function of n:

reward=Table[r[n],{n,10}]

margvalue=Table[(e[n]-ew)/(tf+tw),{n,10}]

2

Use pencil and paper.

3

I define the vector of utilities and than calculate the expected utility under the two choices:

u={0,.05,.09,.18,.5,.55,1,1.05,1.7};

.5u[[3]]+.5u[[8]]

.25u[[2]]+.5u[[5]]+.25u[[9]]

4

I clear any previously assigned value of p and define values for beta and lambda:

Clear[p]
beta={0.,.01,.05};
lambda={.4,.6,.8};

I define the function p[i, x, t] from the recurrence relation in Equation 6.21. (See "Functions that remember values they have found" in the Mathematica book for the way of defining the function.)

p[i_,x_,t_]:=p[i,x,t]=
			(1-beta[[i]])*(lambda[[i]]*j[Min[x+1,5],t+1]
				+(1-lambda[[i]])*j[Max[x-1,0],t+1])
p[i_,0,t_]=0;

I define the functions h[x,t] and j[x,t] from Equations 6.22 and 6.23. (Experiment with the way in which Sort works to verify that it will return the result wanted.)

h[x_,t_]:=h[x,t]=Sort[Table[{p[i,x,t],i},{i,3}]][[3,2]]

j[x_,t_]:=j[x,t]=p[h[x,t],x,t]
j[x_,100]=If[x>0,1,0];

I now calculate the optimal habitat depending on energy state and time. (The program would do this if I wrote {t, 80, 99}, but it is more efficient to do it backwards since it can evaluate the results numerically and remember them as it proceeds.)

Table[h[x,t],{t,99,80,-1},{x,5}]//TableForm

5

I define the Schaefer model in Equation 6.25 and find its nonzero equilibrium and its derivative at this equilibrium:

f[n_]:=r n(1-n/k) - e n

equil=Solve[f[n]==0 && n!=0,n]

Simplify[D[f[n],n]/.equil]

I define y as the equilibrium harvest at this point (see Equation 6.26) and hence find the optimal effort, the equilibrium population size at this point, and the maximum sustainable yield:

y=e n/.equil

opteff=Solve[D[y,e]==0, e]

popsize=equil/.opteff

msy=y/.opteff

6

Use pencil and paper.