# Random walk reflection principle diagram #2 oldwalk <- c(0,1,2,1,2,3,4,5,6,5,4,3,4,3) walk <- c(10,9,8,9,8,7,6,5,6,5,4,3,4,3) n <- length(walk)-1 t <- 0:n # Plot the walks plot(t, walk, ylim=c(0,11), ylab="position", xlab="time", type="l") points(t[1:7], oldwalk[1:7], type="p") # Horizontal axis for the parameter a haxis <- (-20:40*n)/40 points(haxis, rep(5,length(haxis)), pch=".") text(0, 5, labels="a", pos=3) # Horizontal axis for the parameter 2a haxis <- (-20:40*n)/40 points(haxis, rep(10,length(haxis)), pch=".") text(0, 10, labels="2a", pos=3) # Vertical axis for the parameter x vaxis <- (-20:300*n)/40 points(rep(n ,length(vaxis)), vaxis, pch=".") text(n, 3, labels="x", pos=2) # Arrow from old to new points(c(2.5,2.5,2.3,2.5,2.7), c(3,7,6.5,7,6.5),type="l")