Академический Документы
Профессиональный Документы
Культура Документы
2.
3.
4.
-11-08
3
1
5.
f ( x ) Ce x
(. 1.3) [, ],
( < 0) (x)= =
5 -
e x 5
, B , <
T x x2
x 5 2 0 .
6. Bibl.pas.
7.
8. :
9. , :
procedure
TForm1.Button1Click
function f1
function f2
function f3
10.
/
/
- /
- /
- /
/
()
()
real
Integer
Integer
A,B,T
C
x
real
real
11. ,
12.
1
=5
8,8
13. ( .dpr)
14. (.pas)
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, bibl, StdCtrls;
type
TForm1 = class(TForm)
Edit1: TEdit;
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
const C=5;
var A,B,T:real;
function f1(x:real):real;
begin f1:=C*exp(-sqr(x)); end;
8,798
function f2(x:real):real;
begin f2:=x/(T+x+sqr(x)); end;
function f3(x:real):real;
begin f3:=sqrt(exp(x+5))-sqr(x+5); end;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var S:real;
begin
T:=Cor(f3,0,5,0.0001);
A:=Exloc(f2,-1000,0,0.0001,-1);
B:=Exloc(f2,0,1000,0.0001,1);
S:=IntF(f1,A,B,0.0001);
edit1.Text:=floattostr(S);
end;
end.
unit bibl;
interface
Type tip = real; func = Function (i:integer): tip;
fun = Function (x:tip): tip; funct = Function (x:tip): Boolean;
Function Slau(A: Array of tip; Var x: Array of tip): Boolean;
Function Ryad(F:func; p,E:tip):tip;
Function Cor(F:fun; A,B,E: tip): tip;
Function Exloc(F:fun; A,B,E: tip; M:integer): tip;
Function IntF(F:fun; A,B,E: tip): tip;
Function Pol(A: Array of tip; x:tip): tip;
Procedure Difpol(Const X: Array of tip; Var Y: Array of tip);
Procedure Upor(Var X: Array of tip; M:integer; n:integer);
Procedure CorPol(Const A: Array of integer; Var X:Array of tip;
Var N:integer);
implementation
Function Slau(A: Array of tip; Var x: Array of tip):Boolean;
Var g,h,i,j,k,m,n,p:integer; t:real;
begin
n:=Length(x);
h:=n+1;
m:=h*n-1;
i:=0;
Slau:=false;
If(Length(A)<> m+1) then Exit;
For p:= n downto 1 do
begin j:= i; k:=i+h; While k < m do begin If A[k]>A[j] then j:=k; k:= k+h end;
If Abs(A[j])<1E-5 then Exit; If j > i then For k:= 0 to p do
begin t:=A[i+k]; A[i+k]:= A[j+k]; A[j+k]:=t end; j:= i+h;
While j < m do
begin t:= A[j]/A[i]; For k:= 0 to p do A[j+k]:= A[j+k]-t*A[i+k]; j:= j+h end; i:= i+h+1
end; i:= n-1; Slau:= true;
Repeat x[i]:= A[m]/A[(h+1)*i]; k:= n; g:= n-i;
For j:= 1 to i do begin A[k]:= A[k] - A[k-g]*x[i]; k:= k+h end;
Dec(i); m:= m - h
Until i < 0
end;
Function Ryad(F:func; p,E:tip):tip;
Var i: integer; R:tip;
Begin R:= p;
For i:= 2 to 100 do begin p:= p*F(i); R:= R + p;
If Abs(p)< E then Break end; Ryad:=R
End;
Function Cor(F:fun; A,B,E: tip): tip;
Var h,x: tip; k: integer;
begin h:= (B-A)/2; x:= A+h; If F(A) < 0 then h:=-h;
For k:= 0 to Trunc(ln(Abs(A-B)/E)*1.4427) do
begin h:= h/2; If F(x) > 0 then x:= x+h else x:= x-h end;
Cor:= x
end;
Function Exloc(F:fun; A,B,E: tip; M:integer): tip;
Var h: tip;
begin
Repeat h:= (B-A)/3;
If M*(F(A+h)- F(B-h)) < 0 then A:= A+h else B:= B-h
Until B - A < E; Exloc:= (A+B)/2
end;
Function Extr1(F: fun; Const X: Array of tip; M:integer; Var j:integer): tip;
Var i: integer;R:tip;
Begin j:= 0; R:= F(X[0]);
For i:= 1 to High(X) do