Research Article

The Implementation of Milstein Scheme in Two-Dimensional SDEs Using the Fourier Method

Listing 1

Code to approximate the double integrals and .
function [w,v,J1,J2] = F_year_J(N,h)
N=5; % Here N=P for the truncation of the series in (26)
T=1; h=T/N; s=sqrt(h); N1=randn; N2=randn; N7=randn; w=sN1; v=sN2;
f=0; g1=0; g2=0; z=0; N3=randn(1,N); N4=randn(1,N); N5=randn(1,N); N6=randn(1,N);
for n=1:N;
f=f+(n. (−2)); c=(1/12)−((2(pi). 2). (−1))f;
g1=g1+(n. (−1))N3(n);
g2=g2+(n. (−1)).N4(n);
z=z+(n. (−1)).(N3(n).N6(n)−(N5(n).N4(n)));
A=1./(2pi)z;
% to calculate formula (27)
end
B=(1/2)(wv);
d1=(−1/pi)sqrt(2h)g1−(2sqrt(hc)N7);
% to calculate formula (28)
d2=(−1/pi)sqrt(2h)g2−(2sqrt(hc)N7);
% to calculate formula (28)
J1=(1/2)hN1N2−(1/2)s(d2N1−(d1N2))+hA;
% to calculate formula (26)
J2=2B−J1;
end