Home>

### Evaluation of the main characteristics of the received random variable in Python

You need to write two functions that calculate the mathematical expectation and dispersion of the resulting random value, respectively. The first feature is called Calc_mean, the second -Calc_var. They must take two arguments -integers N and M: n -the number of repetitions for averaging (this argument should be transmitted to Get_normal_Random (see info for it Next)). M -how many times to call the previous feature to assess the mathematical expectation and dispersion.

What is meant in view of the previous feature:

``````S= 0.0
For _ in Range (N):
s += random.random ()
Return S /N
DEF Get_Normal_Random (N):
Return (AVG_OF_RANDOM_NUMBERS (N) -0.5) * Math.SQRT (12 * N) ** 12
``````

That is, to create the Calc_mean function, you need to call the GET_NORMAL_RANDOM () function (where we led a random value to normal distribution) M times and averaged the values ​​obtained. I do not quite understand how to do it.

"I do not quite understand" -what exactly do you understand, and what exactly arose difficulties? Show what you have already done and what does not work? Because while the question sounds like "Do all for me." In general, the root square in the 12th degree is cool. Where did you get it?

passant2021-09-15 03:57:11

@Passant is a 12n root. Maybe there is some formula in statistics on this topic? )

CrazyElf2021-09-15 03:57:11
If you look at the function ``` AVG_OF_RANDOM_NUMBERS. ``` then you will see that there is exactly the procedure and is done, only ``` N. ``` times and with a function ``` Random.random ``` You can take this code as a basis. We have to change a couple of names and transmit more arguments to the function, but in general the essence of the code will be the same. Although this code can be recorded much shorter on Python, but for now it is not necessary for you.
If you look at the function ``` AVG_OF_RANDOM_NUMBERS. ``` then you will see that there is exactly the procedure and is done, only ``` N. ``` times and with a function ``` Random.random ``` You can take this code as a basis. We have to change a couple of names and transmit more arguments to the function, but in general the essence of the code will be the same. Although this code can be recorded much shorter on Python, but for now it is not necessary for you.