Created
June 3, 2014 17:38
-
-
Save oerpli/9a8752b630126e33ad85 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private int kinmc(int endtime, double eps) { | |
double m = 10; | |
double c = 0.01; | |
double time = 0; | |
int state = 0, nstate = 0; | |
double r01 = c * m; | |
double r02 = c; | |
double r1 = Math.Exp(-eps / 2); | |
double r2 = Math.Exp(-eps); | |
double[] rtot = { r01 + r02, r1, r2 }; | |
double[] swtime = new double[3]; | |
while(time <= endtime) { | |
state = nstate; | |
if(state == 0) | |
nstate = rng.NextDouble() * rtot[state] > r01 ? 2 : 1; | |
else | |
nstate = 0; | |
time += expverteilung(rtot[state]); | |
} | |
return state; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment