  function d = Beam1_sol(n)
% d is a column n-vector with the property that d(k) is the displacement
% of the cantilever at x = k/n.
d = zeros(n,1);
% Solve Rn*y = b where  b = ones(n,1)/n^4. Store y in d...
d(n) = 1;
d(n-1) = 1 + 2*d(n);
for k=n-2:-1:2
    d(k) = 1 + 2*d(k+1)- d(k+2);
end
d(1) = (1 +2*d(2)-d(3))/2;
% Solve Rn'd = y
d(1) = d(1)/2;
d(2) = d(2) + 2*d(1);
for k=3:n
    d(k) = d(k)+2*d(k-1)-d(k-2);
end
d = d/n^4;

% From the first loop  (replacing "d" with "e") 
%       e(k) = 1 + e(k+1) + (e(k+1)-e(k+2)) > e(k+1)
% it follows that e(1) > e(2) >... e(n-1) > e(n) = 1.
% Key is that after the first loop, all th eentries in e are positive
%
% From the second loop
%      d(k) = e(k) + d(k-1) + (d(k-1)-d(k-2))
% so
%      d(k)-d(k-1) > d(k-1)-d(k-2) 
% Since d(1) = e(1)/2  and d(2) = e(2) + e(1)>d(1) we see that
%   d(1) > d(2) > ... > d(n)
% Beam1 (Hung) 1 point for informal proof. , 2 for th eU solve, 
% 2 for the U' solve. -1 if they
% don't see how to overwrite. -2 if the set up sparse U.