Run Code

API

Code Wall

Users

Misc

Feedback

Login

Theme

Privacy

Blog
Stats  Central Limit Theorem  Normal Distribution with multiple items
#include <cmath> #include <cstdio> #include <vector> #include <iostream> #include <algorithm> #include <iomanip> using namespace std; //A large elevator can transport a maximum of 9800 pounds. Suppose a load of cargo containing 49 boxes must be transported via the elevator. The box weight of this type of cargo follows a distribution with a mean of 205 pounds and a standard deviation of 15 pounds. Based on this information, what is the probability that all boxes can be safely loaded into the freight elevator and transported? double normalised_standard_distribution( double mean, double sd, double x){ double ans = 0.5 * ( 1 + erf( (x  mean)/ (sd * sqrt(2))) ); //note could use pow(2.0,0.5) as sqrt(2) return ans; } // For larger sample sizes use central limit theorem double central_limit_theorm(double mean, double sd, double x, double num){ return normalised_standard_distribution( num*mean, sqrt(num)*sd, x ); } int main() { /* Enter your code here. Read input from STDIN. Print output to STDOUT */ double x, num, mean, sd; cin >> x >> num >> mean >> sd; // as a larger sample size, use central limit theorem on top of standard distribution double ans = central_limit_theorm(mean, sd, x, num); cout << fixed << setprecision(4); cout << ans << endl; return 0; } // Also works for //The number of tickets purchased by each student for the University X vs. University Y football game follows a distribution that has a mean of and a standard deviation of . //250,100,2.4,2.0 //A few hours before the game starts, eager students line up to purchase lastminute tickets. If there are only tickets left, what is the probability that all students will be able to purchase tickets?
run

edit

history

help
0
Please
log in
to post a comment.
BinTreeInsert
Scemo
amma2
barai_1
KhadijahAlshehhi
1
Easy String Reverse Example
<string> Indirect include of <errno.h> with gcc
Biggest even palindrom
Const Return Test
Please log in to post a comment.