Playing a discrete random variable. Random Variables of Discrete Type and Formulas for Playing Them Playing a Discrete Random Variable

Of all random variables, it is easiest to play (simulate) a uniformly distributed variable. Let's see how it's done.

Let's take some device, at the output of which the digits 0 or 1 can appear with probability; the appearance of one or another number should be random. Such a device can be a tossed coin, dice(even - 0, odd - 1) or a special generator based on counting the number of radioactive decays or bursts of radio noise over a certain time (even or odd).

Let's write y as a binary fraction and replace successive digits with numbers generated by the generator: for example, . Since the first digit is equally likely to be 0 or 1, this number is equally likely to lie in the left or right half of the segment. Since 0 and 1 are also equally likely in the second digit, the number lies in each half of these halves with equal probability, and so on. Hence, a binary fraction with random digits really takes any value on the segment with equal probability

Strictly speaking, only a finite number of bits k can be played. Therefore, the distribution will not be completely required; the mathematical expectation will be less than 1/2 by the value (because the value is possible, but the value is impossible). So that this factor does not affect, multi-digit numbers should be taken; True, in the method of statistical testing, the accuracy of the answer usually does not exceed 0.1% -103, and the condition gives that on modern computers it is overfulfilled with a large margin.

pseudo-random numbers. Real random number generators are not free from systematic errors: coin asymmetry, zero drift, etc. Therefore, the quality of the numbers they produce is checked by special tests. The simplest test is to calculate for each digit the frequency of occurrence of zero; if the frequency is noticeably different from 1/2, then there is a systematic error, and if it is too close to 1/2, then the numbers are not random - there is some pattern. More complex tests are the calculation of correlation coefficients of consecutive numbers

or groups of digits within a number; these coefficients should be close to zero.

If any sequence of numbers satisfies these tests, then it can be used in calculations according to the method of statistical tests, without being interested in its origin.

Algorithms for constructing such sequences have been developed; symbolically they are written by recurrent formulas

Such numbers are called pseudo-random and are calculated on a computer. This is usually more convenient than using special generators. But each algorithm has its own limit on the number of sequence members that can be used in calculations; with a larger number of terms, the random character of numbers is lost, for example, periodicity is found.

The first algorithm for obtaining pseudo-random numbers was proposed by Neumann. Let's take a number from digits (decimal for definiteness) and square it. We leave the middle numbers near the square, discarding the last and (or) the first. We square the resulting number again, and so on. The values ​​are obtained by multiplying these numbers by For example, let's set and choose the initial number 46; then we get

But the distribution of Neumann numbers is not uniform enough (values ​​predominate, which is clearly seen in the example above), and now they are rarely used.

The most commonly used now is a simple and good algorithm related to the selection of the fractional part of the product

where A is a very large constant (the curly bracket denotes the fractional part of the number). The quality of pseudo-random numbers strongly depends on the choice of the value A: this number in binary notation must have a sufficiently "random" value, although its last digit should be taken as one. The value has little effect on the quality of the sequence, but it has been noted that some values ​​are unsuccessful.

With the help of experiments and theoretical analysis, the following values ​​have been investigated and recommended: for BESM-4; for BESM-6. For some American computers, these numbers are recommended and are related to the number of digits in the mantissa and the order of the number, so they are different for each type of computer.

Remark 1. In principle, formulas like (54) can give very long good sequences if they are written in a non-recursive form and all multiplications are performed without rounding. Normal rounding on a computer degrades the quality of pseudo-random numbers, but nevertheless, the members of the sequence are usually suitable.

Remark 2. The quality of the sequence improves if small random perturbations are introduced into algorithm (54); for example, after normalizing a number, it is useful to send the binary order of the number to the last binary digits of its mantissa

Strictly speaking, the regularity of pseudo-random numbers should be imperceptible in relation to the required particular application. Therefore, in simple or well-formulated problems, it is possible to use sequences of not very good quality, but this requires special checks.

Arbitrary distribution. To play a random variable with non-uniform distribution, you can use formula (52). Play y and determine from equality

