I have a monte carlo problem to solve to;
1) Determine the uncertainty
2) generate 10^3 values for normally distributed x and y variables
3) Calculate the variable q for each (x,y) pair
4) Plot a histogram
The given question is
x=6.0+-0.1
y=3.0+-0.1
find q= xy + x^2 / y (Find answer with uncertainty using monte carlo)
I feel that my problem is mostly in terms of not understanding how the statistics work, rather than the programming itself. Any help? Below is the code I have so far
You're already calculating q for each pair at line 34. What is the formula for the uncertainty?
As for the histogram, figure out the minimum and maximum values of q. Then figure out the number of buckets for the histogram and which bucket a value goes into.