public
Created

  • Download Gist
g.r
R
1 2 3 4 5 6 7 8 9 10
g <- function(Z) {
prix <- apply(grid,2,cumsum)
prix <- grid
for (i in 1:n) {
prix[i,] <- S0*exp(sigma*prix[i,]+(r-sigma^2/2)*i/n*Time)
}
prix <- colMeans(prix) - K
prix[prix<0] <- 0
return(prix)
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.