  function ok = StepIsIn(x,fx,fpx,a,b)
%
% Pre:  
%     x     current iterate.
%     fx    the value of f  at x.
%     fpx   the value of f' at x.
%     a,b   [a,b] is the interval of interest.
% Post:
%    ok    1 if the Newton step  x - fx/fxp is in [a,b].
%          0 if not.
%
   if fpx > 0
      ok = ((a-x)*fpx <= -fx) & (-fx <= (b-x)*fpx);
   elseif fpx < 0
      ok = ((a-x)*fpx >= -fx) & (-fx >= (b-x)*fpx);
   else
      ok = 0;
   end
