Advertisement
Guest User

proga7

a guest
May 24th, 2016
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Delphi 1.15 KB | None | 0 0
  1. unit Unit1;
  2.  
  3. interface
  4.  
  5. uses
  6.   Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  7.   Dialogs, StdCtrls;
  8.  
  9. type
  10.   TForm1 = class(TForm)
  11.     Label1: TLabel;
  12.     Button1: TButton;
  13.     Label2: TLabel;
  14.     Label3: TLabel;
  15.     procedure Button1Click(Sender: TObject);
  16.   private
  17.     { Private declarations }
  18.   public
  19.     { Public declarations }
  20.   end;
  21.  
  22. var
  23.   Form1: TForm1;
  24.  
  25. implementation
  26.  
  27. {$R *.dfm}
  28.  
  29. procedure TForm1.Button1Click(Sender: TObject);
  30. const
  31.   p=10.5;
  32.   x1=2.4;
  33.   x2=25.5;
  34.   h=1.1;
  35. var
  36.   Y: array [1..1000] of real;
  37.   x, xmax, Ymax: real;
  38.   i: integer;
  39. begin
  40.   Ymax:=-9999999999999;
  41.   xmax:=0;
  42.   x:=x1;
  43.   i:=0;
  44.   while x<=x2+1 do begin
  45.     i:=i+1;
  46.     if x > (p*sin(x)) then
  47.       Y[i]:=2.5*10*10*x-exp(x)
  48.     else if x <= (p*sin(x)) then
  49.       Y[i]:=(0.2*10*10*10*x*x)/(2.5+sqr(sin(x)));
  50.     Label1.Caption:=Label1.Caption+'Y('+FloatToStr(x)+')='+FormatFloat('0.####', Y[i])+'; ';
  51.     if Y[i]>Ymax then begin
  52.       Ymax:=Y[i];
  53.       xmax:=x;
  54.     end;
  55.     x:=x+h;
  56.   end;
  57.   Label2.Caption:='Максимальное значение Y('+FloatToStr(xmax)+') = '+FloatToStr(Ymax);
  58. end;
  59.  
  60. end.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement