function bsundo
% bsundo Restores previous search bracket [PHYS210-bs]
%
% Restores the previous bracket, so if you entered bslow when you 
% should have used bshigh, type
% 
%     >> bsundo
%     >> bshigh
%
% and if you entered bshigh when you should have used bslow, type
%
%     >> bsundo
%     >> bslo
%
% Can be applied repeatedly to return to any bracket generated during 
% the search.
%
% Input arguments 
% 
%     None
%
% Output arguments
%
%     None, but prints complete history of search using bsdisp
%     and then the midpoint value.
   global Bs_low Bs_high Bs_tol Bs_progress;
   if ~ bsinitialized
      warning('Search not initialized.  Use bsnew(low, high)');
      return;
   end
   if length(Bs_progress) == 0 
      fprintf('Nothing to undo.\n');
      return;
   end
   if Bs_progress(end) == 0
      Bs_low(end) = [];
   else
      Bs_high(end) = [];
   end
   Bs_progress(end) = [];
   bsdisp;
   fprintf('\n%.16e\n', bscurrent);
end
