function [x]=jacob2(a,b)
% Jacobi method to solve equations iteratively - fully vectorized
n=length(a);
% initial guess
x=diag(zeros(n));
error=1;
while error > 1.e-6
   err=(b-a*x)./diag(a);
   x=err+x;
   error=norm(err)/norm(x);
end
