You are on page 1of 4

1.

2.
3.
4.


-11-08
7
1

5.

S ,

B 1

2 2
y
f ( x ) e x C
B3

(. 1.7) ,

x 3 2 x 2 11x 12 .

6. Bibl.pas.
7.

8. :

9. , :

procedure
TForm1.Button1Click
function f1
function f2
function f3

10.

/
/
- /
- /
- /
/

()

()

real

Integer
real

.
.

Real

Integer

Real

Integer

B
Kor1,
kor2
C
x
X
N

real

11. ,

12.


1

=5

10,47

13. ( .dpr)
14. (.pas)
unit Unit1;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, bibl, StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
Edit1: TEdit;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;
var
Form1: TForm1;
implementation
const C=5;

10,46
965...

var B:real;
function f1(x:real):real;
begin f1:=sqrt(exp(-sqr(x)/sqr(C))); end;
function f2(x:real):real;
begin f2:=(B+1)/(sqr(B)*B); end;
function f3(x:real):real;
begin f3:=sqrt(exp(-sqr(x)/sqr(C)))-(B+1)/(sqr(B)*B); end;
{$R *.dfm}
procedure TForm1.Button1Click(Sender: TObject);
var x:array[1..3] of real; kor1,kor2,S:real; n,i:integer;
begin
CorPol([12,-11,-2,1],x,n);
B:=x[1];
for i:=2 to n do
if x[i]>B then B:=x[i];
kor1:=Cor(f3,-1000,0,0.00001);
kor2:=Cor(f3,0,1000,0.00001);
S:=IntF(f1,kor1,kor2,0.00001);
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
If M*(F(X[i])-R) > 0 then begin j:= i; R:= F(X[i]) end; Extr1:=R
End;
Function IntF(F:fun; A,B,E: tip): tip;
var c,h,x,s,w,R:tip; k,m:integer;
Begin R:=1E38; c:= (F(A)+F(B))/2;
m:= 1;
Repeat w:= R; h:= (B-A)/m; s:= 0; x:= A + 0.5*h;
For k:= 1 to m do begin s:= s+F(x); x:= x+h end;
c:= c+s; R:= (c+s)*h/3; m:= m+m
Until (Abs(w-R) < E) or (m > 10000000); IntF:=R
End;
Function Pol(A: Array of tip; x:tip): tip;
Var i:integer; R:tip;
Begin R:=0;
For i:= High(A) downto 0 do
R:= R*x + A[i];
Pol:=R
End;
Procedure Difpol(Const X: Array of tip; Var Y: Array of tip);
Var h,i:integer;
Begin h:= High(Y);
For i:= 0 to h do Y[i]:=X[i]*(h-i+1)
End;
Procedure Razd(Var X: Array of tip; f: funct; Var i: integer);
Var j: integer; z:tip;
Begin i:= 0; j:= High(X);
Repeat While f(X[i]) do Inc(i); While not F(X[j]) do Dec(j);
If i <= j then begin z:= X[j]; X[j]:= X[i]; X[i]:=z; Inc(i); Dec(j) end;
Until i > j
End;
procedure Upor(Var X: Array of tip; M:integer; n:integer);
Var h,i,j,k: integer; z: tip;
Begin
If n = 0 then h:= High(X) else h:= n-1; k:= h+1;
Repeat k:= k div 4*2+1;
For j:= k to h do begin i:=j; z:= X[i];
Repeat If M*(X[i-k] - z) < 0 then Break;
X[i]:= X[i-k]; Dec(i,k)
Until i < k; X[i]:= z
end
Until k = 1
End;
Procedure CorPol(Const A: Array of integer; Var X:Array of tip; Var N:integer);
Var b,i,j,h,k,t: integer; p,r: tip;
Begin n:= 0; h:= High(A);
For i:= 1 to Abs(A[0]) do If A[0] mod i = 0 then
For j:= 1 to Abs(A[h]) do If A[h] mod j = 0 then
begin b:=j; k:=1;
Repeat r:=0;
Repeat If b > k then k:= k+1
Else begin r:= i/j;
Repeat p:=0; For t:= h downto 0 do p:= p*r + A[t];
If Abs(p) <= 0.00001 then
begin x[n]:=r; Inc(n) end; r:= -r
Until r > 0; Break
end
Until b mod k = 0;
b:= b div k
Until (i mod k = 0) or (r > 0);
end
End;
end.