:






 

:

Quot;

"

 

: : . . . . . 107226, 6  
, : . .

 

 

- 2007


7

 

: DELPHI . , Unit .

: , . . , .

 

0.1

 

:

 

:

unit Matfu;

 

interface

function sx(x:extended):extended;

function yx(x:extended):extended;

 

implementation

function factorial(n:integer):integer;

begin

if n=0 then factorial:=1

else factorial:=n*factorial(n-1);

end;

 

function sx;

var

s:extended;

i:integer;

begin

s:=x;

for i:=1 to 8 do

begin

s := s + exp((2*i+1)*ln(x)) / factorial(2*i+1);

end;

result := s;

end;

 

function yx;

begin

Result := (exp(x)-exp(-x))/2;

end;

end.

 

:

unit Unit1;

 

interface

 

uses

Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,

Dialogs, StdCtrls, Matfu, ExtCtrls;

 

type

TForm1 = class(TForm)

EditXn: TEdit;

EditXk: TEdit;

Memo1: TMemo;

Button1: TButton;

Label1: TLabel;

Label2: TLabel;

Label4: TLabel;

RadioGroup1: TRadioGroup;

EditH: TEdit;

Label3: TLabel;

procedure FormCreate(Sender: TObject);

procedure Button1Click(Sender: TObject);

private

{ Private declarations }

public

{ Public declarations }

end;

 

type

func = function(x:extended) : extended;

 

var

Form1: TForm1;

 

implementation

{$R *.dfm}

procedure TForm1.FormCreate(Sender: TObject);

begin

EditXn.Text := '0,1';

EditXk.Text := '3';

EditH.Text := ' ';

RadioGroup1.ItemIndex := 0;

Memo1.Clear;

Button1Click(Sender);

end;

 

procedure Tab1(f: func; xn, xk, h: extended);



var

x, y : extended;

begin

Form1.Memo1.Lines.Add(' ÐÅÇÓËÜÒÀÒÛ:');

Form1.Memo1.Lines.Add('');

 

x := xn;

 

Repeat

y := f(x);

 

Form1.Memo1.Lines.Add(' x=' + FloatToStrF(x,fffixed, 8,2)+

' y=' + FloatToStrF(y,fffixed, 8,2));

x := x + h;

Until (x > xk);

end;

 

procedure TForm1.Button1Click(Sender: TObject);

var

xn, xk, h : extended;

begin

xn := StrToFloat(EditXn.Text);

xk := StrToFloat(EditXk.Text);

h:= (xk - xn) / 10;

EditH.Text := FloatToStr(h);

Memo1.Clear();

 

case RadioGroup1.ItemIndex of

0: Tab1(sx,xn,xk,h);

1: Tab1(yx,xn,xk,h);

end;

end;

end.

 

:

 

 

: DELPHI . , Unit .

 

<== | ==>
|

mylektsii.ru - - 2015-2018 . (0.006 .)