################################################### ### chunk number 1: ################################################### curve(-(x-5)^2+1,from=0,to=10,ylim=c(0,1.1),ylab="") curve(0.2*exp(1)*x*exp(-0.2*x),add=TRUE,lty=2) curve(ifelse(x<5,x/5,-(x-5)+1),add=TRUE,lty=3) ################################################### ### chunk number 2: ################################################### dS = D(expression(R*N/(1+a*N)^b),"N"); dS ################################################### ### chunk number 3: ################################################### eval(dS,list(a=1,b=2,R=2,N = 2.5)) ################################################### ### chunk number 4: ################################################### shep = function(x,R=1,a=1,b=1) { R*x/(1+a*x)^b } ################################################### ### chunk number 5: ################################################### curve(shep(x,b=0),xlim=c(0,10),bty="l") curve(shep(x,b=0.5),add=TRUE,col=2) curve(shep(x,b=1),add=TRUE,col=3) curve(shep(x,b=1.5),add=TRUE,col=4) abline(a=0,b=1,lty=3,col=5) abline(h=1,col=6,lty=3) legend(0,10,c("b=0","b=0.5","b=1","b=1.5", "initial slope","asymptote"), lty=rep(c(1,3),c(4,2)),col=1:6) ################################################### ### chunk number 6: ################################################### a = 1 b = 2 R = 1 curve(shep(x,R,a,b),bty="l",ylim=c(0,0.3), from=0,to=5) abline(v=1/(a*(b-1)),lty=2) abline(h=R/(a*(b-1)*(1+1/(b-1))^b),lty=2) ################################################### ### chunk number 7: ################################################### holling3 = function(x,A=1,H=1) { A*(x/H)^2/(1+(x/H)^2) } curve(holling3(x,A=2,H=3),from=0,to=20,ylim=c(0,2.1)) abline(h=c(1,2),lty=2) abline(v=3,lty=2) ################################################### ### chunk number 8: ################################################### a=-5 b=2 n0=1/(1+exp(-a)); n0 K=1 r=b ################################################### ### chunk number 9: ################################################### curve(exp(a+b*x)/(1+exp(a+b*x)),from=0,to=5,ylab="") curve(K/(1+ (K/n0-1)*exp(-r*x)),add=TRUE,type="p") legend(0,1,c("statistical","pop-dyn"), pch=c(NA,1),lty=c(1,NA),merge=TRUE)