################################################### ### chunk number 1: ################################################### 2^7/(2^7-1) (1-1/2^7)^-1 ################################################### ### chunk number 2: ################################################### 1+0.2 1+0.2+0.2^2/2 1+0.2+0.2^2/2+0.2^3/6 exp(0.2) ################################################### ### chunk number 3: ################################################### x=1 1/sqrt(2*pi)*exp(-x^2/2) dnorm(1) x=2 1/sqrt(2*pi)*exp(-x^2/2) dnorm(2) ################################################### ### chunk number 4: ################################################### X=read.table("ChlorellaGrowth.txt") Light=X[,1]; rmax=X[,2] logLight=log(Light) ################################################### ### chunk number 5: ################################################### op <- par(cex=1.5,cex.main=0.9) plot(logLight,rmax,xlab="Log light intensity (uE/m2/s)", ylab="Maximum growth rate rmax (1/d)",pch=16) title(main="Data from Fussmann et al. (2000) system") fit=lm(rmax~logLight) abline(fit) rcoef=round(coef(fit),digits=3) text(3.7,3.5,paste("rmax=",rcoef[1],"+",rcoef[2],"log(Light)")) par(op) ################################################### ### chunk number 6: ################################################### plot(Light,rmax,xlim=c(0,120),ylim=c(1,4)) ################################################### ### chunk number 7: ################################################### X=read.table("ChlorellaGrowth.txt") Light=X[,1]; rmax=X[,2] logLight=log(Light) logrmax = log(rmax) ################################################### ### chunk number 8: ################################################### op <- par(mfcol=c(2,1)) plot(Light,rmax,xlab="Light intensity (uE/m2/sa)", ylab="Maximum growth rate rmax (1/d)",pch=16) title(main="Data from Fussmann et al. (2000) system") plot(logLight,logrmax,xlab="Log light intensity", ylab="Log max growth rate",pch=16) title(main="Data from Fussmann et al. (2000) system") par(op) ################################################### ### chunk number 9: ################################################### x = 3:8 y=5*x+3 ################################################### ### chunk number 10: ################################################### op = par(mfrow=c(2,2)) plot(x,y,lty=1,col=1,type="l") plot(x,y,lty=2,col=2,type="l") plot(x,y,lty=3,col=3,type="l") plot(x,y,lty=4,col=4,type="l") par(op) ################################################### ### chunk number 11: ################################################### seq(1,13,by=4) seq(1,by=4,length=4) seq(1,5,by=0.2) ################################################### ### chunk number 12: ################################################### z=c(1,3,5,7,9,11) z[c(2,1,3)] ################################################### ### chunk number 13: ################################################### x=1:10 y = (x-1)/(x+1) ################################################### ### chunk number 14: ################################################### plot(x,y,type="b") ################################################### ### chunk number 15: ################################################### r=0.5 n=10 G = r^(0:n) sum(G) 1/(1-r) n=50 sum(r^(0:n)) 2-sum(r^(0:n)) ################################################### ### chunk number 16: ################################################### x = runif(20) x[x