unit Unit2;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons, Vcl.ExtCtrls,
Vcl.Samples.Spin, Math;
type
TForm2 = class(TForm)
SE_X: TSpinEdit;
SE_E: TSpinEdit;
ERFun: TEdit;
Label1: TLabel;
Label2: TLabel;
ESFun: TEdit;
RG: TRadioGroup;
BitBtn1: TBitBtn;
Label3: TLabel;
Label4: TLabel;
BOk: TButton;
procedure BOkClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
function fact(n:integer):integer;
begin
if (n < 1)
then result := 0
else if (n = 1)
then result := 1
else result := n * fact(n - 1);
end;
procedure TForm2.BOkClick(Sender: TObject);
var
xR, x, e, a, a1, F, pF: real;
n,i: integer;
begin
e:=1;
for n := 1 to SE_E.Value do
e:=e/10;
x:=SE_X.Value;
SE_E.MaxValue:=15;
case RG.ItemIndex of
1: begin
SE_X.MaxValue:=1;
SE_X.MinValue:=-1;
F:=x;
a:=x;
n:=1;
repeat
a1:=a*x*x*n/(n+2);
F:=F-a1;
a:=(-1)*a1;
n:=n+2;
until (abs(a1)<e);
ESFun.Text:=FloatToStr(ArcTan(x));
ERFun.Text:=FloatToStr(F);
end;
0: begin
F:=1;
i:=1;
a:=1;
n:=2;
repeat
a1:=a*x*x/(n-1)/n;
F:=F-a1;
n:=n+2;
a:=-a1;
until (abs(a1)<e);
ESFun.Text:=FloatToStr((Cos(x)));
ERFun.Text:=FloatToStr(F);
end;
end;
end;
end.
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, Vcl.Buttons, Vcl.ExtCtrls,
Vcl.Samples.Spin, Math;
type
TForm2 = class(TForm)
SE_X: TSpinEdit;
SE_E: TSpinEdit;
ERFun: TEdit;
Label1: TLabel;
Label2: TLabel;
ESFun: TEdit;
RG: TRadioGroup;
BitBtn1: TBitBtn;
Label3: TLabel;
Label4: TLabel;
BOk: TButton;
procedure BOkClick(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form2: TForm2;
implementation
{$R *.dfm}
function fact(n:integer):integer;
begin
if (n < 1)
then result := 0
else if (n = 1)
then result := 1
else result := n * fact(n - 1);
end;
procedure TForm2.BOkClick(Sender: TObject);
var
xR, x, e, a, a1, F, pF: real;
n,i: integer;
begin
e:=1;
for n := 1 to SE_E.Value do
e:=e/10;
x:=SE_X.Value;
SE_E.MaxValue:=15;
case RG.ItemIndex of
1: begin
SE_X.MaxValue:=1;
SE_X.MinValue:=-1;
F:=x;
a:=x;
n:=1;
repeat
a1:=a*x*x*n/(n+2);
F:=F-a1;
a:=(-1)*a1;
n:=n+2;
until (abs(a1)<e);
ESFun.Text:=FloatToStr(ArcTan(x));
ERFun.Text:=FloatToStr(F);
end;
0: begin
F:=1;
i:=1;
a:=1;
n:=2;
repeat
a1:=a*x*x/(n-1)/n;
F:=F-a1;
n:=n+2;
a:=-a1;
until (abs(a1)<e);
ESFun.Text:=FloatToStr((Cos(x)));
ERFun.Text:=FloatToStr(F);
end;
end;
end;
end.