clear;
n=1001;
tic;
a=sparse(n,n);
for i=1:n
    a(i,i)=1-2*0.1*10^(-3)/(0.01^2);
    if i<n
        a(i,i+1)=(0.1*10^(-3)/0.01^2)+(5*10^(-3)/(2*0.01));
    end
    if i>1
        a(i,i-1)=(0.1*10^(-3)/0.01^2)-(5*10^(-3)/(2*0.01));
    end
end
b=zeros(n,1);
c=zeros(n,1);
for i=0:(n-1)
    b(i+1)=10*sin(100*0.01*i);
    c(i+1)=abs(sin(100*0.01*i))*0.25+abs(10*cos(100*0.01*i)*1);
end
b(i+1)=0;
toc
tic;
x=a\b;
toc
tic
w=abs(inv(a));
y=w*c;
lowerl0=x-y;
upperl0=x+y;
toc