unit Unit1;

interface

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

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

var
  Form1: TForm1;
  xn,xk,e: extended;
  m: word;

implementation

{$R *.dfm}

function sx(x:extended): extended;
var a,n,s: extended;
        k: integer;
begin
 k:=-1;
 a:=1;
 n:=0;
 s:=1;
try
 while(abs(a)>e) do begin
   n:=n+1;
    a:=a*(2*x)/n;
    s:=s+a;
   end;
 Result:=s;
except
on EnvalidOp do
 k:=MessageDlg('Неправильная операция с плавающей точкой'+)
procedure TForm1.FormCreate(Sender: TObject);
begin
Edit1.Text:='0,1' ;
Edit2.Text:='0,7'  ;
Edit3.Text:='0,1'  ;
Edit4.Text:='0,0001'  ;
Memo1.Clear;
Memo1.Lines.Add('Лаб. раб. №6 020602 Сенкевич А.В.') ;
end;

procedure TForm1.Button1Click(Sender: TObject);
var xn,xk,x,h,e,a,s,y: extended;
    n: integer;
begin
xn:=StrToFloat(Edit1.Text);
Memo1.Lines.Add('xn='+FloatToStrF(xn,fffixed,6,2));
xk:=StrToFloat(Edit2.Text);
Memo1.Lines.Add('xk='+FloatToStrF(xk,fffixed,6,2));
h:=StrToFloat(Edit3.Text);
Memo1.Lines.Add('h='+FloatToStrF(h,fffixed,8,3));
e:=StrToFloat(Edit4.Text);
Memo1.Lines.Add('e='+FloatToStrF(e,fffixed,8,5));
x:=xn;
repeat
 a:=1; S:=1; n:=0;
  while(abs(a)>e) do begin
   n:=n+1;
    a:=a*(2*x)/n;
    s:=s+a;
   end;
    y:=exp(2*x);
 Memo1.Lines.Add('при x='+FloatToStrF(x,fffixed,6,2)+' сумма='
                  + FloatToStrF(s,fffixed,8,4)+ ' y='
                  + FloatToStrF(y,fffixed,8,4)+ ' N='+IntToStr(n));
  x:=x+h;
 until x>(xk+h/2)
end;

end.
