// Numbas version: finer_feedback_settings {"name": "Calculate 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", "name": "tol", "description": ""}, "ans2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((upper-lower)^2/12,3)", "name": "ans2", "description": ""}, "ans3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((c-lower)/(upper-lower),3)", "name": "ans3", "description": ""}, "d": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(d1=f1,d1-1,min(d1,f1))", "name": "d", "description": ""}, "c": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round((upper-lower-2)*random(0..60)/60+lower+1)", "name": "c", "description": ""}, "f": {"templateType": "anything", "group": "Ungrouped variables", "definition": "max(d1,f1)", "name": "f", "description": ""}, "ans1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "(upper+lower)/2", "name": "ans1", "description": ""}, "d1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round((upper-lower-2)*random(0..60)/60+lower+1)", "name": "d1", "description": ""}, "ans4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((f-d)/(upper-lower),3)", "name": "ans4", "description": ""}, "upper": {"templateType": "anything", "group": "Ungrouped variables", "definition": "lower+random(2..20#2)", "name": "upper", "description": ""}, "lower": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(-10..10)", "name": "lower", "description": ""}, "f1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round((upper-lower-2)*random(0..60)/60+lower)", "name": "f1", "description": ""}}, "ungrouped_variables": ["upper", "lower", "f", "d", "f1", "ans1", "ans2", "ans3", "ans4", "c", "tol", "d1"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "name": "Calculate expectation, variance and CDF of uniform distribution", "showQuestionGroupNames": false, "functions": {}, "parts": [{"scripts": {}, "gaps": [{"showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "showCorrectAnswer": true, "minValue": "ans1", "correctAnswerFraction": false, "marks": 1, "maxValue": "ans1"}, {"showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "showCorrectAnswer": true, "minValue": "ans2-tol", "correctAnswerFraction": false, "marks": 1, "maxValue": "ans2+tol"}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "
The expectation $\\operatorname{E}[Y]=\\;$[[0]] (to 3 decimal places).
\nThe variance $\\operatorname{Var}(Y)=\\;$[[1]] (to 3 decimal places).
\n", "marks": 0}, {"scripts": {}, "gaps": [{"showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "showCorrectAnswer": true, "minValue": "ans3-tol", "correctAnswerFraction": false, "marks": 1, "maxValue": "ans3+tol"}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "
$P(Y \\le \\var{c})=\\;$[[0]]
\n(to 3 decimal places).
", "marks": 0}, {"scripts": {}, "gaps": [{"answer": "(y-{lower})/({upper-lower})", "vsetrange": [0, 1], "checkingaccuracy": 0.001, "answersimplification": "basic", "expectedvariablenames": [], "notallowed": {"showStrings": false, "message": "Input all numbers as fractions or integers.
", "strings": ["."], "partialCredit": 0}, "showpreview": true, "checkingtype": "absdiff", "scripts": {}, "checkvariablenames": false, "type": "jme", "showCorrectAnswer": true, "marks": 1, "vsetrangepoints": 5}], "type": "gapfill", "showCorrectAnswer": true, "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
", "marks": 0}, {"scripts": {}, "gaps": [{"showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "showCorrectAnswer": true, "minValue": "ans4-tol", "correctAnswerFraction": false, "marks": 1, "maxValue": "ans4+tol"}], "type": "gapfill", "showCorrectAnswer": true, "prompt": "$P(\\var{d} \\lt Y \\lt \\var{f})=\\;$[[0]]
\n\nEnter your answer to 3 decimal places.
", "marks": 0}], "variablesTest": {"condition": "", "maxRuns": 100}, "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", "MAS1604", "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(Y \\le a)$ and $P( b \\lt Y \\lt c)$ for a given values $a,\\;b,\\;c$.
"}, "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.
\nb)
\n$\\displaystyle P(Y \\le \\var{c})=\\simplify[basic,!collectNumbers,!noleadingminus]{({c} -{lower})/({upper}-{lower})}=\\var{ans3}$ to 3 decimal places.
\nc) 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}$
\nd) 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/"}]}