. , , ,

,,,

堠 1

1. 1

1.1. ࠠ 1

1.2. 4

1.3. ⠠ 6

2. 7

2.1 ࠠ 7

2.2 10

. , . ( ) .

. , , . , . , . .

, , . . , , . .

, . , , ( 100 . 75 ).

1.

1.1.

. ( ) 2000 .

. .

1.1.1. . , .

n - 1 .

1- . x1 i = 2, 3, , n. , a11 ¹ 0. 1- .

qi1 = ai1/a11 (i = 2, 3, , n),

1- . , , , n- , q21, q31, , qn1. x1 , .

a11x1 + a12x2 + a13x3 + + a1nxn = b1 ,

a22(1)x2 + a23(1)x3 + + a2n(1)xn = b2(1) ,

a32(1)x2 + a33(1)x3 + + a3n(1)xn = b3(1) ,

. . . . . . . . . . . . . . .

an2(1)x2 + an3(1)x3 + + ann(1)xn = bn(1) .

aij(1) bij(1)

aij(1) = aij − qi1a1j , bi(1) = bi − qi1b1.

2- . x2 i = 3, 4, , n. a22(1) ≠ 0, a22(1) , ( ) 2- . 2-

qi2 = ai2(1) / a22(1) (i = 3, 4, , n)

, , , n- , q32, q42, , qm2.

a11x1 + a12x2 + a13x3 + + a1nxn = b1 ,

a22(1)x2 + a23(1)x3 + + a2n(1) = b2(1) ,

a33(2)x3 + + a3n(2)xn = b3(2) ,

. . . . . . . . . . . . . . . . . . .

an3(2)x3 + + ann(2)xn = bn(2) .

aij(2) bij(2)

aij(2) = aij(1) qi2a2j(1) , bi(2) = bi(1) qi2b2(1).

. k- .

k- . , () k- akk(k1) , k-

qik = aik(k1) / akk(k1) (i = k + 1, , n)

(k + 1)-, , n- k-e , qk+1,k, qk+2,k, , qnk.

(n - 1)-

a11x1 + a12x2 + a13x3 + + a1nxn = b1 ,

a22(1)x2 + a23(1)x3 + + a2n(1)xn = b2(1) ,

a33(2)x3 + + a3n(2)xn = b3(2) ,

. . . . . . . . . . . . . . . . . . . .

ann(n1)xn = bn(n1) .

A(n-1) . .

. xn. xn , xn1. , xn1, xn2, , x1.

xn = bn(n1) / ann(n1),

xk = (bn(k1) ak,k+1(k1)xk+1 akn(k1)xn) / akk(k1), (k = n 1, , 1).

. , , akk(k1). , . , , , , .

1.1.2. ( ). . k- i = k + 1, , n

aij(k) = aij(k1) − qikakj , bi(k) = bi(k1) − qikbk(k1) , i = k + 1, , n.

, qik.

, |qik| ≤ 1 k = 1, 2, , n 1 i = k + 1, , n. , k- aikk xk i = k + 1, , n. ik k- , akk(k-1). xk , .

1.1.3. ( ). .

1- aij ai1j1. i1 . xi1 , .

k- aij(k1) i = k, , n aikjk(k-1). k- , , xjk i = k + 1, , n.

: xjn, xjn1, , xj1.

1.2.

1.2.1. , .

Ax = b

A,

x = Bx + c.

B bij (i, j = 1, 2, , n), c - cij (i = 1, 2, , n).

:

x1 = b11x1 + b12x2 + b13x3 + + b1nxn + c1

x2 = b21x1 + b22x2 + b23x3 + + b2nxn + c2

. . . . . . . . . . . . . . . . .

xn = bn1x1 + bn2x2 + bn3x3 + + bnnxn + cn

, , , , .

, , . x1:

x1 = a111 (b1 a12x2 a13x3 a1nxn),

x2:

x2 = a211 (b2 a22x2 a23x3 a2nxn),

. .

x1 = b12x2 + b13x3 + + b1,n1xn1 + b1nxn+ c1 ,

x2 = b21x1 + b23x3 + + b2,n1xn1 + b2nxn+ c2 ,

x3 = b31x1 + b32x2 + + b3,n1xn1 + b3nxn+ c3 ,

. . . . . . . . . . . . . . . . . . . . . . .

xn = bn1x1 + bn2x2 + bn3x3 + + bn,n1xn1 + cn ,

B .

bij = aij / aii, ci = bi / aii (i, j = 1, 2, , n, j ≠ i)

, , A .

1.2.1. .

0 0 0 0 0 b12 b13 b1n

b21 0 0 0 0 0 b23 b2n

B1 = b31 b32 0 0 , B2 = 0 0 0 b3n

. . . . . . . . . . . . . .

bn1 bn2 bn3 0 0 0 0 0

, B = B1 + B2 x

x = B1x + B2 x + c .

x(0) = [x1(0), x2(0), , xn(0)]T. B2 ,

x(1) = B1x(0) + B2x(1)

x(1),

x(2) = B1x(1) + B2x(2)

, x(0), x(1), , x(n),

x(k+1) = B1(k+1) + B2(k) + c

x1(k+1) = b12x2(k) + b13x2(k) + + b1nxn(k) + c1 ,

x2(k+1) = b21x1(k+1) + b23x3(k) + + b2nxn(k) + c2 ,

x3(k+1) = b31x1(k+1) + b32x2(k+1) + + b3nxn(k) + c3 ,

. . . . . . . . . . . . . . . . . . . . . . . . . .

xn(k+1) = bn1x1(k+1) + bn2x2(k+1) + bn3x3(k+1) + + cn .

, ,

xi(k+1) = xi(k) aii1(∑j=1i1 aijxj(k+1) + ∑j=1n aijxi(k) bi).

j=1, j≠i n | aij | < | aii |

( ).

-, , .

1.3.

, . .

, - - . , , . , , , . , , , . .

, .


2.

2.1

2.1.1. .

a11x1 + a12x2 + + a1nxn = b1 ,
a21x2 + a22x2 + + a2nxn = b2 ,
. . . . . . . . . . . . .

an1x1 + an2x2 + + annxn = bn

n ≤ 10 .

2.1.2. .

3,2x1 + 5,4x2 + 4,2x3 + 2,2x4 = 2,6 ,

2,1x1 + 3,2x2 + 3,1x3 + 1,1x4 = 4,8 ,

1,2x1 + 0,4x2 0,8x3 0,8x4 = 3,6 ,

4,7x1 + 10,4x2 + 9,7x3 + 9,7x4 = 8,4 ,

x1 = 5, x2 = 4, x3 = 3, x4 = 2.

2.1.3. . .

n . ReadSystem a b c , n Gauss. Gauss k- k- k- . , l. k- , k l . , Gauss c false. . x. WriteX.

2.1.4.

Uses CRT;

Const

maxn = 10;

Type

Data = Real;

Matrix = Array[1..maxn, 1..maxn] of Data;

Vector = Array[1..maxn] of Data;

{ }

Procedure ReadSystem(n: Integer; var a: Matrix; var b: Vector);

Var

i, j, r: Integer;

Begin

r := WhereY;

GotoXY(2, r);

Write('A');

For i := 1 to n do begin

GotoXY(i*6+2, r);

Write(i);

GotoXY(1, r+i+1);

Write(i:2);

end;

GotoXY((n+1)*6+2, r);

Write('b');

For i := 1 to n do begin

For j := 1 to n do begin

GotoXY(j * 6 + 2, r + i + 1);

Read(a[i, j]);

end;

GotoXY((n + 1) * 6 + 2, r + i + 1);

Read(b[i]);

end;

End;

{ }

Procedure WriteX(n :Integer; x: Vector);

Var

i: Integer;

Begin

For i := 1 to n do

Writeln('x', i, ' = ', x[i]);

End;

{ , }

Function Gauss(n: Integer; a: Matrix; b: Vector; var x:Vector): Boolean;

Var

i, j, k, l: Integer;

q, m, t: Data;

Begin

For k := 1 to n - 1 do begin

{ l k- }

l := 0;

m := 0;

For i := k to n do

If Abs(a[i, k]) > m then begin

m := Abs(a[i, k]);

l := i;

end;

{ k n k- ,

}

If l = 0 then begin

Gauss := false;

Exit;

end;

{ l- k- }

If l <> k then begin

For j := 1 to n do begin

t := a[k, j];

a[k, j] := a[l, j];

a[l, j] := t;

end;

t := b[k];

b[k] := b[l];

b[l] := t;

end;

{ }

For i := k + 1 to n do begin

q := a[i, k] / a[k, k];

For j := 1 to n do

If j = k then

a[i, j] := 0

else

a[i, j] := a[i, j] - q * a[k, j];

b[i] := b[i] - q * b[k];

end;

end;

{ }

x[n] := b[n] / a[n, n];

For i := n - 1 downto 1 do begin

t := 0;

For j := 1 to n-i do

t := t + a[i, i + j] * x[i + j];

x[i] := (1 / a[i, i]) * (b[i] - t);

end;

Gauss := true;

End;

Var

n, i: Integer;

a: Matrix ;

b, x: Vector;

Begin

ClrScr;

Writeln(' ');

Writeln;

Writeln(' (. 10)');

Repeat

Write('>');

Read(n);

Until (n > 0) and (n <= maxn);

Writeln;

Writeln(' ');

ReadSystem(n, a, b);

Writeln;

If Gauss(n, a, b, x) then begin

Writeln(' ');

WriteX(n, x);

end

else

Writeln(' ');

Writeln;

End.

(. 10)

>4

A 1 2 3 4 b

1 3.2 5.4 4.2 2.2 2.6

2 2.1 3.2 3.1 1.1 4.8

3 1.2 0.4 -0.8 -0.8 3.6

4 4.7 10.4 9.7 9.7 -8.4

x1 = 5.0000000000E+00

x2 = -4.0000000000E+00

x3 = 3.0000000000E+00

x4 = -2.0000000000E+00

2.2

2.2.1. .

a11x1 + a12x2 + + a1nxn = b1 ,
a21x2 + a22x2 + + a2nxn = b2 ,
. . . . . . . . . . . . .

an1x1 + an2x2 + + annxn = bn

n ≤ 10 .

2.2.2. .

4,1x1 + 0,1x2 + 0,2x3 + 0,2x4 = 21,14 ,

0,3x1 + 5,3x2 + 0,9x3 0,1x4 = 17,82 ,

0,2x1 + 0,3x2 + 3,2x3 + 0,2x4 = 9,02 ,

0,1x1 + 0,1x2 + 0,2x3 9,1x4 = 17,08 ,

x1 = 5,2, x2 = 4,2, x3 = 3, x4 = 1,8.

2.2.3. . n , e . ReadSystem a b c . . n e Seidel. Seidel , , false. . , . WriteX.

2.2.4. .

Uses CRT;

Const

maxn = 10;

Type

Data = Real;

Matrix = Array[1..maxn, 1..maxn] of Data;

Vector = Array[1..maxn] of Data;

{ }

Procedure ReadSystem(n: Integer; var a: Matrix; var b: Vector);

Var

i, j, r: Integer;

Begin

r := WhereY;

GotoXY(2, r);

Write('A');

For i := 1 to n do begin

GotoXY(i * 6 + 2, r);

Write(i);

GotoXY(1, r + i + 1);

Write(i:2);

end;

GotoXY((n + 1) * 6 + 2, r);

Write('b');

For i := 1 to n do begin

For j := 1 to n do begin

GotoXY(j * 6 + 2, r + i + 1);

Read(a[i, j]);

end;

GotoXY((n + 1) * 6 + 2, r + i + 1);

Read(b[i]);

end;

End;

{ }

Procedure WriteX(n :Integer; x: Vector);

Var

i: Integer;

Begin

For i := 1 to n do

Writeln('x', i, ' = ', x[i]);

End;

{ , }

Function Seidel(n: Integer; a: Matrix; b: Vector; var x: Vector; e: Data) :Boolean;

Var

i, j: Integer;

s1, s2, s, v, m: Data;

Begin

{ }

For i := 1 to n do begin

s := 0;

For j := 1 to n do

If j <> i then

s := s + Abs(a[i, j]);

If s >= Abs(a[i, i]) then begin

Seidel := false;

Exit;

end;

end;

Repeat

m := 0;

For i := 1 to n do begin

{ }

s1 := 0;

s2 := 0;

For j := 1 to i - 1 do

s1 := s1 + a[i, j] * x[j];

For j := i to n do

s2 := s2 + a[i, j] * x[j];

{ }

v := x[i];

x[i] := x[i] - (1 / a[i, i]) * (s1 + s2 - b[i]);

If Abs(v - x[i]) > m then

m := Abs(v - x[i]);

end;

Until m < e;

Seidel := true;

End;

Var

n, i: Integer;

a: Matrix;

b, x: Vector;

e: Data;

Begin

ClrScr;

Writeln(' ');

Writeln;

Writeln(' (. 10)');

Repeat

Write('>');

Read(n);

Until (n > 0) and (n <= maxn);

Writeln;

Writeln(' ');

Repeat

Write('>');

Read(e);

Until (e > 0) and (e < 1);

Writeln;

Writeln(' ');

ReadSystem(n, a, b);

Writeln;

{ }

For i := 1 to n do

x[i] := 0;

If Seidel(n, a, b, x, e) then begin

Writeln(' ');

WriteX(n, x);

end

else

Writeln(' ');

Writeln;

End.

(. 10)

>4

>.000001

A 1 2 3 4 b

1 4.1 0.1 0.2 0.2 21.14

2 0.3 5.3 0.9 -0.1 -17.82

3 0.2 0.3 3.2 0.2 9.02

4 0.1 0.1 0.2 -9.1 17.08

x1 = 5.2000000008E+00

x2 = -4.2000000028E+00

x3 = 3.0000000003E+00

x4 = -1.8000000000E+00

堠 1 1.

 

 

 

! , , , .
. , :