If the integral is taken in its final form and the formula is simple, then this is the most convenient way. For some important distributions - Gauss, Poisson - the corresponding integrals are not taken and special ways of playing out have been developed.


INTRODUCTION

It is customary to call a system a set of elements between which there are connections of any nature, and it has a function (purpose) that its constituent elements do not have. Information systems, as a rule, are complex geographically distributed systems with a large number of constituent elements that have an extensive network structure.

Development mathematical models, allowing to evaluate the performance indicators information systems, is a complex and time-consuming task. To determine the characteristics of such systems, one can apply the method simulation modeling with subsequent processing of the results of the experiment.

Simulation modeling is one of the central topics in the study of the disciplines "Modeling systems" and " Math modeling"The subject of simulation modeling is the study of complex processes and systems, usually subject to the influence of random factors, by conducting experiments with their simulation models.

The essence of the method is simple - the “life” of the system is simulated with repeated repetition of tests. In this case, randomly changing external influences on the system are modeled and recorded. For each situation, system indicators are calculated according to the model equations. The existing modern methods of mathematical statistics make it possible to answer the question - is it possible and with what confidence to use simulation data. If these confidence indicators are sufficient for us, we can use the model to study this system.

We can talk about the universality of simulation modeling, since it is used to solve theoretical and practical problems of analyzing large systems, including the problems of evaluating options for the structure of a system, evaluating the effectiveness of various system control algorithms, and evaluating the impact of changing various system parameters on its behavior. Simulation modeling can also be used as the basis for the synthesis of large systems, when it is required to create a system with given characteristics under certain restrictions, and which would be optimal according to the selected criteria.

Simulation is one of the most effective means research and design of complex systems, and often the only practically implemented method for studying the process of their functioning.

The purpose of the course work is to study by students the methods of simulation and methods of processing statistical data on a computer using application software. Here are some possible topics term papers, allowing you to explore complex systems based on simulation models.

· Simulation modeling in problems of one-dimensional or flat cutting. Comparison of the cutting plan with the optimal plan obtained by linear integer programming methods.

· Transport models and their variants. Comparison of the transportation plan obtained by the simulation method with the optimal plan obtained by the potential method.

· Application of the simulation method to solving optimization problems on graphs.

· Determination of production volumes as a task of multicriteria optimization. Using the simulation method to find the reachable set and the Pareto set.

· Method of simulation modeling in tasks of scheduling. Get advice on how to create a rational schedule.

· Study of the characteristics of information systems and communication channels as queuing systems by simulation.

· Construction of simulation models when organizing queries in databases.

· Application of the simulation method for solving the problem of inventory management with constant, variable and random demand.

· Investigation of the operation of the chipper shop by simulation modeling.

TASK FOR COURSE WORK

Technical system S consists of three elements, the connection diagram of which is shown in Fig.1. The times of uptime X 1 , X 2 , X 3 elements of the system are continuous random variables with known laws of probability distribution. The external environment E affects the operation of the system in the form of a random variable V with a known discrete probability distribution.

It is required to evaluate the reliability of the system S by computer simulation with subsequent processing of the experimental results. Below is the sequence of work.

1. Development of algorithms for playing random variables X 1 , X 2 , X 3 and V using random number generators contained in mathematical packages, such as Microsoft Excel or StatGraphics.

2. Determining the system uptime Y depending on the uptime X 1 , X 2 , X 3 elements based on the block diagram of the reliability calculation.

3. Determining the system uptime taking into account the influence external environment in accordance with the formula Z=Y/(1+0.1V).

4. Construction of a modeling algorithm that simulates the operation of the system S and takes into account the possibility of failure of elements and random effects of the external environment E. Implementation of the obtained algorithm on a computer and creation of a file with the values ​​of random variables X 1 , X 2 , X 3 , V, Y and Z. Number Take 100 experiments for the machine experiment.

5. Statistical processing of the obtained results. To this end, it is necessary

Divide the data for the random variable Z into 10 groups and form a statistical series containing the boundaries and midpoints of partial intervals, the corresponding frequencies, relative frequencies, cumulative frequencies and cumulative relative frequencies;

