double* Calc(int n, double step, double left, double right) //метод прогонки { double* alpha = new double[n]; double* betta = new double[n]; double* A = new double[n]; double* B = new double[n]; double* C = new double[n]; double* D = new double[n]; double* y = new double[n + 1]; y[0] = lbc; y[n] = rbc; /*Прямой ход метода прогонки*/ for (int i = 1; i < n; i++) { double x = left + step * i; A[i] = 1 - p(x + step) * step / 2; B[i] = q(x) * step * step - 2; C[i] = 1 + p(x) * step / 2; D[i] = f(x) * step * step; } D[1] -= (1 - p(left) * step / 2) * y[0]; D[n - 1] -= (1 + p(right) * step / 2) * y[n]; alpha[1] = -C[1] / B[1]; betta[1] = D[1] / B[1]; for (int i = 2; i < n; i++) { alpha[i] = -C[i] / (A[i - 1] * alpha[i - 1] + B[i]); betta[i] = (D[i] - A[i - 1] * betta[i - 1]) / (A[i - 1] * alpha[i - 1] + B[i]); } y[n - 1] = betta[n-1]; /*Обратный ход метода прогонки*/ for (int i = n - 2; i > 0; i--) { y[i] = alpha[i] * y[i + 1] + betta[i]; } delete [] A; delete [] B; delete [] C; delete [] D; delete [] alpha; delete [] betta; return y; }