.


:




:

































 

 

 

 


Gauss_Haleckij(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_Zaidel(int n, float a[n][n], float b[n], float eps, int count, float x[n]);

2. n ,

3. :

float a[n][n]; //

float b[n]; //

float x[n]; // ( )

4. a[n][n] b[n],

5. eps count,

6. :

Gauss_Zaidel(n, a, b, eps, count, x);

7. ( ) .

:

x1 + 0,17x2 - 0,25x3 + 0,54x4 = 0,3;

0,47x1 + x2 + 0.67x3 - 0,32x4 = 0,5;

-0,11x1 + 0,35x2 + x3 - 0,74x4 = 0,7;

0,55x1 + 0,43x2 + 0,36x3 - x4 = 0,9;

n=4;

1.0 0,17 0,25 0,54 0,3

a[4][4]= 0,47 1.0 0.67 0,32 b[4] = 0,5

-0,11 0,35 1.0 0,74 0,7

0,55 0,43 0,36 1.0 0,9

:

#include <stdio.h>

#include <math.h>

#include <conio.h>

int Gauss_Zaidel(int n, float a[n][n], float b[n], float eps, int count, float x[n]);

int main(int argc, char **argv)

{

int n; //

int count; //

int i,j; //

printf("\n porjadok sistemy uravn. n=");

scanf("%d", &n);

float a[n][n]; //

float b[n]; //

float x[n]; //

float eps; //

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 (%d chisel):\n", n);

for (i=0; i<n; i++)

scanf("%f", &b[i]);

printf("\n");

printf("\n pogreshn. vychisl. eps=");

scanf("%g", &eps);

printf("\n max kolich. iteraciy count=");

scanf("%d", &count);

Gauss_Zaidel(n, a, b, eps, count, x);

printf("\n Reshenie sistemy uravn.:\n");

for (i=0; i<n; i++)

printf("%10.5f", x[i]);

printf("\n");

Return 0;

}

:

,

x1=0.441 x2=-0.363 x3=1.667 x4=0.3935

 


:

1. :

int nesovmest(int n, int kk, float a[kk][n], float b[kk], float x[n], float y[kk], float *s0);

2. n ,

3. k (k>n),

4. :

float a[n][n]; //

float b[n]; //

float x[n]; //

float y[n]; //

5. a[n][n] b[n],

6. :

nesovmest(n, k, a, b, x, y, &s0);

7. ( ) ,

:

2x1 + 3x2 = 5;

x1 - 2x2 = 7;

2x1 - x2 = 8;

n=2, k=3;

2 3 5

a[3][2]= 1 -2 b[3]= 7

2 -1 9

:

#include <stdio.h>

#include <math.h>

#include <conio.h>

int nesovmest(int n, int kk, float a[kk][n], float b[kk], float x[n], float y[kk], float *s0);

int main(int argc, char **argv)

{

int n; //

int k; // (k>n)

float s0; //

int i,j; //

printf("\n Kol-vo neizvestn. n=");

scanf("%d", &n);

printf("\n Kol-vo uravnen. (k>n) k=");

scanf("%d", &k);

float a[k][n]; //

float b[k]; //

float x[n]; //

float y[k]; //

printf("\n vvedite matrizu koeff. sistemy postrochno:\n");

for (i=0; i<k; i++)

{

printf("\n stroka %d (%d znachenij):\n", i+1, n);

for (j=0; j<n; j++)

scanf("%f", &a[i][j]);

}

printf("\n");

printf("\n vvedite vektor svobodn. chlenov (%d znachenij):\n", k);

for (i=0; i<k; i++)

scanf("%f", &b[i]);

printf("\n");

nesovmest(n, k, a, b, x, y, &s0);

printf("\n Ocenki neizvestnyh:\n");

for (i=0; i<n; i++)

printf("%10.5f", x[i]);

printf("\n");

printf("\n Vector nevjazok:\n");

for (i=0; i<k; i++)

printf("%10.5f", y[i]);

printf("\n");

printf("\nSrednekv. nevjazka: %e\n", s0);

Return 0;

}

:

,

x1=3.902 x2=-1.057


:

1. :

int Steffensen(int n, float eps, int count, float x[n], float y[n]);

2. n ,

3. eps ,

4. count ,

5. :

float x[n]; //

float y[n]; //

6. :

void pr_chasti(int n, float x[n], float b[n])

b[i]=b(x[j]); i,j=0n-1,

7. x[n] ,

8. :





:


: 2017-03-11; !; : 264 |


:

:

,
==> ...

1731 - | 1672 -


© 2015-2024 lektsii.org - -

: 0.021 .