function [red]=red(r,sigma,t,S,T,E,eta,ti)
%Returns the boundary condition for call options as a function on the
%linspace vector [-m,m] with step size 1/[exp(m^4)], and 2m[exp(m^4)]+1 steps.
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;
for (j=1:nsteps1)
    red2(j)=E*max([0 exp(0.5*(k+1)*x(j))-exp(0.5*(k-1)*x(j))]);  
end
for (i=1:2)
    for (j=1:nsteps1)
        if (i==1)
        red(i,j)=x(j);
        else
            red(i,j)=red2(j);
        end
    end
end
end

