unit Unit1;
interface
uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls,ExtCtrls;
type
  TForm1 = class(TForm)
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    Label4: TLabel;
    Edit1: TEdit;
    Edit2: TEdit;
    Edit3: TEdit;
    Edit4: TEdit;
    Button1: TButton;
    Memo1: TMemo;
    Label5: TLabel;
    Button2: TButton;
    Button3: TButton;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);
begin
 Edit1.text:='0,1';
   Edit2.text:='0,7';
   Edit3.text:='2';
   Edit4.text:='0,001';
end;

procedure TForm1.Button1Click(Sender: TObject);
var xn,xk,x,h,e,a,s,y,M:extended;
n,k:integer;
begin
Memo1.Clear;
Memo1.Lines.Add('результаты ст. гр. 020602 Коврыги А.С.');
  xn:=StrToFloat(Edit1.Text);
  Memo1.Lines.Add('xn='+FloatToStrF(xn,ffFixed,6,1));
    xk:=StrToFloat(Edit2.Text);
  Memo1.Lines.Add('xk='+FloatToStrF(xk,ffFixed,6,1));
    M:=StrToFloat(Edit3.Text);
  Memo1.Lines.Add('M='+FloatToStrF(M,ffFixed,8,0));
   e:=StrToFloat(Edit4.Text);
  Memo1.Lines.Add('e='+FloatToStrF(e,ffFixed,8,3));
  x:=xn ;    h:=(xk - xn)/M;
  repeat
 n:=0; S:=1;  a:=1;
      while (abs(a)>e) do begin
     n:=n+1;
 a:=a*(2*n+1)*x*x/n/(2*n-1);
  s:=s+a;
     end;
y:=  (1+2*sqr(x))*exp(x*x)  ;
Memo1.Lines.Add('при x='+FloatToStrF(x,ffFixed,6,2)+'       сумма ='
+FloatToStrF(s,ffFixed,8,3)+'      y ='
+FloatToStrF(y,ffFixed,8,3)+'      N ='+IntToStr(n)) ;
  x:=x+h;
until x>(xk + h/2)
end;
procedure TForm1.Button2Click(Sender: TObject);
begin
Edit3.Clear;
Memo1.Clear;
end;
procedure TForm1.Button3Click(Sender: TObject);
begin
print
end;
end.
