C++ガウスサイド反復法,線形方程式群の解を求める(version 1.0)
455 ワード
#include
#include
using namespace std;
const int n=3;
void Gauss_Seidel();
double A[n][n]={{3,1,1},{1,3,-1},{3,1.0,-5.0}};//
double B[n]={5,3,-1}; ///
int main()
{
Gauss_Seidel();
}
void Gauss_Seidel()
{
double X[n]={0,0,0,};
for (int k=0;k<1000;k++)
{
for(int i=0;i