Наши проекты:
Журнал · Discuz!ML · Wiki · DRKB · Помощь проекту |
||
ПРАВИЛА | FAQ | Помощь | Поиск | Участники | Календарь | Избранное | RSS |
[3.136.18.48] |
|
Сообщ.
#1
,
|
|
|
код
uses graph; const e=0.001;{точность вычисления суммы и построения графика} function y(x,b:real):real; begin y:=exp(x)+b; end; function z(x:real):real; var t,s:real; n:integer; begin s:=1; t:=1; n:=0; while abs(t)>e do begin n:=n+1; t:=t*x/n; s:=s+t; end; z:=s end; var xn,xk,b,mx,my:real; x:real; x0,y0,i:integer; s:string; begin repeat write('-5<=b<=5 b='); readln(b); until(b>=-5)and(b<=5); x0:=0; initgraph(x0,y0,''); xn:=-3; xk:=3;{интервал по Х} x0:=getmaxX div 2; mx:=(x0-30)/xk;{масштаб по Х} y0:=getmaxY div 2; my:=(y0-20)/y(xk,b);; line(0,y0,getmaxX,y0);{оси} line(x0,0,X0,getmaxY); for i:=1 to 5 do{максимальное количество засечек в одну сторону} begin line(x0-3,y0-round(i*5*my),x0+3,y0-round(i*5*my));{засечки на оси У} line(x0-3,y0+round(i*5*my),x0+3,y0+round(i*5*my)); {подпись оси У} str(i*5,s); outtextXY(x0-30,y0-round(i*5*my),s);{соответственно засечкам} outtextXY(x0-35,y0+round(i*5*my),'-'+s); line(x0+round(i*mx),y0-3,x0+round(i*mx),y0+3); {засечки на оси Х} {подпись оси Х} str(i,s); outtextXY(x0+round(i*mx),y0+10,s); outtextXY(x0-round(i*mx),y0+10,'-'+s); end; {центр} outtextXY(x0+5,y0+10,'0'); {подписи концов осей} outtextXY(getmaxX-10,y0-10,'X'); outtextXY(x0+5,10, 'Y'); {графики} x:=xn; while x<=xk do begin putpixel(x0+round(x*mx),y0-round(y(x,b)*my),12); putpixel(x0+round(x*mx),y0-round(z(x)*my),10); x:=x+e; end; {название} setcolor(12); outtextXY(20,20,'y=e^x+b'); setcolor(10); outtextXY(20,40,'ryad Tejlora'); setcolor(9); str(b:0:1,s); outtextXY(20,60,'b='+s); outtextXY(20,80,'int [-3;3]'); readln end. |