unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Edit1: TEdit;
    Edit2: TEdit;
    Button1: TButton;
    Memo1: TMemo;
    Edit3: TEdit;
    Edit4: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  xn,xk,h,e:extended;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
memo1.Clear;
edit1.text:='-2';
edit2.text:='0,1';
edit3.text:='-0,1';
edit4.text:='0,01';
end;

procedure TForm1.Button1Click(Sender: TObject);
var x,y,s,n:extended;
function my_fun(x:extended):extended;
        begin
        my_fun:=sin(x)/x;
        end;
function my_sum(x:extended):extended;
        var sum,sum2,elem:extended;
        begin
        elem:=sqr(x);
        sum:=elem;
        sum2:=sum+2*e;
        n:=1;
        while abs(sum2-sum)>e do
                begin
                elem:=(-1)*elem*sqr(x)/(2*n+2)/(2*n+3);
                sum2:=sum;
                sum:=sum+elem;
                n:=n+1;
                end;
        my_sum:=sum;
        end;
begin
memo1.Lines.Add('xn='+edit1.text);
memo1.Lines.Add('xk='+edit3.text);
memo1.Lines.Add('h='+edit2.text);
memo1.Lines.Add('e='+edit4.text);
xn:=strtofloat(edit1.text);
xk:=strtofloat(edit3.text);
h:=strtofloat(edit2.text);
e:=strtofloat(edit4.text);

x:=xn;
while x<=xk do
begin
y:=my_fun(x);
s:=my_sum(x);
memo1.Lines.Add('при x='+floattostrf(x,fffixed,6,2)+
' сумма='+floattostrf(s,fffixed,6,2)+
' y='+floattostrf(y,fffixed,6,2)+
' N='+floattostrf(n,fffixed,6,2));
x:=x+h;
end;



end;

end.