For the Z value, build a polygon and frequency cumulate, build a histogram based on relative frequency densities;

For the values ​​X 1 , X 2 , X 3 , V to establish their compliance with the given distribution laws, using the criterion c 2 ;

For a random variable Z consider three continuous distribution(uniform, normal, gamma), plot on a histogram for Z the density of these distributions;

Using the criterion c 2, check the validity of the hypothesis about the correspondence of statistical data to the selected distributions, the level of significance in the selection of a suitable distribution is taken equal to 0.05.

6. Write down the distribution density function of the uptime Z of the system, determine the mathematical expectation, variance and standard deviation of the random variable Z. Determine the main characteristics of the system reliability: the mean time to failure T 1 and the probability of failure-free operation P(t) during the time t. Find the probability that the system will not fail in time T 1 .

Task options are given from Table 1 individually to each student. The designations of random variables are contained in the text in paragraphs 2 and 3. Structural diagrams for calculating the reliability in accordance with their numbers are shown in Fig.1.

Table 1

Task options

Option x1 x2 x3 V Scheme number
LN(1.5;2) LN(1.5;2) E(2;0,1) B(5;0.7)
U(18;30) U(18;30) N(30;5) G(0.6)
W(1.5;20) W(1.5;20) U(10;20) P(2)
Exp(0,1) Exp(0,1) W(2;13) B(4;0.6)
N(18;2) N(18;2) Exp(0.05) G(0.7)
E(3;0,2) E(3;0,2) LN(2;0.5) P(0.8)
W(2,1;24) W(2,1;24) E(3;0.25) B(3;0.5)
Exp(0.03) Exp(0.03) N(30;0.4) G(0.8)
U(12;14) U(12;14) W(1.8;22) P(3,1)
N(13;3) N(13;3) W(2;18) B(4;0.4)
LN(2;1) LN(2;1) Exp(0.04) G(0.9)
E(2;0,1) E(2;0,1) LN(1;2) P (4.8)
W(1,4;20) W(1,4;20) U(30;50) B(3;0,2)
Exp(0.08) Exp(0.08) LN(2;1.5) G(0.3)
U(25;30) U(25;30) N(30;1.7) P(2.8)
N(17;4) N(17;4) E(2;0.04) B(2;0,3)
LN(3;0.4) LN(3;0.4) Exp(0.02) G(0.4)
E(2;0.15) E(2;0.15) W(2,3;24) P(1.6)
W(2,3;25) W(2,3;25) U(34;40) B(4;0.9)
Exp(0.02) Exp(0.02) LN(3,2;1) G(0.7)
U(15;22) U(15;22) N(19;2,2) P(0.5)
N(15;1) N(15;1) E(3;0.08) B(4;0.6)
LN(2;0,3) LN(2;0,3) Exp(0.02) G(0.5)
E(3;0.5) E(3;0.5) W(3;2) P(3,6)
W(1.7;19) W(1.7;19) U(15;20) B(5;0.7)
Exp(0.06) Exp(0.06) LN(2;1,6) G(0.2)
U(15;17) U(15;17) N(12;4) P(4.5)
N(29;2) N(29;2) E(2;0.07) B(2;0.7)
LN(1.5;1) LN(1.5;1) Exp(0.08) G(0.7)
E(2;0.09) E(2;0.09) W(2,4;25) P(2.9)

In Fig. 1, there are three types of connection of elements: series, parallel (permanent reserve) and replacement redundancy.

The time to failure of a system consisting of series-connected elements is equal to the smallest of the times to failure of the elements. The time to failure of a system with a permanently switched on reserve is equal to the largest of the times to failure of the elements. The time to failure of a system with a replacement reserve is equal to the sum of the times to failure of the elements.



Scheme 1. Scheme 2.


Scheme 3. Scheme 4.


Scheme 5. Scheme 6.

Scheme 7. Scheme 8.

Let it be required to play a continuous random variable X, i.e. get the sequence of its possible values ​​(i=1, 2, ..., n), knowing the distribution function F(x).

