Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- unit Unit1;
- interface
- uses
- Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
- Dialogs, StdCtrls;
- type
- TForm1 = class(TForm)
- Label1: TLabel;
- Button1: TButton;
- Label2: TLabel;
- Label3: TLabel;
- procedure Button1Click(Sender: TObject);
- private
- { Private declarations }
- public
- { Public declarations }
- end;
- var
- Form1: TForm1;
- implementation
- {$R *.dfm}
- procedure TForm1.Button1Click(Sender: TObject);
- const
- p=10.5;
- x1=2.4;
- x2=25.5;
- h=1.1;
- var
- Y: array [1..1000] of real;
- x, xmax, Ymax: real;
- i: integer;
- begin
- Ymax:=-9999999999999;
- xmax:=0;
- x:=x1;
- i:=0;
- while x<=x2+1 do begin
- i:=i+1;
- if x > (p*sin(x)) then
- Y[i]:=2.5*10*10*x-exp(x)
- else if x <= (p*sin(x)) then
- Y[i]:=(0.2*10*10*10*x*x)/(2.5+sqr(sin(x)));
- Label1.Caption:=Label1.Caption+'Y('+FloatToStr(x)+')='+FormatFloat('0.####', Y[i])+'; ';
- if Y[i]>Ymax then begin
- Ymax:=Y[i];
- xmax:=x;
- end;
- x:=x+h;
- end;
- Label2.Caption:='Максимальное значение Y('+FloatToStr(xmax)+') = '+FloatToStr(Ymax);
- end;
- end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement