.


:




:

































 

 

 

 





 

". " :

- ;

- , .

. , . : ; ; ; ; .

Turbo Pascal MS Excel.

 

 

 

, :

1.

2. .

3. .

4. :

a. .

b. - .

c. MS Excel.

d. .

5. .

 

 

1.

, (1.1)

- .

- , , , , .

, (1.1). , . , - , - , . , .

, (1.1) , , .

:

1. , , (1).

2. .

.

, (1.1), . Ox (. 1). (1.1)

, (1.2)

- , . (1.2), (1.1) (.2).

: , .. , ; -

 

, . - , , , .

, .

 

 


. 1. . 2.

 

. - .

. , , . , , , - . , ,  
. (.3). , - -

 


. 3.

 

 

, .. , . , , , .

. =0,0001. . -

(. 4). , . . : ; . , .


. 4.

 

.

.

.

.

.

 

 

1.

a b c f(a) f(c)
      0.5 0.5 -0.57436 <0
  0.5 0.5 0.25 0.5 -0.07951 <0
  0.25 0.25 0.125 0.5 0.19905 >0
0.125 0.25 0.125        

.

program equation; { }

Uses crt;

Var

a,b: real; { }

c: real; { }

e: real; { }

function f(x: real): real;

Begin

f: = sqr(x-1) - 0.5*exp(x); { f(x) }

End;

Begin

writeln (' : ');

write (' a = '); readln (a);

write (' b = '); readln(b);

write (' e = '); readln (e);

writeln(' : ');

while abs (b - a) > 2*e do

Begin

c: = (a + b) / 2;

if f(c) = 0 then

Begin

writeln(' c = ', c: 8: 6, ' f(c) = ', f(c): 8: 6);

Readln;

Exit;

End;

if f(a) * f(c) < 0 then b: = c else a: = c;

End;

c: = (a + b) / 2;

writeln(' c = ', c: 8: 6, 'f(c) = ', f(c): 8: 6);

Readln;

End.

 

: a = 0, b = 1, e = 0.0001. : = 0.213287; f (c) = 0.000047.

: 0,2133 0,0001.

. ( , ) 0,0001.

2.

   
   
   
   
   

 

 

2.

() . , , . , .

n n :

(2.1)

, { aij }, i, j = 1, 2, , n, - ( ) { bi }, i = 1, 2, , n. n x1, x2, , xn, .

. . , . () . , , , .

.

. - ( ). , . , . :

- ;

- .

, ( ).

. :

 

 

(-a21/a11), .. 0,5.

-2x1 0,5x2 + 0,5x3 = -1,5.

(2.2),

2,5x2 + 1,5x3 = -0,5.

, x1 .

(2.2) (-a31/a11), .. 0,25.

-x1 0,25x2 + 0,25x3 = -0,75.

(2.2),

-1,25x2 + 2,25x3 = 4,25.

, x1 .

, (2.2)

4x1 + x2 x3 = 3

-2,5x2 + 1,5x3 = -0,5 (2.3)

-1,25x2 + 2,25x3 = 4,25

x2 (2.3), (2.3), 0,5.

4x1 + x2 x3 = 3

-2,5x2 + 1,5x3 = -0,5 (2.4)

1,5x3 = 4,5

, - . (2.4) x3. , .. . x3, x2, x1. : x1 = 1; x2 = 2; x3 = 3. .

:

program SLAU1; { }

Uses crt;

const n=3;

var a:array [1..n,1..n] of real;

b,x: array [1..n] of real;

i,j,k: integer; c,s: real;

Begin

{ }

for i:=1 to n do

Begin

writeln ( ,i);

for j:=1 to n do read (a[i,j]);

writeln ( ,i);

readln (b[i]);

End;

{ }

for k:=1 to n-1 do

Begin

for i:=k+1 to n do

Begin

c:=-a[i,k]/a[k,k]; a[i,k]:=0;

for j:= k+1 to n do a[i,j]:=a[i,j]+c*a[k,j];

b[i]:=b[i]+c*b[k];

End;

End;

{O }

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

for i:=n-1 downto 1 do

Begin

s:=0;

for j:=i+1 to n do s:= s+a[i,j]*x[j];

x[i]:=(b[i]-s)/a[i,i];

End;

{ }

writeln ( );

for i:=1 to n do write (x[i]:8:4);

Writeln;

End.

-.

, . . , { aij } ( ). (2.1) :

(2.5)

 

, (2.5) ( ):

(2.6)

 

, :

(2.7)

 

.

i- , . i- k- n :

i = 1, 2, , n; k = 1, 2, (2.8)

, xi(k), xi(k-1). d. e > 0

. (2.9)

. , .

, , :

, (2.10)

(2.10) .

- (2.2). , (2.10) .

 

, .. x2(0) = x3(0)= 0.

:

 

 

 

 

:

 

, :

x1(3) = 0,984; x2(3) = 1,981; x3(3) = 2,953;

x1(4) = 1,015; x2(4) = 1,992; x3(4) = 2,988;

x1(5) = 0,999; x2(4) = 1,993; x3(3) = 2,997.

, , , , . e = 0,02, . , , , e = 0,00001 11 , x1(11) = 1,000000; x2(11) = 1,999998; x3(11) = 2,999999.

- . , .

program SLAU2; { -}

Label 1,2,3;

const n=3;

var a:array [1..n,1..n] of real;

b,x:array [1..n] of real;

i,j,k,m:integer;

e,s,d,d1,c:real;

Begin

{ }

for i:=1 to n do

Begin

writeln ( ,i);

for j:=1 to n do read (a[i,j]);

writeln ( ,i);

readln (b[i]);

End;

writeln (' ');readln (e);

writeln (' - ');readln (m);

for i:=2 to n do x[i]:=0;

{ }

k:=1;

Repeat

d1:=0;

for i:=1 to n do

Begin

s:=0;

for j:=1 to n do

Begin

if i=j then goto 1;

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

End;

c:=(b[i]-s)/a[i,i];

d:=abs(c-x[i]);

if d1<d then d1:=d;

x[i]:=c;

End;

k:=k+1;

if k>m then goto 2;

until d1<e;

{ }

writeln ( );

for i:=1 to n do write (x[i]:8:4);

Writeln; goto 3;

2: writeln (' ');

End.

 

. .

3.

 

 
  - ()
 
  - ()
 
  - ()
 
  - ()
 
  - ()

 

3.

() . , , . : , .

. :

4.

, () ,

-1, (3.1)

- , - , . (3.1) ,

(3.2)

a .

, Q .

 

- - . 5.

. . , (3.1), , ,

(3.3)

 

: , , , .

. ,

(3.4)

. (3.4)

, (3.5)

.





:


: 2016-12-18; !; : 393 |


:

:

80% - .
==> ...

1365 - | 1221 -


© 2015-2024 lektsii.org - -

: 0.159 .