Runge Kunta on SDE



Dear readers,

I want to apply the Runge Kunta fourth order scheme on the following SDE:

dX = aXdt + bXdW

where a,b are real, dW = sqrt(dt)N(0,1) is a wiener process.

When b=0 in my program all is fine, the solution is the same as in the deterministic case (Hopefully !), the problem I have is in the stochastic part, the scheme doesn't converge to the true solution:

X = X0exp(((a-b^2/2)t+bW)

where X0 is real.

Here is the small program that compute RK4:

function RungeKuntaApprox = RK4(N, M, X0, a, b, dt, dW)

L = (floor(1/dt)); % time step
RungeKuntaApprox = zeros(N*M,(floor(1/dt)));
Xtemp = X0;

for j = 1:L
W = sum(dW(:,1:j),2);
k1 = a*Xtemp*dt + b*Xtemp.*W;
k2 = a*(Xtemp + 0.5*k1)*dt + b*(Xtemp + 0.5*k1).*W;
k3 = a*(Xtemp + 0.5*k2)*dt + b*(Xtemp + 0.5*k2).*W;
k4 = a*(Xtemp + k3)*dt + b*(Xtemp + k3).*W;
Xtemp = Xtemp + 1/6*(k1 + 2*k2 + 2*k3 + k4);
RungeKuntaApprox(:,j) = Xtemp;
end

Thank's for your contribution !
DL
.