This page contains a maple code for the course: MATH 111 Applied Mathematical Modelling I --- Maple Assignment II.
# bifurcation.maple Plot an approximate steady-state diagram for
# 31.07.06 the logistic model. Code from Barnes and Fulford (2002).
#
# 21.08.06 Code adapted for the scaled ricker model.
#
with(plots):
n := 125:
nrep := 32:
#K := 1000: # parameter not needed for the scaled ricker model
r := array(1..n): # values of bifurcation parameter
X := array(0..n): # population sizes.
y := array(1..nrep): # population size(s) for large n.
# Plot the data points on the y scale from ystart..yend
ystart := 0: #
yend := 3: # You may need to change this value
rstart := 1.50:
rend := 3.50:
X0 := 0.1:
for i from 1 to n do
r[i] := evalf(rstart+i*(rend-rstart)/n);
for j from 0 to n-1 do
X[0] := X0:
X[j+1] := evalf(X[j]+r[i]*X[j]*(1-X[j]/K)); # defines the fn
X[j+1] := evalf(X[j]*exp(r[i]*(1-X[j])));
od;
for k from 1 to nrep do
y[k] := X[n-nrep+k]:
od:
pp := [[r[i],y[jj]] $jj=1..nrep];
bif[i] := plot(pp, r=rstart..rend, y=ystart..yend, \
style=point,symbol=point,colour=black);
col[i] := display([seq(bif[j], j=1..i)]);
od:
plot1 := display(col[n],labels=["per-capita reproduction rate r","scaled population size"],\
labeldirections=[horizontal,vertical]):
display({plot1});