Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Need help with number 5 using c++. The header file \"randomx.h\" is included and

ID: 3847568 • Letter: N

Question

Need help with number 5 using c++. The header file "randomx.h" is included and used for number 5. thanks!



5. Verify the Normal Random Number You are asked to veri the rx normal function whether it generates Gaussian random numbers. Call the rx normal (u, s) for n times where u and s are the desired mean and standard deviation, respectively. calculate their sum and sum of square as yx and Ex2 and compare their real mean and standard deviation to the desired mean and standard deviation. E[X] E[X2] Verify the ratio of samples within u to, u t 20, t 3o ranges based on the statistics from the wikipedia https n wiki wiki Norm distribution).

Explanation / Answer

let u and s be the desired mean and standard deviation. Also n is provided.

//Code starts here

double sum = 0.0;

double sumOfSquares = 0.0;

for(int i = 0; i < n; i++){

double x = rx_normal();

sum += x;

sumOfSquares += x*x;

}

double Ex = sum / n;

double Exx = sumOfSquares / n;

double sd = sqrt(Exx - Ex * Ex);

//Code ends here

We got the real mean as Ex, real standard deviation as Exx. Also the desired mean is u, and desired standard deviation is s. So now you can compare both and arrive at the result of the second part which is a problem of statistics. Remember to include the math library.

Hope it Helps!

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote