Académique Documents
Professionnel Documents
Culture Documents
A needle of length L =
a distance D =
Err:511
1
cross a line is
2 L / Pi D
This formula makes sense fo L< Pi D/2 for otherwise it gives value > 1
Explanation:
B16
a random number for the x-coordinate of the first end of the needle
C16
a random number for the angle of the needle
D16
the x-coordinate of the first end of the needle, computed as B*D
E16
the angle (in radians), computed as C*2*Pi
F16
the x-coordinate of the second end of the needle, computed as D + L * COS(E)
G16
1 if a line is crossed, 0 otherwise
Err:511
Err:511
x
Err:511
angle
Err:511
x
Crossing?
Err:511
Err:511
Crossing Probability
1
0.8
Simulation
Theoretical
0.6
0.4
0.2
0
Length of Needle
Needle
Length
Simulation
Output
Theoretical
Result
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
1.1
0.06306
0.12701
0.1918
0.25395
0.31649
0.38097
0.44574
0.50852
0.57148
0.63566
0.68121
0.063661977
0.127323954
0.190985932
0.254647909
0.318309886
0.381971863
0.445633841
0.509295818
0.572957795
0.636619772
0.70028175
1.2
0.71454 0.763943727
1.3
1.4
1.5
1.6
1.7
1.8
1.9
2
0.73942
0.76045
0.77933
0.79475
0.80947
0.81982
0.82794
0.83739
0.827605704
0.891267681
0.954929659
1.018591636
1.082253613
1.14591559
1.209577567
1.273239545
Scenario
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
Output Name
Frequency
Frequency
Frequency
Frequency
Frequency
Frequency
Frequency
Frequency
Frequency
Frequency
Frequency
Frequency
Frequency
Frequency
Frequency
Frequency
Scenario
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
1.1
Yes
14024.29
Observations
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
1000
Standard
Mean
Deviation Minimum
0.063
0.024
0.000
0.127
0.033
0.030
0.192
0.041
0.070
0.254
0.043
0.130
0.316
0.047
0.180
0.381
0.047
0.250
0.446
0.050
0.300
0.509
0.049
0.360
0.571
0.051
0.420
0.636
0.046
0.500
0.681
0.046
0.530
0.715
0.045
0.540
0.739
0.044
0.590
0.760
0.043
0.620
0.779
0.042
0.640
0.795
0.041
0.670
Frequency
Frequency
Frequency
Frequency
17
18
19
20
1000
1000
1000
1000
0.809
0.820
0.828
0.837
0.040
0.039
0.039
0.037
0.680
0.680
0.700
0.710
5th
10th
15th
20th
25th
30th
35th
40th
Percentile Percentile Percentile Percentile Percentile Percentile Percentile Percentile
0.030
0.030
0.040
0.040
0.050
0.050
0.050
0.060
0.080
0.090
0.090
0.100
0.100
0.110
0.110
0.120
0.130
0.140
0.150
0.160
0.160
0.170
0.170
0.180
0.190
0.200
0.210
0.220
0.220
0.230
0.240
0.240
0.240
0.260
0.270
0.280
0.290
0.290
0.300
0.300
0.310
0.320
0.330
0.340
0.350
0.360
0.360
0.370
0.370
0.380
0.390
0.408
0.410
0.420
0.430
0.430
0.430
0.450
0.460
0.470
0.480
0.480
0.490
0.500
0.490
0.509
0.520
0.530
0.540
0.540
0.550
0.560
0.560
0.580
0.590
0.600
0.610
0.610
0.620
0.620
0.600
0.620
0.630
0.640
0.650
0.660
0.660
0.670
0.640
0.660
0.670
0.680
0.690
0.690
0.700
0.700
0.670
0.680
0.690
0.700
0.710
0.720
0.720
0.730
0.690
0.710
0.720
0.730
0.730
0.740
0.740
0.750
0.710
0.729
0.730
0.740
0.750
0.760
0.770
0.770
0.730
0.740
0.750
0.760
0.770
0.770
0.780
0.790
0.740
0.750
0.760
0.770
0.760
0.770
0.780
0.790
0.770
0.780
0.790
0.800
0.780
0.790
0.800
0.810
0.780
0.790
0.800
0.810
0.790
0.800
0.810
0.820
0.800
0.810
0.810
0.820
0.800
0.810
0.820
0.830
45th
50th
55th
60th
65th
70th
75th
80th
Percentile Percentile Percentile Percentile Percentile Percentile Percentile Percentile
0.060
0.060
0.060
0.070
0.070
0.073
0.080
0.080
0.120
0.130
0.130
0.130
0.140
0.140
0.150
0.152
0.190
0.190
0.200
0.200
0.210
0.210
0.220
0.230
0.250
0.255
0.260
0.260
0.270
0.280
0.280
0.290
0.310
0.310
0.320
0.330
0.330
0.340
0.350
0.360
0.380
0.380
0.390
0.390
0.400
0.400
0.410
0.420
0.440
0.450
0.450
0.460
0.460
0.470
0.480
0.490
0.500
0.510
0.520
0.520
0.530
0.530
0.540
0.550
0.570
0.570
0.580
0.590
0.590
0.600
0.610
0.610
0.630
0.635
0.640
0.650
0.650
0.660
0.670
0.680
0.670
0.680
0.690
0.690
0.700
0.710
0.710
0.720
0.710
0.710
0.720
0.730
0.730
0.740
0.750
0.750
0.730
0.740
0.745
0.750
0.760
0.760
0.770
0.780
0.756
0.760
0.770
0.770
0.780
0.780
0.790
0.800
0.780
0.780
0.790
0.790
0.800
0.800
0.810
0.810
0.790
0.800
0.800
0.810
0.810
0.820
0.820
0.830
0.810
0.820
0.820
0.830
0.810
0.820
0.830
0.840
0.820
0.830
0.830
0.840
0.820
0.830
0.840
0.850
0.830
0.840
0.840
0.850
0.830
0.840
0.850
0.860
0.830
0.850
0.850
0.860
0.840
0.850
0.860
0.870
85th
90th
95th
Percentile Percentile Percentile Maximum
0.090
0.091
0.100
0.150
0.160
0.170
0.180
0.250
0.230
0.250
0.260
0.340
0.300
0.310
0.330
0.410
0.370
0.380
0.390
0.470
0.430
0.440
0.460
0.540
0.500
0.510
0.530
0.610
0.560
0.570
0.590
0.670
0.620
0.640
0.650
0.720
0.680
0.690
0.710
0.790
0.730
0.740
0.750
0.810
0.760
0.770
0.790
0.850
0.790
0.800
0.810
0.870
0.810
0.820
0.830
0.900
0.820
0.830
0.850
0.920
0.840
0.850
0.860
0.910
0.850
0.860
0.870
0.880
0.860
0.870
0.880
0.880
0.870
0.880
0.890
0.900
0.910
0.920
0.950
0.940