printf("\n Obratnaja matrica:\n");
for (i=0; i<n; i++)
{
for (j=0; j<n; j++)
printf("%10.5f", invert[i][j]);
printf("\n");
}
printf("\n");
return 0;}
:
:
- :
int Gauss(int n, float a[n][n], float b[n], float x[n]);
- n ,
- :
float a[n][n]; //
float b[n]; //
float x[n]; // ( )
- a[n][n] b[n],
- :
Gauss(n, a, b, x)
- ( ) .
:
x1 3x2 + 2x3 = 5;
3x1 - 4x2 = 7;
2x1 - 5x2 + 3x3 = 9;
n=3;
1 -3 2 5
a[3][3]= 3 -4 0 b[3]= 7
2 -5 3 9
:
#include <stdio.h>
#include <math.h>
#include <conio.h>
int Gauss(int n, float a[n][n], float b[n], float x[n]);
int main(int argc, char **argv)
{
int n; //
int i,j; //
printf("\n porjadok sistemy uravn. n=");
scanf("%d", &n);
float a[n][n]; //
float b[n]; //
float x[n]; //
printf("\n vvedite matrizu koeff. sistemy postrochno:\n");
for (i=0; i<n; i++)
{
printf("\n stroka %d (%d chisel):\n", i+1, n);
for (j=0; j<n; j++)
scanf("%f", &a[i][j]);
}
printf("\n");
printf("\n vvedite vektor svobodn. chlenov:\n");
for (i=0; i<n; i++)
scanf("%f", &b[i]);
printf("\n");
Gauss(n, a, b, x);
printf("\n Reshenie sistemy uravn.:\n");
for (i=0; i<n; i++)
printf("%10.5f", x[i]);
printf("\n");
Return 0;
}
:
,
x1=5.0 x2=2.0 x3=3.0
:
1. :
int Gauss_Haleckij(int n, float a[n][n], float b[n], float x[n]);
2. n ,
3. :
float a[n][n]; //
float b[n]; //
float x[n]; // ( )
4. a[n][n] b[n],
5. :
Gauss_Haleckij(n, a, b, x);
6. ( ) .
:
|
|
x1 3x2 + 2x3 = 5;
3x1 - 4x2 = 7;
2x1 - 5x2 + 3x3 = 9;
n=3;
1 -3 2 5
a[3][3]= 3 -4 0 b[3]= 7
2 -5 3 9
:
#include <stdio.h>
#include <math.h>
#include <conio.h>
int Gauss_Haleckij(int n, float a[n][n], float b[n], float x[n]);
int main(int argc, char **argv)
{
int n; //
int i,j; //
printf("\n porjadok sistemy uravn. n=");
scanf("%d", &n);
float a[n][n]; //
float b[n]; //
float x[n]; //
printf("\n vvedite matrizu koeff. sistemy postrochno:\n");
for (i=0; i<n; i++)
{
printf("\n stroka %d (%d chisel):\n", i+1, n);
for (j=0; j<n; j++)
scanf("%f", &a[i][j]);
}
printf("\n");
printf("\n vvedite vektor svobodn. chlenov:\n");
for (i=0; i<n; i++)
scanf("%f", &b[i]);
printf("\n");