. .
...
. .
2011
I.
II.
III.
IV.
V.
I.
, , , , , , . , . , :
× . , () .
× , . , .
, , , , , , , ᒺ, , ( ), , .
( ) , , .
, , . , - , - .
n, n n :
.
. ֳ . :
× ͒-.
- . ѳ, .
× ( -).
, . . >3.
× .
- ' .
× .
ֳ . - ( ) .
- , , , , , - / .
|
|
II.
, , .
. .
- .
, . , . , , - , .
, .
, .
, , , . : .
: .
. . , n (
).
.
, 2, .
III.
, ,
.
:
1. n.
2. .
3. .
4. ( ) x y.
5. x y , .
6. 4 5 n .
7. .
: a = , b , chislo vyprobuvan .
- Userednenyy integral .
program MonteCarlo;
uses
crt;
const k=100;
Var a,b,c,d,ng,vg,x,y,s,integral: real;
n,i,j: integer;
integr:array[1..k]of real;
Function f(x,y:real):real;
Begin
f:=Sqrt(x+y);
end;
Function nm(x:real):real;
Begin
nm:=3*x;
end;
Function vm(x:real):real;
Begin
vm:=8*x;
end;
BEGIN
clrscr;
writeln('Vvedit znachennya granyts integruvannya ');
write('a='); readln(a);
write('b='); readln(b);
writeln('Vvedit chyslo vyprobuvan:');
readln(n);
c:=nm(a);
d:=vm(b);
randomize;
for j:=1 to k do
begin
s:=0; integral:=0;
For i:=1 to n do
begin
x:=a+(b-a)*random;
y:=c+(d-c)*random;
ng:=nm(x);
vg:=vm(x);
If (y <= vg) and(y >= ng) then s:=s + f(x, y);
|
|
end;
integr[j]:=(b-a)*(d-c)*s/n;
writeln(integr[j]:10:4);
end;
for j:=1 to k do
Integral:=integral+ integr[j];
writeln('Userednenyy integral=',(integral/k):10:4);
readln;
END.
Mathcad , 3 - . , - ( ), .
IV. o
, , . - , , . , ( , ) . , , , , , - .
, -, , , . , , .
- BP, Mathcad.
Mathcad , 3 - . , - ( ), .
- .
- , . :
) ³ , . , , .
) ³ , , , , 10.
) .
³ , , , :
) .
) .
) .