 0.0];
    var x1 = (-A[0][1]*B[1] + A[1][1]*B[0]) / d;
    var x2 = ( A[0][0]*B[1] - A[1][0]*B[0]) / d;
    return [x1, x2];
}

// polynomial
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;
}

// algorithm
function pixel_in(x, y) {
    var in_pixels_i = Math.floor(y / pixel_size);
    var in_pixels_j = Math.floor(x / pixel_size);
    if(in_pixels_i >= pixels.length)
        return pixel_in(x, (pixels.length-1) * pix