% 6.581 PS3 Qsn3
% estatic_svd.m

numSrcCharges   = 75;
numDestCharges  = 25;
sepX            = logspace(-2,5, 100);
separation      = zeros(size(sepX,2),3);
separation(:,1) = sepX';

for iter=1:length(sepX)
  N = 20;

  % produce a list of source charge points and destination charge points
  srcCharges       = rand(numSrcCharges,3);
  destCharges      = [rand(numDestCharges,1) + sepX(iter),
                      rand(numDestCharges,1),
                      rand(numDestCharges,1)];
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%                
  % a.) students fill in the interaction matrix %
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  for i=1:numSrcCharges
	 for j=1:numDestCharges
		A(i,j) = ;
	 end
  end

  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % b.) decompose A into eigenvalues and eigenvectors using svd command %
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % c.) create rank one, two, k approximations to A.                    %
  % use sort command to extract eigenvalues with largest magnitudes and %
  % corresponding eigenvectors                                          %
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
  r1A = ;
  r2A = ;
  r8A = ;
  
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  % d.) take a random charge vector and see how good the low rank %
  % approximation is                                              %
  %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
  
  q = rand(numDestCharges,1);
  r1error(iter) = ;
  r2error(iter) = ;
  r8error(iter) = ;

end

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% e.) plot errors as a function of separation distance %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
