sum(1) = 1;
z = .99;
a = zeros(1500,1);
sum = zeros(1500,1);
Ssum = zeros(100,1);
a(1) = 1;
sum(1) = a(1);
format long
sumex = 1/(1+z)
for i = 2:1500   
    a(i)   = - z*a(i-1);
    sum(i) = sum(i-1) + a(i);
end
sum-sumex
for i = 1:100
    Ssum(i) = (sum(i+2)*sum(i)-sum(i+1)^2)/(sum(i+2)+sum(i)-2*sum(i+1));
end
Ssum-sumex
