. , ζ, , E (ζ) . ζ, .
1. . G, b. , . , G , G, . π, , , 100000 . .
154. π -
Program Chislo_Pi;
Uses Crt; Var I, N: Longint; X, Y: Real;
Begin
Randomize; N:= 0;
For I:= 1 To 100000 Do
Begin
X := Random; Y:= Random;
If Sqr(X - 0.5) + Sqr(Y - 0.5) < 0.25 Then N:= N + 1
End;
WriteLn ('pi=', (N / 100000 / Sqr(0.5)): 8: 5);
Repeat Until KeyPressed End.
2. . , , L, l (. 7.60). , , , ?
. 7.60. .
. (XVIII .) : = . , L = 2 l, = . , = , N - , N1 - .
, = . π.
. L = 1 l = . , , 2020, (0, 0). , 0 20. , , ; , , - - . ;
(1, y1), B(x2, 2);
1(1 + α(2 1), 1 + α(2 1)),
, , , , - , oe A 1 .
155 .
|
|
Program Buffon;
Uses Crt; Var I, J, K, M, N: Integer; XI, X2, Y1, Y2, Al: Real;
Begin
Randomize; M:= 30000; N:= 1;
For I:= 1 To M Do
Begin
X1:= Random * 20; Yl:= Random * 20; X2:= Random * 20;
Y2:= Random * 20;
A1:= 0.5 / Sqrt(Sqr(X2 X1) + Sqr(Y2 - Yl));
J:= Round(Yl); := Round(Yl + A1 * (Y2 Y1));
If J <> Then N:= H + 1
End;
WriteLn('pi=', W / N): 8: 5); Repeat Until KeyPressed
End.
, , .
. , , , -, . . ? , ? , , . ? , , , ( ), .
3. . , G . , .. , U . ) , . U(r) = 0; U(r) - , ; , , .
. 7.61.
G . , , , U . U(A) A (. 7.61).
, , . , . . , f (i) , , N . ,
, .
4. ( ). () : [0, 1] 0,5, x = + h, x = - h.
156.
Program Tochka;
Uses Crt, Graph; Var I, J: Integer; Z, P, X, H, Y: Integer;
|
|
Begin
X:= 320; Y:= 240; H:= 10; P:= 4; DetectGraph(I, J);
InitGraphd, J, ");
SetColor(15); Line(10, 312, 630, 312); Randomize;
Repeat
Z:= Random(8); If Z >= P Then X:= X + H Else X:= X - H;
SetColor(Green); Circle(X, Y, 10); Delay(200);
SetColor(0); Circle(X, Y, 10)
Until KeyPressed Or (X >= 640) Or (X <= 0); CloseGraph
End.
, , [0, hmax] . H:= Random(HMax).
, - (0 < < 1, 0 < y < 1), . () .
157.
Program Broun;
Uses Crt, Graph;
Var I, J, X, Y, HxMax, HyMax, Hx, : Integer; PI, P2, Z1, Z2: Real;
Begin
X:= 320; Y:== 240; HxMax:= 30; PI:= 0.5; P2:= 0.5; HyMax:= 30;
DetectGraph (I, J); InitGraph (1, J, ''); SetColor(15);
Randomize; RectAngle(100, 100, 540, 380);
SetColor(Green); Circle(X, Y, 10); Delay(200); SetColor(0);
Circle(X, , 10);
Repeat
Zl:= Random; Z2:= Random; Hx:= Random(HxMax);
:= Random(HyMax);
If (Zl < PI) Then X:= X + Hx Else X:= X - Hx;
If (Z2 < P2) Then Y:= Y + Else Y:" - ;
If X <= 110 Then X:= X + 2 * (110 - X);
If X >= 530 Then X:= X - 2 * (-530 + X);
If Y <= 110 Then Y:= Y + 2 * (110 - Y);
If Y >= 370 Then Y:= Y - 2 * (Y - 370);
SetColor(Green); Circle(X, Y, 10); Delay(100);
SetColor(0); Circle(X, Y, 10)
Until Keypressed; CloseGraph
End.
( ) , . , . . .
158.
Program Gaz;
Uses Crt, Graph;
Var I, J, HxMax, HyMax, Hx, , N, I: Integer;
X, Y: Array[0..500] Of Integer; PI, P2, Z1, Z2: Real;
Begin N:= 100;
For I:= 1 To N Do Begin X[I]:= 320; Y[I]:= 240 End;
HxMax:= 10; PI:= 0.5; P2:= 0.5; HyMax:= 10;
DetectGraph (1, J); InitGraphd, J, ' '); SetColor(15);
Randomize; RectAngle(100, 100, 540, 380);
For I:= 1 To N Do PutPixel(X[I], Y[I], White); Delay(200);
For I:= 1 To N Do PutPixel(X(I], Y[I], 0);
Repeat
For I:= 1 To N Do
Begin
Zl:= Random; Z2:= Random;
Hx:= Random(HxMax); := Random(HyMax);
If Zl < PI Then X[I]:= X[I] + Hx Else X[I]:= X[I] Hx;
If Z2 < P2 Then Y[I]:= Y[I] + Else Y[I]:= Y[I] - ;
If X[I] <= 110 Then X[I]:= X[I] + 2 * (110 - X[I]);
If X(I] >= 530 Then X[I]:= X[I] - 2 * (-530 + [I];
If Y[I] <= 110 Then Y(I]:= Y[I] + 2 * (110 - Y[I]);
If Y[I] >= 370 Then Y[I]:= Y[I] - 2 * (Y[I] - 370);
PutPixel (X[I], Y[I], 15)
End; Delay(100);
For I:= 1 To N Do PutPixel(X[I], Y[I], 0)
Until KeyPressed; CloseGraph
End.
, : , . . , ( ) ( HxMax HyMax) .
, , , , , .. , .
|
|
, . .
: , , , , , , , , .
: , , , , .
: .
: , , .
: , , .
, .
1. ? ? ? ?
2. .
3. ?
4. .
5. .
6. ? ?
7. .
8. ( )?
9. ? ?
10. ? ? ? ?
11. ? ?
12. ?
13. ? ? ?
14. .
15. ? .
16. .
17. ?
18. () ? ?
19. () ?
20. - ?
21. ?
22. ? ?
|
|
23. ? , ?
24. , : ) ; ) ; ) .
25. 24, , , , .
26. . , . , .
27. : ( ), , . , (, 3 ) . , , , ?
28. , , - . ? ? , : ?
29. () ( , , ).
30. . . ( , , )
31 .
32. .
33. .
34. .
35. h .
36. .
37. .