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!
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!
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.