5 replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/ edited Apr 13 '17 at 12:55 The following will be my attempt at the problem. I think I have the basics down but I am hoping there are areas to decrease the computation time. These problems were alluded to earlier in the question and answers of http://mathematica.stackexchange.com/questions/18203/1d-random-walk-variant/18212#182121D Random Walk variant. So how can this be sped up? Some different schemes for the hopMod module were discussed at http://mathematica.stackexchange.com/questions/18203/1d-random-walk-variant/18212#182121D Random Walk variant. However I was not sure how to generalized all those approaches to my situation where I also need to keep track of the simulation time. The following will be my attempt at the problem. I think I have the basics down but I am hoping there are areas to decrease the computation time. These problems were alluded to earlier in the question and answers of http://mathematica.stackexchange.com/questions/18203/1d-random-walk-variant/18212#18212. So how can this be sped up? Some different schemes for the hopMod module were discussed at http://mathematica.stackexchange.com/questions/18203/1d-random-walk-variant/18212#18212. However I was not sure how to generalized all those approaches to my situation where I also need to keep track of the simulation time. The following will be my attempt at the problem. I think I have the basics down but I am hoping there are areas to decrease the computation time. These problems were alluded to earlier in the question and answers of 1D Random Walk variant. So how can this be sped up? Some different schemes for the hopMod module were discussed at 1D Random Walk variant. However I was not sure how to generalized all those approaches to my situation where I also need to keep track of the simulation time. 4 deleted 1 characters in body edited Jan 24 '13 at 16:24 BeauGeste 1,38211 gold badge1919 silver badges3131 bronze badges FindRate[k0_] := Module[{t}, kB1 = If[({Xi} \[Intersection] blockedSites + 1) != {}, RandomChoice[{1/2, 1/2} -> {0, kBack1[k0]}], kBack1[k0]]; kB2 = If[({Xi} \[Intersection] blockedSites + 2) != {}, RandomChoice[{1/2, 1/2} -> {0, kBack2[k0]}], kBack2[k0]]; kF1 = If[({Xi} \[Intersection] blockedSites - 1) != {}, RandomChoice[{1/2, 1/2} -> {0, kFor1[k0]}], kFor1[k0]]; kF2 = If[({Xi} \[Intersection] blockedSites - 2) != {}, RandomChoice[{1/2, 1/2} -> {0, kFor2[k0]}], kFor2[k0]]; newCoords = RandomChoice[{kB1, kB2, kF1, kF2} -> {Xi - 1, Xi - 2, Xi + 1, Xi + 2}]; dt = RandomReal[ExponentialDistribution[kB1 + kB2 + kF1 + kF2]]; t = simT; {Xi, simT} = {newCoords, t + dt} ]  FindRate[k0_] := Module[{t}, kB1 = If[({Xi} \[Intersection] blockedSites + 1) != {}, RandomChoice[{1/2, 1/2} -> {0, kBack1[k0]}], kBack1[k0]]; kB2 = If[({Xi} \[Intersection] blockedSites + 2) != {}, RandomChoice[{1/2, 1/2} -> {0, kBack2[k0]}], kBack2[k0]]; kF1 = If[({Xi} \[Intersection] blockedSites - 1) != {}, RandomChoice[{1/2, 1/2} -> {0, kFor1[k0]}], kFor1[k0]]; kF2 = If[({Xi} \[Intersection] blockedSites - 2) != {}, RandomChoice[{1/2, 1/2} -> {0, kFor2[k0]}], kFor2[k0]]; newCoords = RandomChoice[{kB1, kB2, kF1, kF2} -> {Xi - 1, Xi - 2, Xi + 1, Xi + 2}]; dt = RandomReal[ExponentialDistribution[kB1 + kB2 + kF1 + kF2]]; t = simT; {Xi, simT} = {newCoords, t + dt} ]  FindRate[k0_] := Module[{}, kB1 = If[({Xi} \[Intersection] blockedSites + 1) != {}, RandomChoice[{1/2, 1/2} -> {0, kBack1[k0]}], kBack1[k0]]; kB2 = If[({Xi} \[Intersection] blockedSites + 2) != {}, RandomChoice[{1/2, 1/2} -> {0, kBack2[k0]}], kBack2[k0]]; kF1 = If[({Xi} \[Intersection] blockedSites - 1) != {}, RandomChoice[{1/2, 1/2} -> {0, kFor1[k0]}], kFor1[k0]]; kF2 = If[({Xi} \[Intersection] blockedSites - 2) != {}, RandomChoice[{1/2, 1/2} -> {0, kFor2[k0]}], kFor2[k0]]; newCoords = RandomChoice[{kB1, kB2, kF1, kF2} -> {Xi - 1, Xi - 2, Xi + 1, Xi + 2}]; dt = RandomReal[ExponentialDistribution[kB1 + kB2 + kF1 + kF2]]; t = simT; {Xi, simT} = {newCoords, t + dt} ]  Tweeted twitter.com/#!/StackMma/status/293897705065947136 occurred Jan 23 '13 at 1:47 3 added 2 characters in body edited Jan 22 '13 at 23:12 BeauGeste 1,38211 gold badge1919 silver badges3131 bronze badges This took me 1.33 seconds. The time is highly varying. The time increases dramatically as Xf increasesor increase. For some reason, when I used ParallelTable, I got identical results every time I calculated another iTable. Must be something with the seed going wrong. To get convergence, n needs to be increased. This took me 1.33 seconds. The time is highly varying. The time increases dramatically as Xf increases. For some reason, when I used ParallelTable, I got identical results every time I calculated another iTable. Must be something with the seed going wrong. To get convergence, n needs to be increased. This took me 1.33 seconds. The time is highly varying. The time increases dramatically as Xf or increase. For some reason, when I used ParallelTable, I got identical results every time I calculated another iTable. Must be something with the seed going wrong. To get convergence, n needs to be increased. 2 more explanation on how new sites are hopped to edited Jan 22 '13 at 22:46 BeauGeste 1,38211 gold badge1919 silver badges3131 bronze badges 1 asked Jan 22 '13 at 21:31 BeauGeste 1,38211 gold badge1919 silver badges3131 bronze badges