  function [steps,j] = WhichRoot(z0)
%
% z0 is a complex scalar
%  
% steps,j   The Newton iteration for f(z) = z^4 -1 is applied
%           with starting value z0. j is the index of the root
%           to which the iteration converges and steps is the
%           number of steps of steps required to get within
%           rho of that root. 

rho =   0.4359;  %the radius of convergence as found by FindRho2
roots = [1 i -1 -i];
steps = 0;
z = z0;
[minr,j] = min(abs(roots - z));
while minr > rho
   z = (3*z.^4 +1)./(4*z.^3);
   [minr,j] = min(abs(roots - z));
   steps = steps+1;
end