{'fraction_non_alphanumeric': 0.03662551440329218, 'fraction_numerical': 0.009876543209876543, 'mean_word_length': 4.298328488372093, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
Galton Board

In this paper, we present results of simulations of a model of the Galton board for various degrees of elasticity of the ball-to-nail collision.


Introduction
The Galton board is an upright board with evenly spaced nails driven into its upper half. The nails are arranged in staggered order. The lower half of the board is divided with vertical slats into a number of narrow rectangular slots. From the front, the whole installation is covered with a glass cover. In the middle of the upper edge, there is a funnel in which balls can be poured, the diameter of the balls being much smaller than the distance between the nails. The funnel is located precisely above the central nail of the second row, i. e. the ball, if perfectly centered, would fall vertically and directly onto the uppermost point of this nail's surface (Fig. 1). Fig. 1 Theoretically, the ball would repeatedly bounce off this nail's uppermost point. Obviously, such a motion of the ball is unstable. In fact, due to unavoidable inaccuracy in the board's positioning and impossibility to completely exclude the lateral component, no matter how small, of the ball's velocity, each ball, generally speaking, would meet the nail somewhat obliquely. The ball would then deviate from the vertical line and, after having collided with many other nails, fall into one of the slots. If the experiment is run with a large number of balls, dropped one after the other, then the following results are obtained: the balls are distributed evenly to the left and to the right of the central compartment (left and right deviations are equiprobable). Besides, the balls would more rarely fall into the leftmost and rightmost compartments, for large deviations are more rare to appear than small ones. However, despite the presence of nails and all the imperfections in the construction, the majority of the balls will agglomerate in the central compartment as this provides the smallest deviation. The number of balls in the compartments would approximately correspond to the Gaussian law of errors. In the earlier experiments with the Galton board the funnel was filled with pellets or millet grains.

Statement of problem
In Galton board experiments ball-to-nail impacts have always been inelastic. In this paper, we present results of simulations of a model of the Galton board for various degrees of elasticity of the ball-to-nail collision.
We model the ball as a mass point. Hence, the ball's motion can be regarded as the motion of a mass point in a vertical plane under the action of gravity accompanied with multiple collisions with the nails. These collisions are characterized by the coefficient of restitution e, which affects only the normal component of the ball's velocity after the impact. The coefficient of restitution is the first parameter of the problem. It can vary from 0 to 1. A value of e = 1 corresponds to absolutely elastic impact for which the ball's energy does not change. The other extreme case, e = 0, corresponds to absolutely inelastic impact: the ball "sticks" to the nail. The nail's radius R is the second parameter of the problem. Since the ball leaves the funnel and falls onto the nail centrally, but possibly with some small departure to the left or to the right, we adopt that the first drop of the ball obeys the Gaussian law. On the other hand, if the balls distribute uniformly over the funnel's opening, then their distribution over the rectangular compartments will be far from normal (Fig. 2). This distribution resembles the arcsine law . Incidentally, according to Paul Levy, the distribution of time intervals over which a Brownian particle is located on the positive semi-axis, has a similar form. This observation is, probably, not just a coincidence. The point is that a particle in Brownian motion experiences a large number of random collisions with molecules of the surrounding fluid (in our case, the "molecules" are regularly placed and fixed). Accordingly, the problem's third parameter is the variance of the distribution of the balls over the funnel's opening. Thus, we introduce three parameters for the problem: 1) the coefficients of restitution e, 2) the nail's radius R, 3) the variance σ 0 of the normal distribution of the first ball-tonail impact.
It is also necessary to choose the dimensions of the model board. The geometry of the board should meet the two requirements: • the balls should not reach the vertical boundaries of the Galton board; • each ball should experience at least several collisions with the nails before it gets into one of the rectangular compartments.

