ight) + Math.pow(Math.abs(y - yi), weight));
}

function dx_from_linear(x, y) {
    var A = [[0.0, 0.0], [0.0, 0.0]];
    var B = [0.0, 0.0];
    for(var yi = y - nd * grid_size; yi <= y + nd * grid_size; yi += grid_size) {
        for(var xj = x - nd * grid_size; xj <= x + nd * grid_size; xj += grid_size) {
            var w = weight_of_point(x, y, xj, yi);
            A[0][0] += w;
            A[0][1] += w * (xj - x);
            A[1][0] += w * (xj - x);
            A[1][1] += w * Math.pow(xj - x, 2);
   