The estimate of the mathematical expectation tends in probability to the true value when the number of simulations tends n to infinity. In this case, absolute error \(\varepsilon ,\) the estimate obtained is proportional to \({{n}^{{ - {1 \mathord{\left/ {\vphantom {1 2}} \right. \kern-0em} 2}}}}.\) As IA takes one of two possible values \(\left\{ {0,1} \right\},\) this random variable can be attributed to the class of Bernoulli numbers, for which, in turn, it is possible to directly calculate required number of realizations N* guaranteeing fulfillment of the inequality (1). There are several approaches to determining N* [17].
The roughest upper bound can be obtained based on the Chebyshev inequality,\(\Pr \left( {\left| {X - m} \right| \geqslant \varepsilon } \right) \leqslant {{{{D}_{x}}} \mathord{\left/ {\vphantom {{{{D}_{x}}} {{{\varepsilon }^{2}}}}} \right. \kern-0em} {{{\varepsilon }^{2}}}},\) where X is a random value, \(m\) is an expected value, and \({{D}_{x}}\) is variance. Let us select \(X = {{\bar {m}}_{n}},\) wherein \({{D}_{x}} = {{{{D}_{{{{I}_{A}}}}}} \mathord{\left/ {\vphantom {{{{D}_{{{{I}_{A}}}}}} {\sqrt n }}} \right. \kern-0em} {\sqrt n }}.\) Denoting \(\alpha = {{{{D}_{{{{I}_{A}}}}}} \mathord{\left/ {\vphantom {{{{D}_{{{{I}_{A}}}}}} {n{{\varepsilon }^{2}}}}} \right. \kern-0em} {n{{\varepsilon }^{2}}}},\) we obtain that the inequality
$$\Pr \left( {\left| {{{{\bar {m}}}_{n}} - m} \right| \leqslant \varepsilon } \right) \geqslant 1 - \alpha $$
(2)
is guaranteed to be fulfilled when \(n = {{{{D}_{{{{I}_{A}}}}}} \mathord{\left/ {\vphantom {{{{D}_{{{{I}_{A}}}}}} {\alpha {{\varepsilon }^{2}}}}} \right. \kern-0em} {\alpha {{\varepsilon }^{2}}}}.\) For Bernoulli numbers, the variance does not exceed 0.25; therefore, the upper bound for the required number of simulations is
$$N_{{Cheb}}^{*} = {1 \mathord{\left/ {\vphantom {1 {4\alpha {{\varepsilon }^{2}}}}} \right. \kern-0em} {4\alpha {{\varepsilon }^{2}}}}.$$
(3)
An alternative approach to determining N* is based on the central limit theorem: if \({{X}_{1}}, \ldots ,{{X}_{n}}\) independent random variables distributed according to the same law, then \(\frac{{{{{\bar {m}}}_{n}} - m}}{{\sqrt {{{{{D}_{Y}}} \mathord{\left/ {\vphantom {{{{D}_{Y}}} n}} \right. \kern-0em} n}} }}\xrightarrow[{n \to \infty }]{}\mathcal{N}\left( {0,1} \right).\) Based on this, we can write the approximate inequality \(\Pr \left( {\left| {{{{\bar {m}}}_{n}} - m} \right| \leqslant \varepsilon } \right)\) ≈ \(1 - \frac{{{{z}_{{{{{\alpha }} \mathord{\left/ {\vphantom {{{\alpha }} 2}} \right. \kern-0em} 2}}}}{{D}_{Y}}}}{{n{{\varepsilon }^{2}}}},\) which holds for \(n = {{{{z}_{{{{{\alpha }} \mathord{\left/ {\vphantom {{{\alpha }} 2}} \right. \kern-0em} 2}}}}{{D}_{Y}}} \mathord{\left/ {\vphantom {{{{z}_{{{{{\alpha }} \mathord{\left/ {\vphantom {{{\alpha }} 2}} \right. \kern-0em} 2}}}}{{D}_{Y}}} {\alpha {{\varepsilon }^{2}}}}} \right. \kern-0em} {\alpha {{\varepsilon }^{2}}}},\) where \({{z}_{{{{{\alpha }} \mathord{\left/ {\vphantom {{{\alpha }} 2}} \right. \kern-0em} 2}}}}\) is the quantile of the normal distribution for the probability \(1 - {\alpha \mathord{\left/ {\vphantom {\alpha 2}} \right. \kern-0em} 2}.\)
Using the upper bound for the variance of the Bernoulli numbers, we find that the inequality (2) is approximately fulfilled for
$$N_{{CLT}}^{*} = {{{{z}_{{{{{\alpha }} \mathord{\left/ {\vphantom {{{\alpha }} 2}} \right. \kern-0em} 2}}}}} \mathord{\left/ {\vphantom {{{{z}_{{{{{\alpha }} \mathord{\left/ {\vphantom {{{\alpha }} 2}} \right. \kern-0em} 2}}}}} {4{{\varepsilon }^{2}}}}} \right. \kern-0em} {4{{\varepsilon }^{2}}}}.$$
(4)
Comparing (4) and (3), we can conclude that, due to the absence of a confidence factor in denominator (4), magnitude \(N_{{CLT}}^{*}\) grows much more slowly than \(N_{{Cheb}}^{*}.\) On the other hand, it should not be forgotten that, in this case, inequality (2) is asymptotically true.
The third way of finding N* is based on Hefding’s inequality for random variables lying in the range \(\left[ {0,1} \right]{\text{:}}\) \(\Pr \left( {\left| {{{{\bar {m}}}_{n}} - m} \right| \geqslant \varepsilon } \right) \leqslant 2\exp \left( { - 2n{{\varepsilon }^{2}}} \right),\) and, hence, N * can be found from the equation
$$N_{{Hoeff}}^{*} = {{\ln (2{\text{/}}\alpha )} \mathord{\left/ {\vphantom {{\ln (2{\text{/}}\alpha )} {2{{\varepsilon }^{2}}}}} \right. \kern-0em} {2{{\varepsilon }^{2}}}}.$$
(5)
Table 1 shows the calculation of number of simulations N* necessary for guaranteed achievement of accuracy \(\varepsilon = {{10}^{{ - 4}}}\) with different approaches.
Table 1. The number of realizations to guarantee the solution accuracy \(\varepsilon = {{10}^{{ - 4}}}\) The minimum value of N* is obtained by means of a method based on the conclusions of the central limit theorem. Even when using formula (4), the order of the number of simulations is 109, which casts doubt on the applicability of the Monte Carlo method for calculating the collision probability. At the same time, it should be noted that, in formulas (3)–(5), it is assumed that the maximum possible value of the variance is \({{D}_{{{{I}_{A}}}}} = {1 \mathord{\left/ {\vphantom {1 4}} \right. \kern-0em} 4}.\) In real calculations, the variance takes on a much smaller value and, as a consequence, the required accuracy is achieved with fewer simulations. This conclusion is confirmed by the graph in Fig. 4 showing the dependence of probability estimate \(\overline {\Pr \left( A \right)} \) on number of simulations N for several runs of the algorithm. The launches were carried out on the same initial data; a sphere was used as a three-dimensional model. Based on the graph, you can make an approximate conclusion about the rate of convergence of the method, an accuracy of \(\varepsilon = {{10}^{{ - 4}}}\) is achieved at N = 1.6 × 106.
On this basis, it is proposed to use the condition of automatic stopping of the calculation when the required accuracy and reliability of the solution is achieved. Starting with number of simulations N0, the current value of the variance \(\overline {{{D}_{{{{I}_{A}}}}}} \) is estimated and condition (4) is checked; if the condition is met, then the calculations are stopped.