Mathematical model
The method of investigation consists in simulating the motion of the balls (mass points) and taking into account their collisions with obstacles (the nails) for different values of the three specified parameters of the problem.
On the Galton board, we introduce an orthogonal coordinate system Oxy in the following way: the axis Ox is directed horizontally and passes through the upper boundaries of the rectangular compartments, in which the falling balls are to be collected (for brevity, from this point on, we will say compartments instead of rectangular compartments). The axis Oy is directed vertically and goes through the center of the nail that a ball is to hit first. The length of the board is taken large enough for the balls not to reach its vertical boundaries (as was specified earlier).
Thus, a pair x, y represents the position of a ball in the plane of the Galton board. The fall of the ball is described with a set of two ordinary differential equations: where g is the gravitational acceleration.
Since the ball falls from the funnel and onto the first nail under gravity, the velocity of the ball at the point of the first impact is v 0 = 2g(h 0 − R sin α 0 ), where h 0 is the distance between the funnel's opening and the center of the first nail, R is the nail's radius, while α 0 is the angle between the axis Ox and the radius drawn to the point where the ball hits the nail (Fig. 4).
We will investigate the further motion of the ball according to the following plan: 1. Introduce a coordinate system fixed to the nail: its origin is at the ball-to-nail impact point, and its axes are the tangent and the normal to the nail's surface at this point. Thus, with respect to this coordinate system, the velocity of the particle at the first impact point has the following components: 2. After the impact with the nail, the velocity components will change and take the form: 3. Then the ball will move in a parabola. To find its path, we solve the equations (1) with the following initial values: x (0) = x 0 , y (0) = y 0 ,ẋ (0) = v 1 cos γ 0 ,ẏ (0) = v 1 sin γ 0 , where (x 0 , y 0 ) are the coordinates of the ball at the time it hits the nail, v 1 = (v τ 1 ) 2 + (v n 1 ) 2 , while γ 0 is the angle between the axis Ox and the velocity vector v 1 . Thus, the ball's path is the following parabola: The portion of the parabola the ball will take is determined by the direction of the ball's velocity vector after its impact with the nail.
4. From (1) we find the velocity with which the ball will approach the next nail. Let (x 1 , y 1 ) be the coordinates of the point of the next ball-to-nail impact. Then the velocity of the ball on the surface of this nail has the following components: Then another collision occurs, and again the ball's motion is calculated according to the procedure described above. The whole operation is repeated until the ball crosses the axis Ox. As soon as the ball's path crosses the axis Ox, we find the intersection point and thus determine the compartment the ball falls into. One of the most important things about this model is to find the nail that the ball is going to hit next. To that end, consider the perpendiculars to the ball's path which go through the nails' centers. Such perpendiculars are described with linear equations: where (x imp , y imp ) are the coordinates of the previous ball-to-nail impact, (x n , y n ) are the coordinates of the path's point through which a perpendicular is drawn, v is the magnitude of the ball's velocity after the previous impact, and γ is the angle between the axis Ox and the velocity vector v. Since our goal is to find perpendiculars through the nails' centers, we insert the coordinates of the center of one of the nails (x c , y c ) into (3). From this equation, we find a pair (x n , y n ) which meets the following requirements: • the distance between the nail's center and the point (x n , y n ) is smaller than the nail's radius; • the absolute value of the difference between the abscissa of the previous impact point and the abscissa of the path's point, through which the perpendicular is drawn, is as small as possible.
The first requirement is to ensure that the ball's path meets the nail, i. e. the coordinates of the next impact point (x, y) can be found. These coordinates satisfy the following set of equations: where (x c , y c ) are the coordinates of the nail's center, R is the nail's radius, and (x imp , y imp ) are the coordinates of the previous impact point.
The second requirement is to take the impacts in their sequence. This follows from the parametric form of the ball's path. We solve the equations (1) with the following initial values: where (x imp , y imp ) are the coordinates of the previous impact point, v is the magnitude of the ball's velocity after the previous impact, while γ is the angle between the axis Ox and the velocity vector v. The result is the parametric form of the ball's path after it has hit the nail: 5. Simulation results. The model Galton board has been implemented as an interactive Microsoft Visual C++ application. The application offers the opportunity to vary every parameter of the model: the nail's radius, the coefficient of restitution, and the variance of the initial distribution when the ball hits the first nail; it also allows varying the number of dropped balls. The application outputs a histogram of the balls in the compartments and the variance of the final distribution of the balls over the compartments. Besides, the experiment's results can be visualized.
First, we get a histogram of the distribution of the balls over the compartments (Fig. 5). Form this histogram, the variance is calculated using the following well-known formulas: wherex is the mathematical expectation, x i is the coordinate of the center of the ith compartment, n is the number of compartments, N is the number of dropped balls, N i is the final number of balls accumulated in the ith compartment, and σ is the variance of the distribution. Second, using the variance obtained, we plot the normal distribution (Gaussian) curve using the Gauss formula f (x) = 1 σ √ 2π e −(x−x) 2 /(2σ 2 ) . Next, we compare the theoretical curve with the model curve (Fig. 6). The model curve is plotted with squares, while the theoretical curve is plotted as a solid line. The results given in this paper were obtained for 100 000 dropped balls. This number is optimal from the viewpoint of the result's accuracy and the processing time needed for the experiment.  Let us first consider the case where the balls are distributed uniformly on the width of the funnel's opening. Instead of the normal distribution of the balls over the compartments (as it might be expected), we get a somewhat unusual distribution with peripheral peaks and two distinctive gaps near the center (Fig. 2). These gaps are located symmetrically with respect to the vertical axis through the funnel's center. For this case, the 200 × 100 model Galton board was taken, otherwise the balls reach its vertical boundaries.
More precisely, Fig. 2 corresponds to the case of absolutely elastic impact (e = 1) and R = 0.1.
For a smaller value of the coefficient of restitution (e = 0.8) and an increased value of the nail's radius to R = 0.3, the balls' distribution over the compartments changes not very significantly: distinctive peripheral peaks are still present, while instead of two pronounced gaps we have several symmetrically located small pits (Fig. 8a). With a further decrease of the coefficient of restitution the depth and structure of these pits changes. In Figs. 8b, c, and d, the histograms are shown for e = 0.6, e = 0.4, and e = 0.1, respectively (the nail's radius is the same, R = 0.3).
If the balls are fed into the funnel according to a Gaussian law with large dispersion σ 0 , then the form of the histograms will not change qualitatively. Therefore, the case of small dispersion σ 0 becomes especially interesting.
Let σ 0 = 0.05 and R = 0.4. We are going to investigate the form of the histogram, as the coefficient of restitution e decreases from 1 to 0. Figures 9 (a-d) show the balls' distributions over the compartments for e = 1 1 (a), 0.9 (b), 0.8 (c), and 0.7 (d).
We can see that the distribution in the case of absolutely elastic impact is almost Gaussian with two noticeable pits. As the coefficient of restitution decreases, the "normal" distribution gets "corrupted"; instead of the pits, distinctive gaps appear, which become deeper with a decrease of e. However, this picture holds only for e below a value of e ≈ 0.7. A further decrease of the coefficient of restitution makes the gaps disappear, and the distribution becomes practically indistinguishable from the Gaussian distribution (Fig. 9e). Figures 10 (a-e) show a similar series of histograms for R = 1, while the coefficient of restitution takes successively the values 0.7, 0.6, 0.3, 0.2, and 0.1. We can see that for e = 0.2 there are two gaps, while for larger and smaller values of e the distribution is, practically, Gaussian. A further increase in e results in a distribution which is very different from Gaussian.
The mentioned "occasions" of deviation of the final distribution of the balls from a Gaussian distribution are intriguingly associated with non-monotonic behavior of the variance σ as a function of two variables R and e (with σ 0 being fixed). Table 2 gives the values of σ for σ 0 = 0.05. We can see that for a fixed R , the variance σ a local maximum. It is exactly that value of the coefficient of restitution in the vicinity of which a substantial deviation from the Gaussian distribution occurs. For example, for R = 0.4, the variance σ has a maximum at e ≃ 0.7; this value has already been mentioned in connection with the analysis of the series of histograms in Fig. 9. Similarly, for R = 1, the local maximum is reached at e ≃ 0.2 (as it should be, according to Fig. 10). Table 2. σ 0 = 0.05