1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
var n = xs.length-1; var A = this.zerosMat(n+1, n+2); for(var i=1; i<n; i++) { A[i][i-1] = 1/(xs[i] - xs[i-1]); A[i][i] = 2 * (1/(xs[i] - xs[i-1]) + 1/(xs[i+1] - xs[i])) ; A[i][i+1] = 1/(xs[i+1] - xs[i]); A[i][n+1] = 3*( (ys[i]-ys[i-1])/((xs[i] - xs[i-1])*(xs[i] - xs[i-1])) + (ys[i+1]-ys[i])/ ((xs[i+1] - xs[i])*(xs[i+1] - xs[i])) ); } A[0][0] = 2/(xs[1] - xs[0]); A[0][1] = 1/(xs[1] - xs[0]); A[0][n+1] = 3 * (ys[1] - ys[0]) / ((xs[1]-xs[0])*(xs[1]-xs[0])); A[n][n-1] = 1/(xs[n] - xs[n-1]); A[n][n] = 2/(xs[n] - xs[n-1]); A[n][n+1] = 3 * (ys[n] - ys[n-1]) / ((xs[n]-xs[n-1])*(xs[n]-xs[n-1])); return this.solve(A, ks); } |
Решаем сложные задачи на Javascript 😃 Думаю тут я надолго засел и теперь ушел из жизни на пару дней. Кто нибудь можно обьяснить что за расчеты здесь?