u<-0.05 T<-200 N<-10000 S0<-1 #Question 4 a)-b) Y<-sample(c(1-u,1+u),T,replace=T,prob=c(0.5,0.5)) S<-cumprod(c(S0,Y)) theta<-rep(0,T+1) V<-rep(0,T+1) i<-1 while(Y[i]<1 && i