IntBrownCCdrift <- function(K,C,m){ # This function calculates the successive integral of a two sided Brownian Motion on [-C,C] + the drift on the # specified grid. grid <- seq(-C,C,2^{-m}) # We generate two independent copies to the right and left of 0. Output1 <- IntBrown0C(K,C,m) Output2 <- IntBrown0C(K,C,m) L.g <- length(grid) #we reverse the order of the elements of Output2 in order to get the Int.Brow.M. on [-C,0] and we delete # the first column consisting of zeros (it shows up already in Output1). Output2 <- Output2[,-1] for(k in 1:K){ Output2[k,] <- rev(Output2[k,]) } Output <- cbind(Output2,Output1) # We add the drift. for(k in 1:K){ Output[k,] <- Output[k,] + (-1)^K *(factorial(K)/factorial(K+k))*(grid)^{K+k} } Output }