unit Unit1;

interface

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

type
  TForm1 = class(TForm)
    Image1: TImage;
    Label1: TLabel;
    Label2: TLabel;
    procedure FormCreate(Sender: TObject);
    procedure Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
      Y: Integer);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  Form1: TForm1;

implementation

{$R *.DFM}
var
       mash: integer;

function fun1(x: double):double;
begin
        fun1:=3/(sqr(x-1)+1)
end;

function fun2(x: double):double;
begin
    if (x>-0.5) then
        fun2:=sqrt(x+0.5)
    else
        fun2:=0;
end;

function fun3(x: double):double;
begin
        fun3:=exp(-x);
end;

procedure TForm1.FormCreate(Sender: TObject);
var
    x,y,step: double;
    xs,ys  : integer;


begin
  mash:=50;
  Image1.Canvas.FillRect(ClientRect);
  for xs:=1 to 317*10 do
  begin
      for ys:=1 to 317*10 do
      begin
          x:=(xs/10-(317 div 2))/mash;
          y:=-(ys/10-(317 div 2))/mash;
          if (y>fun2(x))and(y>fun3(x))and(y<fun1(x))then
               Image1.Canvas.Pixels[xs div 10,ys div 10]:=clYellow;
      end;
  end;
  for xs:=1 to 317*10 do
  begin
    x:=(xs/10-(317 div 2))/mash;
    y:=fun1(x);
    ys:=Round(-y*mash+(317 div 2));
    Image1.Canvas.Pixels[(xs div 10),ys]:=clRed;
  end;
  for xs:=1 to 317*10 do
  begin
    x:=(xs/10-(317 div 2))/mash;
    y:=fun2(x);
    ys:=Round(-y*mash+(317 div 2));
    Image1.Canvas.Pixels[(xs div 10),ys]:=clGreen;
  end;
  for xs:=1 to 317*10 do
  begin
    x:=(xs/10-(317 div 2))/mash;
    y:=fun3(x);
    ys:=Round(-y*mash+(317 div 2));
    Image1.Canvas.Pixels[(xs div 10),ys]:=clBlue;
  end;
  Image1.Canvas.Pen.Color:=clBlack;
  Image1.Canvas.MoveTo(317 div 2,0);
  Image1.Canvas.LineTo(317 div 2,317);
  Image1.Canvas.MoveTo(0,317 div 2);
  Image1.Canvas.LineTo(317,317 div 2);
  Image1.Canvas.Ellipse(317 div 2-3,317 div 2 -mash-3, 317 div 2+3,317 div 2 -mash+3);
  Image1.Canvas.Ellipse(317 div 2 +mash-3,317 div 2-3, 317 div 2 +mash+3,317 div 2+3);
  Image1.Canvas.Ellipse(317 div 2-3,317 div 2 -2*mash-3, 317 div 2+3,317 div 2 -2*mash+3);
  Image1.Canvas.Ellipse(317 div 2 +2*mash-3,317 div 2-3, 317 div 2 +2*mash+3,317 div 2+3);
  Image1.Canvas.Ellipse(317 div 2-3,317 div 2 +mash-3, 317 div 2+3,317 div 2 +mash+3);
  Image1.Canvas.Ellipse(317 div 2 -mash-3,317 div 2-3, 317 div 2 -mash+3,317 div 2+3);
  Image1.Canvas.Ellipse(317 div 2-3,317 div 2 +2*mash-3, 317 div 2+3,317 div 2 +2*mash+3);
  Image1.Canvas.Ellipse(317 div 2 -2*mash-3,317 div 2-3, 317 div 2 -2*mash+3,317 div 2+3);
  Image1.Canvas.Ellipse(317 div 2-3,317 div 2-3,317 div 2+3,317 div 2+3);
  //-0.203
  //0.187
  //1.956  }
end;

procedure TForm1.Image1MouseMove(Sender: TObject; Shift: TShiftState; X,
  Y: Integer);
  var
    x1,y1: extended;
begin
    x1:=(X-(317 div 2))/mash;
    y1:=-(Y-(317 div 2))/mash;

    Label1.Caption:='x='+FloatToStr(x1)+', y='+FloatToStr(y1);
   //label1.Caption:=IntToStr(X)+' '+IntToStr(Y);
    label1.Visible:=true;
    if (y1>fun2(x1))and(y1>fun3(x1))and(y1<fun1(x1))then
    begin
               label2.Visible:=true;
      end
      else
      begin
         label2.Visible:=false;
      end;
end;


end.
