Вычисление интеграла методом Ньютона-Котеса (теория и программа на Паскале)
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);