Построить график функции F(x) на заданном интервале [a;b]. F(x)=(x^2)/(3+2x) [a;b]=[1;2]- Pascal(Паскаль)

uses graph,crt;
const w=640;
      h=480;
      a=1;
      b=2;
function f(x:real):real;
begin
f:=x*x/(3+2*x);
end;
var x0,y0,i:integer;
    x,mx,my:real;
    s:string;
begin
x0:=0;
initgraph(x0,y0,'');
x0:=50;
y0:=h-50;
mx:=w-x0;
my:=(y0-50)/f(b);
line(0,y0,w,y0);
line(x0,0,x0,h);
outtextXY(w,y0-20,'X');
outtextXY(x0+5,10,'Y');
outtextXY(x0+5,y0+10,'1.0');
outtextXY(x0-40,y0-10,'0.00');
for i:=1 to 10 do
 begin
  str(1+i/10:0:1,s);
  line(x0+round(i*mx/10),y0-3,x0+round(i*mx/10),y0+3);
  outtextXY(x0+round(i*mx/10)-10,y0+10,s);
 end;
for i:=1 to 10*(trunc(f(b))+1) do
 begin
  str(i/100:0:2,s);
  line(x0-3,y0-round(i*my/10),x0+3,y0-round(i*my/10));
  outtextXY(x0-40,y0-round(i*my/10),s);
 end;
x:=a;
moveto(x0+round((x-1)*mx),y0-round(f(x)*my));
setcolor(12);
while x<=b do
 begin
  lineto(x0+round((x-1)*mx),y0-round(f(x)*my));
  x:=x+0.01;
 end;
outtextXY(100,10,'y=x^2/(3+2x)1');
outtextXY(100,30,'int [1..2]');
readkey
end.

Leave a Comment

6 + = 7