< -->

Program IntegralTrigon;
Uses Graph, CRT;
const
  Sx : Real = 1.0;
  Sy : Real = 12.0;
var
  D, R, e : Integer;
  x, y : Real;
Function Si(xt : Real):Real;
var
  S, N, x1 : Real;
begin
  x1 := xt;
  S := xt;
  N := 0.0;
  While Abs(x1)>0.000001 do
   begin
     N := N + 2.0;
     x1 := -x1*xt*xt/(N*N*(N+1.0));
     S := S + x1;
   end;
  Si := S;
end;
Procedure DoScreen;
var i : Integer;
begin
  ClearViewPort;
  SetColor(DarkGray);
  MoveTo(0, 240);
  LineTo(640, 240);
  LineTo(630, 238);
  LineTo(630, 242);
  LineTo(640, 240);
  MoveTo(320, 480);
  LineTo(320, 0);
  LineTo(318, 10);
  LineTo(322, 10);
  LineTo(320,0);
  SetColor(LightGray);
  for i := 1 to 32 do Line(i*20, 239, i*20, 241);
  for i := 1 to 24 do Line(319, i*20, 321, i*20);
  SetColor(Brown);
  OutTextXY(324, 230, '0');
  OutTextXY(632, 230, 't');
  OutTextXY(324, 3, 'x');
end;
begin
  D:=Detect;
  InitGraph(D,R,'');
  e:=GraphResult;
  if e <> 0 then
    begin
      WriteLn('Ошибка графики(', e, '):');
      WriteLn(GraphErrorMsg(e));
      Halt;
    end;
  DoScreen;
  x := -30.0;
  While x<=30.0 do
  begin
   X := x + 0.001;
   y := Si(x);
   PutPixel(320+Round(Sx*x), 240-Round(Sy*y), White);
  end;
  ReadKey;
  CloseGraph;
end.

Назад