// Numbas version: exam_results_page_options {"name": "binomial3", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "binomial3", "advice": "

The probability of winning a prize in a particular raffle is \\(\\var{p1}\\).

\n

A person buys \\(\\var{n1}\\) raffle tickets 

\n

The probability that the person will win at least \\(\\simplify{{n2}+1}\\) prizes can be expressed as \\(P(X\\ge \\simplify{{n2}+1})=1-P(X<\\simplify{{n2}+1})\\)

\n

\n

The binomial distribution gives: \\(P(X=k)=\\binom{n}{k}p^k(1-p)^{n-k}\\)

\n

\n

\\(P(X=0)=\\binom{\\var{n1}}{0}(\\var{p1})^{0}(\\var{p2})^{\\var{n1}}\\)

\n

\\(P(X=0)=(1)(1)(\\simplify{{p2}^{{n1}}})\\)

\n

\\(P(X=0)=\\var{prob0}\\)

\n

Similarly

\n

\\(P(X=1)=\\binom{\\var{n1}}{1}(\\var{p1})^{1}(\\var{p2})^{\\simplify{{n1}-1}}\\)

\n

\\(P(X=1)=\\var{prob1}\\)

\n

And

\n

\\(P(X=2)=\\binom{\\var{n1}}{2}(\\var{p1})^{2}(\\var{p2})^{\\simplify{{n1}-2}}\\)

\n

\\(P(X=2)=\\var{prob2}\\)

\n

So

\n

\\(P(X\\ge 2)=1-(\\var{prob0}+\\var{prob1})=\\simplify{1-{prob0}-{prob1}}\\)

\n

\\(P(X\\ge 3)=1-\\var{prob0}+\\var{prob1}+\\var{prob2})=\\simplify{1-{prob0}-{prob1}-{prob2}}\\)

", "variable_groups": [], "ungrouped_variables": ["p1", "n1", "n2", "prob0", "prob1", "prob2", "ans1", "p2", "z", "x"], "functions": {"": {"language": "jme", "parameters": [], "definition": "", "type": "number"}}, "extensions": ["stats"], "variablesTest": {"condition": "", "maxRuns": 100}, "type": "question", "statement": "

The probability of winning a prize in a particular raffle is \\(\\var{p1}\\).

", "preamble": {"js": "", "css": ""}, "tags": [], "parts": [{"showFeedbackIcon": true, "marks": 0, "scripts": {}, "showCorrectAnswer": true, "prompt": "

If a person buys \\(\\var{n1}\\) raffle tickets calculate the probability that the person will win at least \\(\\simplify{{n2}+1}\\) prizes. [[0]]

\n

", "gaps": [{"precisionMessage": "You have not given your answer to the correct precision.", "variableReplacements": [], "correctAnswerStyle": "plain", "scripts": {}, "strictPrecision": false, "maxValue": "ans1", "showPrecisionHint": true, "precision": "3", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "type": "numberentry", "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "marks": 1, "precisionType": "dp", "allowFractions": false, "minValue": "ans1", "precisionPartialCredit": 0, "correctAnswerFraction": false, "mustBeReducedPC": 0, "mustBeReduced": false}], "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "type": "gapfill"}], "rulesets": {}, "metadata": {"description": "", "licence": "Creative Commons Attribution-NonCommercial 4.0 International"}, "variables": {"prob2": {"templateType": "anything", "definition": "comb({n1},2)*{p1}^2*(1-{p1})^({n1}-2)", "description": "", "group": "Ungrouped variables", "name": "prob2"}, "ans1": {"templateType": "anything", "definition": "if({n2}<2,1-(prob0+prob1),1-(prob0+prob1+prob2))", "description": "", "group": "Ungrouped variables", "name": "ans1"}, "x": {"templateType": "anything", "definition": "1-{z}", "description": "", "group": "Ungrouped variables", "name": "x"}, "prob0": {"templateType": "anything", "definition": "(1-{p1})^{n1}", "description": "", "group": "Ungrouped variables", "name": "prob0"}, "prob1": {"templateType": "anything", "definition": "{n1}*{p1}*(1-{p1})^({n1}-1)", "description": "", "group": "Ungrouped variables", "name": "prob1"}, "p2": {"templateType": "anything", "definition": "1-{p1}", "description": "", "group": "Ungrouped variables", "name": "p2"}, "z": {"templateType": "anything", "definition": "normalcdf(2,0,1)", "description": "", "group": "Ungrouped variables", "name": "z"}, "n1": {"templateType": "randrange", "definition": "random(4..12#1)", "description": "", "group": "Ungrouped variables", "name": "n1"}, "p1": {"templateType": "randrange", "definition": "random(0.05..0.1#0.01)", "description": "", "group": "Ungrouped variables", "name": "p1"}, "n2": {"templateType": "randrange", "definition": "random(1..2#1)", "description": "", "group": "Ungrouped variables", "name": "n2"}}, "contributors": [{"name": "Frank Doheny", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/789/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}]}], "contributors": [{"name": "Frank Doheny", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/789/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}