Рефераты. Вычисление интеграла методом Ньютона-Котеса (теория и программа на Паскале)

x:=-600000;

newsc(ea);

setfillstyle(1,2);

bar(170,120,490,360);

setcolor(14);

rectangle(175,125,485,355);

rectangle(177,127,483,353);

settextstyle(0,0,0);

setfillstyle(1,1);

bar(180,170,480,190);

if ea mod 2 =0 then

begin

outtextxy(180,135,Функция распознана.Интеграл подсчитан.');

outtextxy(180,180,' Посмотреть значение интеграла');

outtextxy(180,210,'Посмотреть коэффициенты Ньютона-Котеса');

outtextxy(180,240,' Посмотреть значения функции');

outtextxy(180,270,' Посмотреть график' );

outtextxy(180,300,' Считать снова');

outtextxy(180,330,' Выход ');

end

else

begin

outtextxy(180,135,'Function Indentified.Integral counted.');

outtextxy(180,180,' View value of integral');

outtextxy(180,210,' View Newton-Cotes coefficients');

outtextxy(180,240,' Veiw values of function');

outtextxy(180,270,' View graphik ' );

outtextxy(180,300,' Count again');

outtextxy(180,330,' Exit ');

end;

repeat

if keypressed then

begin

c:=readkey;

case c of

#80:

x:=x-1;

#72:

x:=x+1;

end;

setfillstyle(1,1);

case (abs(x) mod 6) of

0:

begin

bar(180,170,480,190);

setfillstyle(1,2);

bar(180,200,480,220);

bar(180,320,480,340);

end;

1:

begin

bar(180,200,480,220);

setfillstyle(1,2);

bar(180,170,480,190);

bar(180,230,480,250);

end;

2:

begin

bar(180,230,480,250);

setfillstyle(1,2);

bar(180,200,480,220);

bar(180,260,480,280);

end;

3:

begin

bar(180,260,480,280);

setfillstyle(1,2);

bar(180,230,480,250);

bar(180,290,480,310);

end;

4:

begin

bar(180,290,480,310);

setfillstyle(1,2);

bar(180,260,480,280);

bar(180,320,480,340);

end;

5:

begin

bar(180,320,480,340);

setfillstyle(1,2);

bar(180,290,480,310);

bar(180,170,480,190);

end;

end;

if ea mod 2 =0 then

begin

outtextxy(180,135,'Функция распознана.Интеграл подсчитан.');

outtextxy(180,180,' Посмотреть значение интеграла');

outtextxy(180,210,'Посмотреть коэффициенты Ньютона-Котеса');

outtextxy(180,240,' Посмотреть значения функции');

outtextxy(180,270,' Посмотреть график ' );

outtextxy(180,300,' Считать снова');

outtextxy(180,330,' Выход ');

end

else

begin

outtextxy(180,135,'Function Indentified.Integral counted.');

outtextxy(180,180,' View value of integral');

outtextxy(180,210,' View Newton-Cotes coefficients');

outtextxy(180,240,' Veiw values of function');

outtextxy(180,270,' View graphik ' );

outtextxy(180,300,' Count again');

outtextxy(180,330,' Exit ');

end;

end;

until c=#13;

c:='t';

case (abs(x) mod 6) of

0:begin

setcolor(15);

setfillstyle(1,12);

bar(140,200,490,280);

rectangle(145,205,485,275);

rectangle(147,207,483,273);

settextstyle(2,0,1);

setusercharsize(1,1,5,1);

outtextxy(170,210,'S');

settextstyle(2,0,4);

str(a:3:3,p);

outtextxy(160,257,p);

str(b:3:3,p);

outtextxy(160,212,p);

settextstyle(3,0,2);

outtextxy(180,224,f);

p:='';

str(abs(int):7:3,p);

outtextxy(190+length(f)*12,224,p);

readln;

end;

1:

begin

newsc(ea);

setfillstyle(1,2);

bar(170,120,490,180+n*15);

setcolor(14);

rectangle(175,125,485,175+n*15);

rectangle(177,127,483,173+n*15);

if ea mod 2 =0 then

begin

outtextxy(180,130,'Коэффициенты Ньютона-Котеса:');

outtextxy(180,140+(n+1)*15,'Нажмите ENTER для продолжения');

end

else

begin

outtextxy(180,130,'Newton-Cotes coefficients:');

outtextxy(180,140+(n+1)*15,'Press ENTER to continue');

end;

hkoef(n,h);

for i:=0 to n do

begin

str(i,p);str(h[i]:2:4,p1);

p:='H'+p+' = '+p1;

outtextxy(180,140+i*15,p);

end;

readln;

end;

2:begin

newsc(ea);

setfillstyle(1,2);

bar(170,120,490,180+n*15);

setcolor(14);

rectangle(175,125,485,175+n*15);

rectangle(177,127,483,173+n*15);

if ea mod 2 =0 then

begin

outtextxy(180,130,'Значения функции:');

outtextxy(180,140+(n+1)*15,'Нажмите ENTER для продолжения');

end

else

begin

outtextxy(180,130,'Values of function:');

outtextxy(180,140+(n+1)*15,'Press ENTER to continue');

end;

for i:=0 to n do

begin

str(i,p);str(y[i]:2:4,p1);

p:='Y'+p+' = '+p1;

p1:='';

outtextxy(180,140+i*15,p);

str((a+i*(b-a)/n):2:4,p1);

str(i,p);

if ea mod 2 = 0 then

p:=',При '+'X'+p+' = '+p1

else

p:=',When '+'X'+p+' = '+p1;

outtextxy(285,140+i*15,p);

end;

readln;

end;

3:

graphik(ea,a,b,f);

5:

begin

closegraph;

halt;

end;

end;

until (abs(x) mod 6)=4;

k:=abs(x) mod 6;

end;

end.

================================================

========МОДУЛЬ GRAPHIC========

================================================

unit graphic;

interface

uses

k_unit,crt,graph;

procedure hwg(ea:word);

procedure graphik(ea:word;a,b:real;f1:string);

implementation

procedure hwg(ea:word);

{Процедура окна помощи при графике}

var

f:string;

begin

settextstyle(0,0,0);

setfillstyle(1,3);

bar(150,100,390,380);

setcolor(0);

rectangle(153,103,387,377);

rectangle(155,105,385,375);

setcolor(14);

if ea mod 2 =0 then

begin

outtextxy(160,115,' ОКНО ПОМОЩИ');

outtextxy(160,140,' Для работы с графиком');

outtextxy(160,155,' используйте клавиши:');

outtextxy(160,180,' PAGE UP-первоначальный');

outtextxy(160,195,' вид графика;');

outtextxy(160,210,' HOME-начальный масштаб;');

outtextxy(160,225,' INSERT-включить/выключеть');

outtextxy(160,240,' заливку области;');

outtextxy(160,255,' DELETE-включить/выключеть');

outtextxy(160,270,' сетку;');

outtextxy(160,285,' END-показать/убрать цифры');

outtextxy(160,300,' F1- Помощь;');

outtextxy(160,315,' Стрелки ВВЕРХ/ВНИЗ- ');

outtextxy(160,330,' увеличение/уменьшение');

outtextxy(160,345,' масштаб .');

outtextxy(160,360,'Для возрата нажмите ENTER.');

end

else

begin

outtextxy(160,115,' HELP WINDOW');

outtextxy(160,140,' For the work with graphic');

outtextxy(160,155,' use this keys:');

outtextxy(160,180,' PAGE UP-Primery form of');

outtextxy(160,195,' graphik;');

outtextxy(160,210,' HOME-Primery scale;');

outtextxy(160,225,' INSERT-Turn on/off inking');

outtextxy(160,240,' the field;');

outtextxy(160,255,' DELETE-Turn on/off the');

outtextxy(160,270,' net;');

outtextxy(160,285,' END-View/delete the figures');

outtextxy(160,300,' F1- Help;');

outtextxy(160,315,' Arrows UP/DOWN-Increase/ ');

outtextxy(160,330,' lower the scale;');

outtextxy(160,360,'Press ENTER to continue.');

Страницы: 1, 2, 3, 4, 5, 6



2012 © Все права защищены
При использовании материалов активная ссылка на источник обязательна.