unit Unit1;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls, ExtCtrls, ComCtrls, Math, TeEngine, Series, TeeProcs,
  Chart;

type
  TForm1 = class(TForm)
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    TabSheet2: TTabSheet;
    Image1: TImage;
    Edit1: TEdit;
    Edit2: TEdit;
    Label3: TLabel;
    Label4: TLabel;
    Button1: TButton;
    Button2: TButton;
    TabSheet3: TTabSheet;
    Button3: TButton;
    Edit3: TEdit;
    Edit4: TEdit;
    Edit5: TEdit;
    Edit6: TEdit;
    Edit7: TEdit;
    Label1: TLabel;
    Label2: TLabel;
    Label5: TLabel;
    Label6: TLabel;
    Label7: TLabel;
    Edit8: TEdit;
    Edit9: TEdit;
    Label8: TLabel;
    Label9: TLabel;
    Chart1: TChart;
    Series1: TLineSeries;
    procedure FormCreate(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;
  R,xn, xk,xomin, xomax, yomin, yomax,h,x,y :extended;
  m,u,i,j,p,l:integer;
implementation

{$R *.dfm}
Function f(x: extended):extended;
 begin
  Result:=(1+2*sqr(x))*Power((exp(1)),(sqr(x))); // Функция
 end;

procedure TForm1.FormCreate(Sender: TObject);
begin
Edit1.Clear; Edit2.Clear;  Edit3.Text:='0,1';   Edit4.Text:='6';    Edit5.Text:='50';    Edit6.Text:='0';
 Edit7.Text:='6';      Edit8.Text:='-1';   Edit9.Text:='1';

end;
procedure TForm1.Button2Click(Sender: TObject);
var xmax,ymax,x1,x2,y1,y2:integer;
begin
xmax:=Image1.Width;
ymax:=Image1.Height;
image1.Canvas.Brush.Color:=clRed;
x1:=Round(xmax/2-ymax/3);
x2:=Round(xmax/2+ymax/3);
y1:=Round(ymax/2-ymax/3);
y2:=Round(ymax/2+ymax/3);
image1.Canvas.Ellipse(x1,y1,x2,y2);
end;
procedure TForm1.Button1Click(Sender: TObject);
begin
R:=StrToFloat(Edit1.Text);
u:=0;
i:=Round(R);
for j:=-i to i do begin
for p:=-i to i do begin
if (sqr(j)+sqr(p))<sqr(R) then
u:=u+1;
end;
end;
Edit2.Text:=FloatToStr(u);
end;
procedure TForm1.Button3Click(Sender: TObject);
 var xmax, ymax, xt,  yt, yo : integer;
     hx, hy : extended;
begin
   xn:=StrToFloat(Edit3.Text);
 xk:=StrToFloat(Edit4.Text);
 m:=StrToInt(Edit5.Text);
 xomin:=StrToFloat(Edit6.Text);
 xomax:=StrToFloat(Edit7.Text);
 yomin:=StrToFloat(Edit8.Text);
 yomax:=StrToFloat(Edit9.Text);
 with Chart1 do begin
  LeftAxis.Automatic:=False;
  LeftAxis.Minimum:=yomin;
  LeftAxis.Maximum:=yomax;
  BottomAxis.Automatic:=False;
  BottomAxis.Minimum:=xomin;
  BottomAxis.Maximum:=xomax;
  SeriesList[0].Clear;
  h:=(xk-xn)/(m-1); x:=xn;
  for i:=1 to m do begin
   y:=exp(x*cos(pi/4))*cos(x*sin(pi/4));
   SeriesList[0].AddXY(x,y);
   x:=x+h;
  end;
 end;
                 
end;

end.
