B1[i] = spline_ys[i];

        A1[i+1] = [];
        for(var j = 0; j < 4-1; ++j)
            A1[i+1][j+1] = Math.pow(spline_xs[i], j) * (j+1);
        A1[i+1][0] = 0.0;
        B1[i+1] = (spline_ys[i+1] - spline_ys[i]) / (spline_xs[i+1] - spline_xs[i]);
    }
    X1 = solved_linear(A1, B1, 4);

    // spline2
    var A2 = [];
    var B2 = [];
    for(var i = 0; i < 4; i += 2) {
        A2[i] = [];
        for(var j = 0; j < 4; ++j){
            A2[i][j] = Math.pow(spline_xs[i+2], j);
        }
        B2[i