
02.03.2010, 10:50
|
|
Познающий
Регистрация: 22.11.2009
Сообщений: 53
С нами:
8667664
Репутация:
0
|
|
for(j=0;j < NumberOfEquation;j++) {
TempSolution[j] = 0;
}
for(i=0;i < NumberOfEquation;i++) {
for(j=0;j < NumberOfEquation;j++) {
TempSolution[i] = TempSolution[i] + A[i][j]*solution[j];
}
TempSolution[i] = TempSolution[i] + B[i];
}
//расчет погрешности
fault = 0.0;
for(j=0;j < NumberOfEquation;j++) {
fault = fault + (solution[j] - TempSolution[j])*(solution[j] - TempSolution[j]);
}
fault = sqrt(fault);
//сохранение последующих приближенных значений неизвестных
for(j=0;j < NumberOfEquation;j++) {
solution[j] = TempSolution[j];
}
step++;
}
}
return step;
}
void DOS_input_output() {
int i, j;
int size;
double **A, *B, *solution, fault_input;
cout << "Решение СЛАУ методом простых итераций.\n";
cout << "Введите размерность матрицы: ";
cin >> size;
A = new double*[size];
|
|
|