unit Unit3;

interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls;



  Procedure CalcS(Memo:TMemo; xn:extended; xk:extended; h:extended; e:extended);
implementation


  Procedure CalcS;
  var
   n:integer;
   a,s,x: extended;
   begin
   x := xn;
        repeat
      a:=1;  S:=1;  n:=0;
         while (abs(a) > e) do begin
            n:=n+1;
              a:=((-a/(2*sqr(n-1)+1))*(2*sqr(n)+1)*sqr(x))*(1/(2*n*(2*n-1)));
              s:=s+a;
              Memo.Lines.Add('при x='+FloatToStrF(x,ffFixed,6,2)+'   сумма ='
                                   + FloatToStrF(s,ffFixed,8,4)+'   N ='+IntToStr(n));
           end;
         x:=x+h;
  until x>(xk+h/2)
  end;



end.

