.


:




:

































 

 

 

 





#include "stdafx.h"

#include <iostream>

#include <iomanip>

#include <math.h>

#include <stdio.h>

using namespace std;

 

long double eps=0.00001;

 

long double A[3][3]={{3.5, -1.7, 2.8}, {2.7, 3.3, 1.3}, {1.4, 2.5, -3.0}};

long double B[3]={1.7, 2.1, -1.3};

long double D[3], C[3][3];

long double n[3], p[3]={1.7, 2.1, -1.3};

 

bool check(long double X1[3], long double X2[3])

{

for (int i=0; i<3; i++)

if (abs(X1[i]-X2[i])>=eps) return true;

return false;

}

 

void Zeydel ()

{

n[0]=C[0][1]*p[1]+C[0][2]*p[2]+D[0];

n[1]=C[1][0]*n[0]+C[1][2]*p[2]+D[1];

n[2]=C[2][0]*n[0]+C[2][1]*n[1]+D[2];

}

 

int _tmain(int argc, _TCHAR* argv[])

{

setlocale(LC_ALL, "rus");

for (int i=0; i<3; i++)

{

D[i]=B[i]/A[i][i];

for (int j=0; j<3; j++)

{

C[i][j]=-A[i][j]/A[i][i];

}

C[i][i]=0;

}

 

cout << "" << "\tx1" << "\t\t\tx2" << "\t\t\tx3" << endl;

 

Zeydel();

 

int i=0;

while (check(n,p))

{

p[0]=n[0]; p[1]=n[1]; p[2]=n[2];

Zeydel();

i++;

cout<< i << "\t " << setprecision(15) << n[0] << "\t" << n[1] << "\t" <<n[2] << endl;

};

cout<<"\n\n: x1 = " << n[0] << endl << "\t x2 = " << n[1] << endl << "\t x3 = " << n[2] << "\n\n";

 

 

system ("pause");

return 0;

}

 

 

 

 

 

 

, Wolfram alpha:

 

 

, (Epsilon = 0.001)

 

 

 





:


: 2015-10-01; !; : 903 |


:

:

- , 20 40 . - .
==> ...

1462 - | 1428 -


© 2015-2024 lektsii.org - -

: 0.011 .