         }
            B[i+1] -= B[j]*r;
        }

    // calculate xs
    X[n-1] = B[n-1] / underflow_padded(A[n-1][n-1]);
    for (var i = n-2; i >= 0; --i){
        var s = 0.0;
        for (var j = i; j < n; ++j){
            s = s + A[i][j]*X[j];
        }
        X[i] = (B[i] - s) / underflow_padded(A[i][i]);
    }
    return X;
}

function polynomial_in_x(A, x, n){
    var y = 0.0;
    for(var i = 0; i < n; ++i){
        y += A[i] * Math.pow(x, i);
    }
    return y;
}

function draw_grid_on(contex