for (var j = 0; j < N; ++j){
			Ai.push(Math.pow(points[i][0], j));
		}
		A.push(Ai);
		B.push(points[i][1]);
	}
	var P = solved_linear(A, B, N);
	return function(x) {
		var Px = 0;
		for(var i = 0; i < N; ++i) {
			Px += P[i] * Math.pow(x, i);
		}
		return Px;
	};
}

function approximation_with_weighted_interpolating_n(points, n, interpolating_n, weight) {
	const N = points.length;
	var A = [];
	var B = [];

	for (var i = 0; i < n; ++i){
		var Ai = []
		for (var j = 0; j < n; ++j){
			Ai.push(0);
			for(va