% Script Eg5_1
% Examines relative error associated with MySqrt.

  close all
  nVals = 100;
  A = logspace(-20,20,nVals);
  relErr = zeros(1,nVals);
  for i=1:nVals
      relErr(i) = abs(MySqrt(A(i)) - sqrt(A(i)))/sqrt(A(i)) + 10^-16;
  end
  loglog(A,relErr)
  axis([10^-20 10^20 10^-17  10^-11])
  title('Relative Error in MySqrt(A)','FontSize',14)
  xlabel('A','FontSize',14)
  ylabel('Relative Error','Fontsize',14)
  shg
      