// Numbas version: finer_feedback_settings {"name": "Find expectation, variance and CDF of uniform distribution", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variable_groups": [], "variables": {"tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.001", "description": "", "name": "tol"}, "ans2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((upper-lower)^2/12,3)", "description": "", "name": "ans2"}, "ans3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((c-lower)/(upper-lower),3)", "description": "", "name": "ans3"}, "d": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(d1=f1,d1-1,min(d1,f1))", "description": "", "name": "d"}, "f1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round((upper-lower-2)*random(0..60)/60+lower)", "description": "", "name": "f1"}, "f": {"templateType": "anything", "group": "Ungrouped variables", "definition": "max(d1,f1)", "description": "", "name": "f"}, "ans1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(upper+lower)/2", "description": "", "name": "ans1"}, "d1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round((upper-lower-2)*random(0..60)/60+lower+1)", "description": "", "name": "d1"}, "ans4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((f-d)/(upper-lower),3)", "description": "", "name": "ans4"}, "upper": {"templateType": "anything", "group": "Ungrouped variables", "definition": "lower+random(2..20#2)", "description": "", "name": "upper"}, "lower": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-10..10)", "description": "", "name": "lower"}, "c": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round((upper-lower-2)*random(0..60)/60+lower+1)", "description": "", "name": "c"}}, "ungrouped_variables": ["upper", "lower", "ans3", "d", "f1", "ans1", "ans2", "f", "ans4", "c", "tol", "d1"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "name": "Find expectation, variance and CDF of uniform distribution", "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "ans1", "minValue": "ans1", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "ans2+tol", "minValue": "ans2-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "
The expectation $\\operatorname{E}[Y]=\\;?$[[0]] (to 3 decimal places).
\nThe variance $\\operatorname{Var}(Y)=\\;$?[[1]] (to 3 decimal places).
\n", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"answer": "(y-{lower})/({upper-lower})", "vsetrange": [0, 1], "checkingaccuracy": 0.001, "showCorrectAnswer": true, "expectedvariablenames": [], "notallowed": {"message": "
Input all numbers as fractions or integers.
", "showStrings": false, "partialCredit": 0, "strings": ["."]}, "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "checkvariablenames": false, "type": "jme", "answersimplification": "basic", "marks": 1, "vsetrangepoints": 5}], "type": "gapfill", "prompt": "Input the CDF $F_Y(y)$ for $y$ in the range $\\var{lower} \\le y \\le \\var{upper}$
\n$F_Y(y)=\\;$?[[0]]
\nInput all numbers as fractions or integers
", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "ans4+tol", "minValue": "ans4-tol", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "$P(\\var{d} \\lt Y \\lt \\var{f})=\\;$?[[0]]
\n \nEnter your answer to 3 decimal places.
", "showCorrectAnswer": true, "marks": 0}], "statement": "Let $Y$ be a random variable with the uniform distribution
\n\\[Y \\sim \\operatorname{U}(\\var{lower},\\var{upper})\\]
", "tags": ["CDF uniform", "checked2015", "continuous distributions", "expectation", "MAS8380", "Probability", "probability", "sc", "statistical distributions", "uniform distribution", "uniformly distributed", "variance"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "25/01/2013:
\nCopy made of 1403CBA3Q5 and then edited.
\nAdded fourth part.
\nTo be tested.
", "licence": "Creative Commons Attribution 4.0 International", "description": "Exercise using a given uniform distribution $Y$, calculating the expectation and variance as well as asking for the CDF. Also finding $P( b \\lt Y \\lt c)$ for given values of $b,\\;c$.
"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "a) For a Uniform distribution \\[Y \\sim \\operatorname{U}(\\var{lower},\\var{upper})\\] we have:
\n$\\displaystyle \\operatorname{E}[Y] = \\simplify[!collectNumbers]{({lower}+{upper})/2}=\\var{ans1}$
\n$\\displaystyle \\operatorname{Var}(Y) =\\simplify[basic,!collectNumbers,!noleadingminus]{({upper}-{lower})^2/12}=\\frac{\\var{upper-lower}^2}{12}=\\var{ans2}$ to 3 decimal places.
\n\nb) The CDF for a uniform distribution $Y$ on the interval $a \\le y \\le b$ is given by:
\n\\[F_Y(y) = \\begin{cases} 0 & y \\lt a \\\\ \\frac{y-a}{b-a} & a \\le y \\le b, \\\\ 1 & y \\gt b. \\end{cases}\\]
\nHence in this case we have:
\n\\[F_Y(y) = \\simplify[basic]{(y-{lower})/({upper-lower})}\\] for $\\var{lower}\\le y \\le \\var{upper}$
\nc) Using the CDF we have:
\n\\[\\begin{eqnarray}P(\\var{d} \\lt Y \\lt \\var{f})&=&F_Y(\\var{f})-F_Y(\\var{d})\\\\&=& \\simplify[basic]{({f}-{lower})/({upper-lower})- ({d}-{lower})/({upper-lower})}\\\\&=&\\var{ans4}\\end{eqnarray}\\]
\nto 3 decimal places.
", "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}]}