expcdf<-function(x){1-exp(-x)} plotexp<-function(xmax,np=1001){ x<-seq(0,xmax,length=np) lines(x,expcdf(x),type="l",col=3) } geomcdfint<-function(k,n){1-(1-1/n)^k} plotgeom<-function(n,xmax){ x<-(0:(xmax*n))/n y<-geomcdfint(0:(xmax*n),n) plot(x,y,type="s",col=2,xlab=paste("n=",n),ylab="") } pdf(file="geomconv.pdf",width=8.5,height=11) par(mfrow=c(4,1),pin=c(6.5,1.6),oma=c(4,0,0,0)) plotgeom(2,4) plotexp(4) plotgeom(4,4) plotexp(4) plotgeom(8,4) plotexp(4) plotgeom(16,4) plotexp(4) dev.off()