Theorem. If is a random number, then possible meaning of the continuous random variable X being played with a given distribution function F (x), corresponding to , is the root of the equation .

Rule 1 To find a possible value, a continuous random variable X, knowing its distribution function F (x), it is necessary to choose a random number , equate its distribution function and solve the resulting equation .

Remark 1. If it is not possible to solve this equation explicitly, then resort to graphical or numerical methods.

Example 1. Play 3 possible values ​​of a continuous random variable X distributed uniformly in the interval (2, 10).

Solution: Let's write the distribution function of the value X, distributed uniformly in the interval (a, b): .

By condition, a=2, b=10, therefore, .

Using rule 1, we write an equation to find possible values ​​of , for which we equate the distribution function to a random number:

From here .

Let's choose 3 random numbers, for example, , , . Substitute these numbers into the equation, resolved with respect to ; as a result, we obtain the corresponding possible values ​​of X: ; ; .

Example 2. A continuous random variable X is distributed according to an exponential law given by the distribution function (the parameter is known) (x > 0). It is required to find an explicit formula for playing out the possible values ​​of X.

Solution: Using the rule, write the equation .

Let's solve this equation for : , or .

The random number is in the interval (0, 1); hence the number is also random and belongs to the interval (0,1). In other words, R and 1-R are equally distributed. Therefore, to find it, you can use a simpler formula.

Remark 2. It is known that .

In particular, .

It follows that if the probability density is known, then to play out X, instead of the equations, we can solve the equation with respect to .

Rule 2 In order to find the possible value of a continuous random variable X, knowing its probability density , one must choose a random number and solve an equation or equation with respect to , where a is the smallest finite possible value of X.

Example 3. Given the probability density of a continuous random variable X in the interval ; outside this interval. It is required to find an explicit formula for playing out the possible values ​​of X.

Solution: Let's write an equation in accordance with rule 2.

After integrating and solving the resulting quadratic equation relatively , finally we get .



18.7 Approximate play of a normal random variable

Recall first that if a random variable R is uniformly distributed in the interval (0, 1), then its mathematical expectation and variance are respectively equal: М(R)=1/2, D(R)=1/12.

Let us compose the sum of n independent, uniformly distributed in the interval (0, 1) random variables : .

To normalize this sum, we first find its mathematical expectation and variance.

It is known that the mathematical expectation of the sum of random variables is equal to the sum of the mathematical expectations of the terms. The sum contains n terms, the mathematical expectation of each of which, due to M(R)=1/2, is 1/2; therefore, the expectation of the sum

It is known that the variance of the sum of independent random variables is equal to the sum of the variances of the terms. The sum contains n independent terms, the variance of each of which, due to D(R)=1/12, is equal to 1/12; hence the variance of the sum

Hence the standard deviation of the sum

We normalize the sum under consideration, for which we subtract the mathematical expectation and divide the result by the standard deviation: .

By virtue of the central limit theorem at , the distribution of this normalized random variable tends to normal with the parameters a=0 and . For finite n, the distribution is approximately normal. In particular, for n=12 we obtain a fairly good and easy-to-calculate approximation .

The estimates are satisfactory: close to zero, little different from one.

List of sources used

1. Gmurman V.E. Theory of Probability and Mathematical Statistics. - M.: Higher School, 2001.

2. Kalinina V.N., Pankin V.F. Math statistics. - M .: Higher school, 2001.

3. Gmurman V.E. Guide to solving problems in probability theory and mathematical statistics. - M .: Higher school, 2001.

4. Kochetkov E.S., Smerchinskaya S.O., Sokolov V.V. Theory of Probability and Mathematical Statistics. - M.: FORUM: INFRA-M, 2003.

5. Agapov G.I. Problem book on the theory of probability. - M .: Higher School, 1994.

6. Kolemaev V.A., Kalinina V.N. Theory of Probability and Mathematical Statistics. – M.: INFRA-M, 2001.

7. Wentzel E.S. Probability Theory. - M .: Higher school, 2001.

Denote the uniformly distributed SW in the interval (0, 1) by R, and its possible values ​​(random numbers) by r j .

Let's split the interval )