function [green] = green(r,sigma,t,S,T,E,eta,ti,yellow)
%Applies the inverse ns fourier transform on an array [0,ti]x
%[-m^2,m^2] with ti^2+1 steps and 2m^2[exp(m^4)]+1 steps respectively.
z=log(eta);
m=z^0.25;
square=m^2;
quart=m^4;
a=2*m*eta;
b=rem(a,1);
steps1=a-b;
nsteps1=steps1+1;
c=2*square*eta;
d=rem(c,1);
steps2=c-d;
nsteps2=steps2+1;
stepsize=1/eta;
steps3=ti^2;
nsteps3=steps3+1;
stepsizeti=1/ti;
x=linspace(-m,m,nsteps1);
k=(2*r)/sigma^2;
v=2/(sigma^2*ti);
w=rem(T,v);
T1=T-w;
k1=(0.5*ti*sigma^2*T1);
steps4=T1/v;
nsteps4=steps4+1;
for (t=1:k1+1)
    for (j=1:nsteps2)
    hatf(t,j)=yellow(3,t,j);
end
end
    for (t=1:k1+1)
        for (j=1:nsteps2)
            s(j)=(-square*eta+(j-1))*stepsize;
        gamma(t,j,1)=stepsize*hatf(t,1)*exp(pi*i*(-square)*s(j));
        for (k=2:nsteps2)
            u(k)=(-square*eta+(k-1))*stepsize;
            gamma(t,j,k)=gamma(t,j,k-1)+stepsize*hatf(t,k)*exp(pi*i*u(k)*s(j));
        end
        end
    end
    for (t=1:k1+1)
        for (j=1:nsteps2)
            f(t,j)=gamma(t,j,nsteps2);
        end
    end
    
    for (a=1:3)
    for (t=1:k1+1)
        for (j=1:nsteps2)
    if (a==1)
        green(a,t,j)=yellow(a,t,j);
    elseif (a==2)
        green(a,t,j)=yellow(a,t,j);
    else
        green(a,t,j)=f(t,j);
    
    end
end


end
end
end


