var n = ..
var eps = 1.11E-16;
var converge = function(xk, xkp){
for (var i = 0; i < n; i++)
if(Math.abs(xk[i] - xkp[i]) >= eps) return false;
return true;
}
do{
for(var i = 0; i < n; i++){
var v = 0;
for (j = 0; j < n; j++)
if (j != i) v += (a[i][j] * x[j]);
p[i] = x[i];
x[i] = (b[i] - v) / a[i][i];
}
}
while (!converge(x, p));