«  »

Вычисление определенного интеграла методами трапеций и средних прямоугольников











2- : ..

: ..

, 1997

.

, .

(.1).
(.2)
(.3).

. 1. .

. 2. .

. 3. .


,
- (), ,
- (),

, .


:

,

:

.

.

.

. 4. integral.pas.

.

Tubro Pascla 6.0 MS-DOS.
:

program Integral;

uses

Crt, Dos;

var

dx,x1,x2,e,i:real;

function Fx(x:real):real;

begin

Fx:=2+x; { , .}

end;

procedure CountViaBar;

var

xx1,xx2:real;

c:longint;

begin

writeln('------------------------------------------------');

writeln('--> .');

writeln(' :',round(abs(x2-x1)/e));

i:=0;

for c:=1 to round(abs(x2-x1)/e) do begin

write(' ',c,chr(13));

xx1:=Fx(x1+c*e);

xx2:=Fx(x1+c*e+e);

i:=i+abs(xx1+xx2)/2*e;

end;

writeln('------------------------------------------------');

writeln('=',i);

end;

procedure CountViaTrap;

var

xx1,xx2,xx3:real;

c:longint;

begin

writeln('------------------------------------------------');

writeln('--> .');

writeln(' :',round(abs(x2-x1)/e));

i:=0;

for c:=1 to round(abs(x2-x1)/e) do begin

write(' ',c,chr(13));

xx1:=Fx(x1+c*e);

xx2:=Fx(x1+c*e+e);

if xx2>xx1 then xx3:=xx1 else xx3:=xx2;

i:=i+abs(xx2-xx1)*e+abs(xx3)*e;

end;

writeln('------------------------------------------------');

writeln('=',i);

end;

begin

writeln('------------------------------------------------');

writeln('-= =-');

writeln(' :');

write(' x (x1)=');Readln(x1);

write(' x (x2)=');Readln(x2);

write(' (e)=');Readln(e);

CountViaBar;

CountViaTrap;

writeln('------------------------------------------------');

writeln(' ;^)');

end.

. .

:

------------------------------------------------

-= =-

:

x (x1)=0

x (x2)=10

(e)=0.01

------------------------------------------------

--> .

:1000

------------------------------------------------

= 7.0100000000E+01

------------------------------------------------

--> .

:1000

------------------------------------------------

= 7.0150000001E+01

------------------------------------------------

;^)

, 0 10, 0,01.

:

.

.

.

0,1:

.

.

.

.

,

, .

(
, ),
. ,
.
,

.

(
)
.



.

.

.., ..
. .: 1989 .

.. Turbo Pascal. .1992 .

.. : . . 1988 .


?
?
?