- Joined
- 3/3/11
- Messages
- 22
- Points
- 11
I tried implementing the Euler discretization to approximate a stochastic process X that satisfies the stochastic differential equation. However, the result I got when compare with the standard Monte Carlo simulation is very far off so I assume I've made an error somewhere in this code. I'm implementing in Java and my Euler discretization equation is
for (int i = 0; i < n; i++) { //n is the no. of runs
for (int j = 0; j < m; j++) { //m is the no. of timesteps
X = X+mu*timestep + sigma*Math.sqrt(timestep)*random.nextGaussian();
}
}
Does anyone know whether I did it wrongly?
for (int i = 0; i < n; i++) { //n is the no. of runs
for (int j = 0; j < m; j++) { //m is the no. of timesteps
X = X+mu*timestep + sigma*Math.sqrt(timestep)*random.nextGaussian();
}
}
Does anyone know whether I did it wrongly?