// Numbas version: exam_results_page_options {"name": "testert", "metadata": {"description": "", "licence": "None specified"}, "duration": 7200, "percentPass": 0, "showQuestionGroupNames": false, "showstudentname": false, "question_groups": [{"name": "Group", "pickingStrategy": "all-shuffled", "pickQuestions": 1, "questions": [{"name": "Calculate probability of either of two events occurring based on frequency", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Peter Chapman", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/210/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}], "rulesets": {}, "variablesTest": {"maxRuns": 100, "condition": ""}, "statement": "

Out of $\\var{ptotal}$ people, $\\var{p1}$ play Go, $\\var{p2}$ play Chess, $\\var{p3}$ play both, and $\\var{p4}$ play neither.

\n

", "tags": [], "metadata": {"description": "

Example showing how to calculate the probability of A or B using the law $p(A \\;\\textrm{or}\\; B)=p(A)+p(B)-p(A\\;\\textrm{and}\\;B)$. 

\n

Easily adapted to other applications.

", "licence": "Creative Commons Attribution 4.0 International"}, "parts": [{"customMarkingAlgorithm": "", "marks": "1.5", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "useCustomName": false, "failureRate": 1, "vsetRange": [0, 1], "scripts": {}, "showFeedbackIcon": true, "vsetRangePoints": 5, "answer": "{ans1}", "showPreview": true, "customName": "", "checkVariableNames": false, "unitTests": [], "type": "jme", "prompt": "

Calculate the probability that a person selected at random plays Go. Write your answer as a fraction.

", "showCorrectAnswer": true, "checkingAccuracy": 0.001, "extendBaseMarkingAlgorithm": true, "checkingType": "absdiff", "valuegenerators": []}, {"customMarkingAlgorithm": "", "marks": "3", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "useCustomName": false, "failureRate": 1, "vsetRange": [0, 1], "scripts": {}, "showFeedbackIcon": true, "vsetRangePoints": 5, "answer": "{ans2}", "showPreview": true, "customName": "", "checkVariableNames": false, "unitTests": [], "type": "jme", "prompt": "

Calculate the probability that a randomly selected person plays Chess or Go. Give your answer as a fraction.

", "showCorrectAnswer": true, "checkingAccuracy": 0.001, "extendBaseMarkingAlgorithm": true, "checkingType": "absdiff", "valuegenerators": []}, {"customMarkingAlgorithm": "", "marks": "4.5", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "useCustomName": false, "failureRate": 1, "vsetRange": [0, 1], "scripts": {}, "showFeedbackIcon": true, "vsetRangePoints": 5, "answer": "{ans3}", "showPreview": true, "customName": "", "checkVariableNames": false, "unitTests": [], "type": "jme", "prompt": "

Calculate the probability that a randomly selected person plays Chess but not Go.

", "showCorrectAnswer": true, "checkingAccuracy": 0.001, "extendBaseMarkingAlgorithm": true, "checkingType": "absdiff", "valuegenerators": []}], "ungrouped_variables": ["p1", "p3", "p2", "p4", "ptotal", "ans1", "ans2", "ans3"], "advice": "", "functions": {}, "variables": {"p4": {"description": "", "templateType": "anything", "definition": "random(10..40)", "name": "p4", "group": "Ungrouped variables"}, "ptotal": {"description": "", "templateType": "anything", "definition": "p1+p2-p3+p4", "name": "ptotal", "group": "Ungrouped variables"}, "p1": {"description": "", "templateType": "anything", "definition": "random(40..70)", "name": "p1", "group": "Ungrouped variables"}, "p2": {"description": "", "templateType": "anything", "definition": "random(30..50)", "name": "p2", "group": "Ungrouped variables"}, "p3": {"description": "", "templateType": "anything", "definition": "random(10..25)", "name": "p3", "group": "Ungrouped variables"}, "ans2": {"description": "", "templateType": "anything", "definition": "1-(p4/ptotal)", "name": "ans2", "group": "Ungrouped variables"}, "ans3": {"description": "", "templateType": "anything", "definition": "(p2-p3)/ptotal", "name": "ans3", "group": "Ungrouped variables"}, "ans1": {"description": "", "templateType": "anything", "definition": "p1/ptotal", "name": "ans1", "group": "Ungrouped variables"}}, "variable_groups": [], "preamble": {"css": "", "js": ""}}, {"name": "Calculate probability of combinations of events happening or not, , ", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "parts": [{"scripts": {}, "gaps": [{"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "showCorrectAnswer": true, "minValue": "{intersect-tol}", "maxValue": "{intersect+tol}", "marks": 1}], "type": "gapfill", "prompt": "\n \n \n

$P(A\\cap B)=\\;\\;$[[0]]

\n \n \n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "showCorrectAnswer": true, "minValue": "{intcom-tol}", "maxValue": "{intcom+tol}", "marks": 1}], "type": "gapfill", "prompt": "\n \n \n

$P(A^c\\cap B^c)=\\;\\;$[[0]]

\n \n \n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "showCorrectAnswer": true, "minValue": "{unioncom-tol}", "maxValue": "{unioncom+tol}", "marks": 1}], "type": "gapfill", "prompt": "\n \n \n

$P(A^c\\cup B^c)=\\;\\;$[[0]]

\n \n \n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "showCorrectAnswer": true, "minValue": "{prob4-tol}", "maxValue": "{prob4+tol}", "marks": 1}], "type": "gapfill", "prompt": "\n \n \n

$P(A^c\\cap B)=\\;\\;$[[0]]

\n \n \n ", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"correctAnswerFraction": false, "showPrecisionHint": false, "allowFractions": false, "scripts": {}, "type": "numberentry", "showCorrectAnswer": true, "minValue": "{prob5-tol}", "maxValue": "{prob5+tol}", "marks": 1}], "type": "gapfill", "prompt": "\n \n \n

$P(A^c\\cup B)=\\;\\;$[[0]]

\n \n \n ", "showCorrectAnswer": true, "marks": 0}], "variables": {"prob4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(1-prob2-intersect,10)", "name": "prob4", "description": ""}, "intcom": {"templateType": "anything", "group": "Ungrouped variables", "definition": "1-prob3", "name": "intcom", "description": ""}, "intersect": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(prob1+1-prob2-prob3,2)", "name": "intersect", "description": "

P(A and B)

"}, "prob2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0.1..0.9#0.05)", "name": "prob2", "description": "

P(not B)

"}, "prob3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((t*(max(prob1,1-prob2))+(100-t)*min(0.95,prob1+1-prob2))/100,2)", "name": "prob3", "description": "

P(A or B)

"}, "tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0", "name": "tol", "description": ""}, "unioncom": {"templateType": "anything", "group": "Ungrouped variables", "definition": "1-intersect", "name": "unioncom", "description": ""}, "prob1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0.1..0.9#0.05)", "name": "prob1", "description": "

P(A)

"}, "t": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(10..100)", "name": "t", "description": ""}, "prob5": {"templateType": "anything", "group": "Ungrouped variables", "definition": "1-prob1+1-prob2-prob4", "name": "prob5", "description": ""}}, "ungrouped_variables": ["intcom", "intersect", "prob1", "prob2", "prob3", "prob4", "prob5", "t", "tol", "unioncom"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "showQuestionGroupNames": false, "variable_groups": [], "functions": {}, "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "\n

Let $A$ and $B$ be events with:

\n

1. $P(A) = \\var{prob1}$

\n

2. $P(A \\cup B)=\\var{prob3}$

\n

3. $P(B^c)=\\var{prob2}$

\n

Find the following probabilities (all answers to 2 decimal places):

\n ", "tags": ["axiom", "axioms of probability", "checked2015", "complement", "complement of an event", "cr1", "elementary probability", "intersection of events", "intersection of sets", "laws of sets", "MAS1604", "MAS8380", "MAS8401", "Probability", "probability", "probability laws", "set laws", "sets", "statistics", "tested1", "union", "union of events", "union of sets"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "

7/07/2012:

\n

Added tags.

\n

Set tolerances via new variable tol=0 for all answers.

\n

Checked calculations.

\n

22/07/2012:

\n

Added description.

\n

Switched on stats extension (not needed, but policy for all stats questions).

\n

31/07/2012:

\n

Added tags.

\n

In the Advice section, moved \\Rightarrow to beginning of the line instead of the end of the previous line.

\n

Question appears to be working correctly.

\n

20/12/2012:

\n

Added tested1 tag after checking again - calculations OK.

\n

21/12/2012:

\n

Checked rounding, OK. Added tag cr1.

", "licence": "Creative Commons Attribution 4.0 International", "description": "

Given  $P(A)$, $P(A\\cup B)$, $P(B^c)$ find $P(A \\cap B)$, $P(A^c \\cap B^c)$, $P(A^c \\cup B^c)$ etc..

"}, "advice": "

a)

\n

It follows from the axioms of probability that:

\n

\\[P(A \\cup B)=P(A)+P(B)-P(A \\cap B)\\]

\n

Hence

\n

\\begin{align}
P(A \\cap B) &= P(A)+P(B)-P(A \\cup B) \\\\
&= \\var{prob1}+1-\\var{prob2}-\\var{prob3} \\\\
&= \\var{intersect}
\\end{align}

\n

Note that we have used $P(B)=1-P(B^c)= 1-\\var{prob2}=\\var{1-prob2}$

\n

b)

\n

The laws of sets gives:

\n

\\[A^c \\cap B^c=(A \\cup B)^c\\]

\n

so

\n

\\begin{align}
P(A^c \\cap B^c) &= P((A \\cup B)^c) \\\\
&= 1-P(A \\cup B) \\\\
&= 1-\\var{prob3} \\\\
&= \\var{1-prob3}
\\end{align}

\n

c)

\n

Similarly to b), the laws of sets gives:

\n

\\[A^c \\cup B^c=(A \\cap B)^c\\]

\n

so

\n

\\begin{align}
P(A^c \\cup B^c) &= P((A \\cap B)^c) \\\\
&= 1-P(A \\cap B) \\\\
&= 1-\\var{intersect} \\\\
&= \\var{1-intersect}
\\end{align}

\n

d)

\n

Note that $B$ is the following union of disjoint sets:

\n

\\[B = (A^c \\cap B) \\cup (A \\cap B)\\]

\n

Hence

\n

\\begin{align}
P(B) &= P(A^c \\cap B) + P(A \\cap B) \\\\
\\implies P(A^c \\cap B) &= P(B)-P(A\\cap B) \\\\
&= 1-\\var{prob2}-\\var{intersect} \\\\
&= \\var{prob4}
\\end{align}

\n

e)

\n

Once again using a familiar result we have:

\n

\\begin{align}
P(A^c \\cup B) &= P(A^c)+P(B)-P(A^c \\cap B) \\\\
&= 1-\\var{prob1}+1-\\var{prob2}-\\var{prob4} \\\\
&= \\var{prob5}
\\end{align}

\n

Where we used the result from d) that $P(A^c \\cap B)=\\var{prob4}$

"}, {"name": "Algebra: Solving quadratics by completing the square", "extensions": [], "custom_part_types": [{"source": {"pk": 2, "author": {"name": "Christian Lawson-Perfect", "pk": 7}, "edit_page": "/part_type/2/edit"}, "name": "List of numbers", "short_name": "list-of-numbers", "description": "

The answer is a comma-separated list of numbers.

\n

The list is marked correct if each number occurs the same number of times as in the expected answer, and no extra numbers are present.

\n

You can optionally treat the answer as a set, so the number of occurrences doesn't matter, only whether each number is included or not.

", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "join(\n if(settings[\"correctAnswerFractions\"],\n map(let([a,b],rational_approximation(x), string(a/b)),x,settings[\"correctAnswer\"])\n ,\n settings[\"correctAnswer\"]\n ),\n settings[\"separator\"] + \" \"\n)", "hint": {"static": false, "value": "if(settings[\"show_input_hint\"],\n \"Enter a list of numbers separated by {settings['separator']}.\",\n \"\"\n)"}, "allowEmpty": {"static": true, "value": true}}, "can_be_gap": true, "can_be_step": true, "marking_script": "bits:\nlet(b,filter(x<>\"\",x,split(studentAnswer,settings[\"separator\"])),\n if(isSet,list(set(b)),b)\n)\n\nexpected_numbers:\nlet(l,settings[\"correctAnswer\"] as \"list\",\n if(isSet,list(set(l)),l)\n)\n\nvalid_numbers:\nif(all(map(not isnan(x),x,interpreted_answer)),\n true,\n let(index,filter(isnan(interpreted_answer[x]),x,0..len(interpreted_answer)-1)[0], wrong, bits[index],\n warn(wrong+\" is not a valid number\");\n fail(wrong+\" is not a valid number.\")\n )\n )\n\nis_sorted:\nassert(sort(interpreted_answer)=interpreted_answer,\n multiply_credit(0.5,\"Not in order\")\n )\n\nincluded:\nmap(\n let(\n num_student,len(filter(x=y,y,interpreted_answer)),\n num_expected,len(filter(x=y,y,expected_numbers)),\n switch(\n num_student=num_expected,\n true,\n num_studentThe separate items in the student's answer

", "definition": "let(b,filter(x<>\"\",x,split(studentAnswer,settings[\"separator\"])),\n if(isSet,list(set(b)),b)\n)"}, {"name": "expected_numbers", "description": "", "definition": "let(l,settings[\"correctAnswer\"] as \"list\",\n if(isSet,list(set(l)),l)\n)"}, {"name": "valid_numbers", "description": "

Is every number in the student's list valid?

", "definition": "if(all(map(not isnan(x),x,interpreted_answer)),\n true,\n let(index,filter(isnan(interpreted_answer[x]),x,0..len(interpreted_answer)-1)[0], wrong, bits[index],\n warn(wrong+\" is not a valid number\");\n fail(wrong+\" is not a valid number.\")\n )\n )"}, {"name": "is_sorted", "description": "

Are the student's answers in ascending order?

", "definition": "assert(sort(interpreted_answer)=interpreted_answer,\n multiply_credit(0.5,\"Not in order\")\n )"}, {"name": "included", "description": "

Is each number in the expected answer present in the student's list the correct number of times?

", "definition": "map(\n let(\n num_student,len(filter(x=y,y,interpreted_answer)),\n num_expected,len(filter(x=y,y,expected_numbers)),\n switch(\n num_student=num_expected,\n true,\n num_studentHas every number been included the right number of times?

", "definition": "all(included)"}, {"name": "no_extras", "description": "

True if the student's list doesn't contain any numbers that aren't in the expected answer.

", "definition": "if(all(map(x in expected_numbers, x, interpreted_answer)),\n true\n ,\n incorrect(\"Your answer contains \"+extra_numbers[0]+\" but should not.\");\n false\n )"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "if(lower(studentAnswer) in [\"empty\",\"\u2205\"],[],\n map(\n if(settings[\"allowFractions\"],parsenumber_or_fraction(x,notationStyles), parsenumber(x,notationStyles))\n ,x\n ,bits\n )\n)"}, {"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "if(studentanswer=\"\",fail(\"You have not entered an answer\"),false);\napply(valid_numbers);\napply(included);\napply(no_extras);\ncorrectif(all_included and no_extras)"}, {"name": "notationStyles", "description": "", "definition": "[\"en\"]"}, {"name": "isSet", "description": "

Should the answer be considered as a set, so the number of times an element occurs doesn't matter?

", "definition": "settings[\"isSet\"]"}, {"name": "extra_numbers", "description": "

Numbers included in the student's answer that are not in the expected list.

", "definition": "filter(not (x in expected_numbers),x,interpreted_answer)"}], "settings": [{"name": "correctAnswer", "label": "Correct answer", "help_url": "", "hint": "The list of numbers that the student should enter. The order does not matter.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "allowFractions", "label": "Allow the student to enter fractions?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": false}, {"name": "correctAnswerFractions", "label": "Display the correct answers as fractions?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": false}, {"name": "isSet", "label": "Is the answer a set?", "help_url": "", "hint": "If ticked, the number of times an element occurs doesn't matter, only whether it's included at all.", "input_type": "checkbox", "default_value": false}, {"name": "show_input_hint", "label": "Show the input hint?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": true}, {"name": "separator", "label": "Separator", "help_url": "", "hint": "The substring that should separate items in the student's list", "input_type": "string", "default_value": ",", "subvars": false}], "public_availability": "always", "published": true, "extensions": []}], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Lovkush Agarwal", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1358/"}], "tags": [], "metadata": {"description": "

A few quadratic equations are given, to be solved by completing the square. The number of solutions is randomised.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

Solve these equations by completing the square. If there is more than one solution, enter all the solutions separated by a comma.

\n

------------------------------------

", "advice": "

See 5.1 and 5.2 for examples and background on solving by completing the square

\n

See 3.3 for examples of completing the square

", "rulesets": {"std": ["all", "!collectNumbers", "fractionNumbers", "!noLeadingMinus"]}, "variables": {"a": {"name": "a", "group": "Ungrouped variables", "definition": "vector([random(1..5)]+[random(-1..-5)]+[random(-1..-5)]+[random(-1..-5)]+[random(1..5)])", "description": "", "templateType": "anything"}, "xmax": {"name": "xmax", "group": "Ungrouped variables", "definition": "vector([-a[0]]+[-a[0]]+[-a[0]]+[-a[0]]+[-a[1]]+[-a[1]]+[-a[1]]+[-a[1]])+shift", "description": "", "templateType": "anything"}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "vector([random(-10..25)] + [random(-10..25)] + [random(-10..25)] + [random(-10..25)] + [random(-10..25)] )", "description": "", "templateType": "anything"}, "xmin": {"name": "xmin", "group": "Ungrouped variables", "definition": "vector([-a[0]]+[-a[0]]+[-a[0]]+[-a[0]]+[-a[1]]+[-a[1]]+[-a[1]]+[-a[1]])-shift", "description": "", "templateType": "anything"}, "fx": {"name": "fx", "group": "Ungrouped variables", "definition": "vector([(xmax[0]+a[0])^2+b[0]]+[(xmax[1]+a[0])^2+b[0]]+[(xmax[2]+a[0])^2+b[0]]+[(xmax[3]+a[0])^2+b[0]]+[(xmax[4]+a[1])^2+b[1]]+[(xmax[5]+a[1])^2+b[1]]+[(xmax[6]+a[1])^2+b[1]]+[(xmax[7]+a[1])^2+b[1]])", "description": "", "templateType": "anything"}, "shift": {"name": "shift", "group": "Ungrouped variables", "definition": "vector(shuffle(1..9#4)+[0]+shuffle(1..9#4)+[0])", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["a", "b", "shift", "xmin", "xmax", "fx"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "

Complete the square on $\\simplify{x^2+{2*a[0]}x+ {a[0]^2+b[0]}}$ [[0]]

\n

Hence solve $\\simplify{x^2+{2*a[0]}x+ {a[0]^2+b[0]}} = \\var{fx[0]}$ [[1]]

\n

Also solve $\\simplify{x^2+{2*a[0]}x+ {a[0]^2+b[0]}} = \\var{fx[3]}$ [[2]]

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": "1", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "(x+{a[0]})^2+{b[0]}", "answerSimplification": "std", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "musthave": {"strings": ["(", ")", "^"], "showStrings": false, "partialCredit": 0, "message": "

please input in the form $(x+a)^2+b$

"}, "notallowed": {"strings": ["x^2", "x*x", "x x", "x(", "x*("], "showStrings": false, "partialCredit": 0, "message": "

Input your answer in the form $(x+a)^2+b$.

"}, "valuegenerators": [{"name": "x", "value": ""}]}, {"type": "list-of-numbers", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "settings": {"correctAnswer": "[xmin[0],xmax[0]]", "allowFractions": true, "correctAnswerFractions": true}}, {"type": "list-of-numbers", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "settings": {"correctAnswer": "[xmin[3]]", "allowFractions": true, "correctAnswerFractions": true}}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "prompt": "

Complete the square on $\\simplify{x^2+{2*a[1]}x+ {a[1]^2+b[1]}}$ [[0]]

\n

Hence solve $\\simplify{x^2+{2*a[1]}x+ {a[1]^2+b[1]}} = \\var{fx[4]}$ [[1]]

\n

Also solve $\\simplify{x^2+{2*a[1]}x+ {a[1]^2+b[1]}} = \\var{fx[5]}$ [[2]]

", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": "1", "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "answer": "(x+{a[1]})^2+{b[1]}", "answerSimplification": "std", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "musthave": {"strings": ["(", ")", "^"], "showStrings": false, "partialCredit": 0, "message": "

please input in the form $(x+a)^2+b$

"}, "notallowed": {"strings": ["x^2", "x*x", "x x", "x(", "x*("], "showStrings": false, "partialCredit": 0, "message": "

Input your answer in the form $(x+a)^2+b$.

"}, "valuegenerators": [{"name": "x", "value": ""}]}, {"type": "list-of-numbers", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "settings": {"correctAnswer": "[xmin[4],xmax[4]]", "allowFractions": false, "correctAnswerFractions": false}}, {"type": "list-of-numbers", "useCustomName": false, "customName": "", "marks": 1, "showCorrectAnswer": true, "showFeedbackIcon": true, "scripts": {}, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "settings": {"correctAnswer": "[xmin[5],xmax[5]]", "allowFractions": false, "correctAnswerFractions": false}}], "sortAnswers": false}]}, {"name": "Percentages and ratios - box of chocolates", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Lauren Richards", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1589/"}, {"name": "Adelle Colbourn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2083/"}], "tags": [], "metadata": {"description": "

A simple situational question about a box of chocolates, asking how many of each type there are, what percentage of the box they represent, the probability of picking one and ratios of different types.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "
\n
\n
\n

A family receive a box of chocolates as a gift. There are five different kinds of chocolate inside: plain, nut, caramel, dark and coconut.

\n

The box contains equal numbers of each kind of chocolate..

", "advice": "
\n

a)

\n

100% represents the whole box of chocolates. As there are 5 different kinds of chocolate in the box and they are all represented equally, to calculate the percentage chocolates which are caramel, divide 100 by 5.

\n

Caramel chocolate = $\\displaystyle\\frac{100}{5}$ = $20$% of the box.

\n

\n

\n

b) 

\n

The original number of chocolates in the box is stated. We worked out above that each type of chocolate makes up 20% of the box, so we need to work out 20% of {chocs}.

\n

To do this, either divide {chocs} by 100 and multiply by 20, OR multiply {chocs} by 0.2. The two methods will give the same result.

\n

Method 1: $\\displaystyle\\frac{\\var{chocs}}{100}$ x $20$ = $\\var{type}$;

\n

OR

\n

Method 2: $\\var{chocs}$ x $0.2$ = $\\var{type}$.

\n

\n

\n

c)

\n

There are now {type} fewer chocolates in the box, but the remaining chocolates now represent 100% of the box. There are now only 4 types of chocolate in it and there is still equal representation inside the box.

\n

Use the method from part a) to find out the equal share of each chocolate type.

\n

Each type = $\\displaystyle\\frac{100}{4}$ = $25$% of the box.

\n

\n

\n

d) 

\n

i)

\n

The first section asks you to compare plain chocolate and dark chocolate. It states that there are {p} plain chocolates and {d} dark chocolates left in the box.

\n

Insert the numbers of each into the gaps.

\n

Plain $\\var{p}$ : $\\var{d}$ Dark

\n

From this, we should look to see if this answer can be simplified down. To do this, we need to find the greatest common divisor of $\\var{p}$ and $\\var{d}$. 

\n

The greatest common divisor is $\\var{gcd}$.

\n

Using this value to simplify down the ratio by dividing each term by the value, the final answer is

\n

Plain $\\var{ratio_plain}$ : $\\var{ratio_dark}$ Dark.

\n

This states that for every {ratio_plain} plain {if(ratio_plain=1,\"chocolate\",\"chocolates\")}, there {if(ratio_dark=1,\"is\",\"are\")} {ratio_dark} dark {if(ratio_dark=1,\"chocolate\",\"chocolates\")}.

\n

Therefore, it is not possible to simplify further and the final answer is

\n

Plain $\\var{p}$ : $\\var{d}$ Dark.

\n

This states that for every {p} plain {if(p=1,\"chocolate\",\"chocolates\")}, there {if(d=1,\"is\",\"are\")}{d} dark {if(d=1,\"chocolate\",\"chocolates\")}.

\n

\n

ii)

\n

The second section asks you to compare coconut chocolates and the rest of the box. It states that there are {c} coconut chocolates. To calculate the number of chocolates in the rest of the box, add together the stated amounts of plain, dark and nutty chocolates:

\n

$\\var{p}+\\var{d}+\\var{n}$ = $\\var{rob}$.

\n

Insert these two figures into the gaps.

\n

Coconut $\\var{c}$ : $\\var{rob}$ Other chocolates

\n

From this, we should look to see if this answer can be simplified down. To do this, we need to find the greatest common divisor of $\\var{c}$ and $\\var{rob}$. 

\n

The greatest common divisor is $\\var{gcd2}$.

\n

Using this value to simplify down the ratio by dividing each term by the value, the final answer is

\n

Coconut $\\var{ratio_coconut}$ : $\\var{ratio_rest}$ Other chocolates.

\n

This states that for every {ratio_coconut} coconut {if(ratio_coconut=1,\"chocolate\",\"chocolates\")}, there {if(ratio_rest=1,\"is\",\"are\")} {ratio_rest} other {if(ratio_rest=1,\"chocolate\",\"chocolates\")} in the box.

\n

Therefore, it is not possible to simplify further and the final answer is 

\n

Coconut $\\var{c}$ : $\\var{rob}$ Other chocolates.

\n

This states that for every {c} coconut {if(c=1,\"chocolate\",\"chocolates\")}, there {if(rob=1,\"is\",\"are\")} {rob} other {if(rob=1,\"chocolate\",\"chocolates\")} in the box.

", "rulesets": {}, "variables": {"ratio_dark": {"name": "ratio_dark", "group": "Ungrouped variables", "definition": "d/gcd(p,d)", "description": "
\n

Number of dark chocolates in ratio of plain to dark.

", "templateType": "anything"}, "prob": {"name": "prob", "group": "Ungrouped variables", "definition": "precround({n/{a},2)", "description": "
\n

Probability that a nutty chocolate is selected from the box on day 3.

", "templateType": "anything"}, "type": {"name": "type", "group": "Ungrouped variables", "definition": "chocs/5", "description": "
\n

Number of each type of chocolate in the box initially.

", "templateType": "anything"}, "minusc": {"name": "minusc", "group": "Ungrouped variables", "definition": "{chocs-type}", "description": "
\n

Number of chocolates in the box minus caramel.

", "templateType": "anything"}, "chocs": {"name": "chocs", "group": "Ungrouped variables", "definition": "random(70 .. 95#5)", "description": "
\n
\n

Total number of chocolates in the box before eating.

", "templateType": "randrange"}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "p+n+d+c", "description": "
\n
\n

Number of chocolates in the box on day 3.

", "templateType": "anything"}, "gcd2": {"name": "gcd2", "group": "Ungrouped variables", "definition": "gcd(c,rob)", "description": "
\n

", "templateType": "anything"}, "perc": {"name": "perc", "group": "Ungrouped variables", "definition": "100*(prob)", "description": "
\n

Percentage version of probability.

", "templateType": "anything"}, "n": {"name": "n", "group": "Ungrouped variables", "definition": "random(1..14 except 7 except 11 except 13)", "description": "
\n
\n

Number of nutty chocolates on day 3.

", "templateType": "anything"}, "d": {"name": "d", "group": "Ungrouped variables", "definition": "random(1..3)*p", "description": "
\n
\n

Number of dark chocolates on day 3.

", "templateType": "anything"}, "p": {"name": "p", "group": "Ungrouped variables", "definition": "random(2..5)", "description": "
\n
\n

Number of plain chocolates on day 3.

", "templateType": "anything"}, "ratio_coconut": {"name": "ratio_coconut", "group": "Ungrouped variables", "definition": "c/gcd(c, rob)", "description": "
\n

Number of coconut chocolates in ratio of coconut to rest of box.

", "templateType": "anything"}, "ratio_plain": {"name": "ratio_plain", "group": "Ungrouped variables", "definition": "p/gcd(p,d)", "description": "
\n

Number of plain chocolates in ratio of plain to dark.

", "templateType": "anything"}, "rob": {"name": "rob", "group": "Ungrouped variables", "definition": "p+n+d", "description": "
\n
\n
\n

Sum of the rest of the box excluding coconut.

", "templateType": "anything"}, "c": {"name": "c", "group": "Ungrouped variables", "definition": "random(1..14 except 7 except 11 except 13)", "description": "
\n
\n
\n

Number of coconut chocolates on day 3.

", "templateType": "anything"}, "ratio_rest": {"name": "ratio_rest", "group": "Ungrouped variables", "definition": "rob/gcd(c, rob)", "description": "
\n

Number of 'rest of box' chocolates in ratio of coconut to rest of box.

", "templateType": "anything"}, "gcd": {"name": "gcd", "group": "Ungrouped variables", "definition": "gcd(p,d)", "description": "
\n

", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["chocs", "type", "p", "n", "d", "c", "rob", "prob", "a", "perc", "minusc", "ratio_plain", "ratio_dark", "ratio_coconut", "ratio_rest", "gcd", "gcd2"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "
\n
\n

What percentage of the box of chocolates is represented by the caramel chocolates?

\n

Caramel chocolate = [[0]] % of the box.

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "20", "maxValue": "20", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "
\n
\n
\n

If there were $\\var{chocs}$ chocolates in the box originally, how many of each kind were there?

\n

There are [[0]] of each type of chocolate in the box.

\n

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "type", "maxValue": "type", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "
\n
\n

Caramel flavoured chocolate is the family favourite, and so all of these chocolates are eaten first, and none of the other kinds are touched.

\n

What percentage of the remaining chocolates are plain?

\n

Plain chocolates = [[0]]% of the box.

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "25", "maxValue": "25", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "
\n
\n

Over the next few days, the remaining chocolates in the box are slowly devoured so that by day three, all that remain are:

\n

$\\var{p}$ plain chocolates, $\\var{n}$ nutty chocolates, $\\var{c}$ coconut chocolates and $\\var{d}$ dark chocolates.

\n

\n

i) What is the ratio of plain to dark chocolates? Give your answer in its simplest form.

\n

Plain [[0]] : [[1]] Dark

\n

\n

ii) What is the ratio of coconut chocolates to the rest of the box? Give your answer in its simplest form.

\n

Coconut [[2]] : [[3]] Rest of the box

\n

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "ratio_plain", "maxValue": "ratio_plain", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "ratio_dark", "maxValue": "ratio_dark", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "ratio_coconut", "maxValue": "ratio_coconut", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "ratio_rest", "maxValue": "ratio_rest", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Calculate probabilities from frequency table", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"a0": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(1000..4000#1000)", "name": "a0", "description": ""}, "q": {"group": "Ungrouped variables", "templateType": "anything", "definition": "2", "name": "q", "description": ""}, "ans2": {"group": "Ungrouped variables", "templateType": "anything", "definition": "precround((thismany-sum(n[0..v+1]))/thismany,2)", "name": "ans2", "description": ""}, "ans3": {"group": "Ungrouped variables", "templateType": "anything", "definition": "precround((n[1]+n[2])/thismany,2)", "name": "ans3", "description": ""}, "a": {"group": "Ungrouped variables", "templateType": "anything", "definition": "[a0,a0+b0,a0+2*b0]", "name": "a", "description": ""}, "n1": {"group": "Ungrouped variables", "templateType": "anything", "definition": "round(thismany/random(3,6))", "name": "n1", "description": ""}, "sc": {"group": "Ungrouped variables", "templateType": "anything", "definition": "['A bank made '+{thismany}+' car loans last year. The amounts were as follows (\u00a3):']", "name": "sc", "description": ""}, "b0": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(1000..3000#1000)", "name": "b0", "description": ""}, "n0": {"group": "Ungrouped variables", "templateType": "anything", "definition": "round(thismany/random(15,25))", "name": "n0", "description": ""}, "t": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(0..abs(a)-1)", "name": "t", "description": ""}, "ans1": {"group": "Ungrouped variables", "templateType": "anything", "definition": "precround(sum(n[0..t+1])/thismany,2)", "name": "ans1", "description": ""}, "n3": {"group": "Ungrouped variables", "templateType": "anything", "definition": "round(thismany/random(11,14))", "name": "n3", "description": ""}, "k": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(0..abs(sc)-1)", "name": "k", "description": ""}, "u1": {"group": "Ungrouped variables", "templateType": "anything", "definition": "a[t]", "name": "u1", "description": ""}, "data": {"group": "Ungrouped variables", "templateType": "anything", "definition": "\n [[0,a[0]-1,n[0]],\n [a[0],a[1]-1,n[1]],\n [a[1],a[2]-1,n[2]],\n [a[2],'plus',n[3]]]\n \n ", "name": "data", "description": ""}, "v": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(0..abs(a)-1 except t)", "name": "v", "description": ""}, "o1": {"group": "Ungrouped variables", "templateType": "anything", "definition": "a[v]", "name": "o1", "description": ""}, "thismany": {"group": "Ungrouped variables", "templateType": "anything", "definition": "random(300..1000#100)", "name": "thismany", "description": ""}, "p": {"group": "Ungrouped variables", "templateType": "anything", "definition": "0", "name": "p", "description": ""}, "n": {"group": "Ungrouped variables", "templateType": "anything", "definition": "[n0,n1,thismany-n0-n1-n3,n3]", "name": "n", "description": ""}}, "ungrouped_variables": ["a", "sc", "p", "ans1", "k", "ans3", "u1", "thismany", "n", "q", "a0", "b0", "t", "v", "n0", "n1", "n3", "data", "ans2", "o1"], "rulesets": {}, "showQuestionGroupNames": false, "functions": {"accumdisp": {"type": "string", "language": "jme", "definition": "if(k=0,'$\\\\var{a[0]}$','$\\\\var{a[0]}$ + '+accumdisp(a[1..abs(a)],k-1))", "parameters": [["a", "list"], ["k", "number"]]}}, "parts": [{"showCorrectAnswer": true, "scripts": {}, "gaps": [{"showCorrectAnswer": false, "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "correctAnswerFraction": false, "minValue": "ans1", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1, "maxValue": "ans1"}, {"showCorrectAnswer": true, "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "correctAnswerFraction": false, "minValue": "ans2", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1, "maxValue": "ans2"}, {"showCorrectAnswer": true, "showPrecisionHint": false, "scripts": {}, "allowFractions": false, "type": "numberentry", "correctAnswerFraction": false, "minValue": "ans3", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 1, "maxValue": "ans3"}], "type": "gapfill", "prompt": "

One of these loans is sampled randomly for review by the bank. What is the probability that it is :

\n

a) Under £$\\var{u1}$?   Probability = ? [[0]]  (answer to 2 decimal places).

\n

b) Over £$\\var{o1-1}$?     Probability = ? [[1]]  (answer to 2 decimal places).

\n

c) Between £$\\var{a[p]}$ and £$\\var{a[q]-1}$?    Probability = ? [[2]] (answer to 2 decimal places).

\n

 

\n

 

", "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0}], "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "\n

{sc[k]}

\n

{table(data,['  From','  To', '  Loans Made'])}

\n

 

\n ", "tags": ["checked2015", "MAS1403"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "

28/12/2012:

\n

Using the inbuilt table function for now. This needs to be changed - either to direct input of an html table or improving the table function e.g. adding borders etc.

\n

The udf accumdisp(a,t) outputs a string of the form a[0]+a[1]+..a[t-1]  - useful to show in the solution the elements of the list we are summing over.

\n

There is a scenario variable sk, which is intended to be the beginning of a list of possible randomised scenarios. Probably best if this included other text based string variables (e.g. car loans could be the value of such a variable).

\n

Easy to make this have a variable number of ranges of loans. Only need to pay some attention to the creation of the list n giving the number of loans in each range - need to make that sensible.

", "licence": "Creative Commons Attribution 4.0 International", "description": "

Simple probability question. Counting number of occurences of an event in a sample space with given size and finding the probability of the event.

"}, "advice": "\n

a) The number of loans less than £$\\var{u1}$ is $\\var{accumdisp(n,t)}=\\var{sum(n[0..t+1])}$

\n

Since there are $\\var{thismany}$ loans the probability of choosing one of these loans is  $\\displaystyle \\frac{\\var{sum(n[0..t+1])}}{\\var{thismany}}=\\var{ans1}$ to 2 decimal places.

\n

b) The number of loans greater than £$\\var{o1}$ is $\\var{accumdisp(n[v+1..abs(n)],abs(n)-v-2)}=\\var{sum(n[v+1..abs(n)])}$.

\n

Since there are $\\var{thismany}$ loans the probability of choosing one of these loans is  $\\displaystyle \\frac{\\var{sum(n[v+1..abs(n)])}}{\\var{thismany}}=\\var{ans2}$ to 2 decimal places.

\n

c) There are $\\var{accumdisp(n[p+1..q+1],q-p-1)}=\\var{sum(n[p+1..q+1])}$ loans between  £$\\var{a[p]}$ and £$\\var{a[q]-1}$.

\n

Hence the probability of selecting one of these loans in this range for review is $\\displaystyle \\frac{\\var{sum(n[p+1..q+1])}}{\\var{thismany}}=\\var{ans3}$ to 2 decimal places.

\n "}, {"name": "Decide whether pairs of events are independent, ", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"mm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[[m1,-m1],[m2,-m2],[m3,-m3]]", "description": "", "name": "mm"}, "v": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..abs(a)-1 except [t,u])", "description": "", "name": "v"}, "thismany": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2..4)", "description": "", "name": "thismany"}, "u": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..abs(a)-1 except t)", "description": "", "name": "u"}, "m3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(v < k,1,-1)", "description": "", "name": "m3"}, "abbe": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\"above\",\"below\")", "description": "", "name": "abbe"}, "sc3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a[v]", "description": "", "name": "sc3"}, "pc": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(3..20)", "description": "", "name": "pc"}, "pe": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0.2..0.7#0.1)", "description": "", "name": "pe"}, "pm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(pe*pf,2)", "description": "", "name": "pm"}, "indep": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\n [\"$E\\\\; \\\\textrm{and}\\\\; F$, where $P(E \\\\;\\\\textrm{and}\\\\; F) = P(E) \\\\times P(F)$.\",\n \"$E\\\\; \\\\textrm{and}\\\\; F$, where $P(E)= \\\\var{pe}$, $P(F)= \\\\var{pf}$ and $P(E\\\\; \\\\textrm{and}\\\\; F)=\\\\var{pm}$\",\n \"H: A new laundry detergent will capture $\\\\var{pc} of the market next year, K: Rover will produce a new model next year.\",\n \"H: Spinning a six and K: spinning a five on the same spinner.\",\n \"A: I look out of the window and it is sunny, B: I win the National Lottery jackpot this weekend!\",\n \"A: I look out of the window and it is cloudy, B: Newcastle \"+{something}+\" this weekend.\",\n \"$E\\\\; \\\\textrm{and}\\\\; F$, where $P(E)= P(F)$ and $P(E\\\\; \\\\textrm{and}\\\\; F)= P(E) \\\\times P(F)$\",\n \"A student is selected at random from this class. The events A and B are such that A: the student has \"+ abbe+ \" average shoe size and B: the student was born in \"+ {mo},\n \"E: An individual eats out more than \"+thismany+\" times a week. F: An individual has \"+col+\" hair.\",\n \"$H$ and $K$, where $P(K) = P(K|H)$.\"]\n ", "description": "", "name": "indep"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "indep+notindep", "description": "", "name": "a"}, "pef": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0.3..0.8)", "description": "", "name": "pef"}, "tm": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(9,10,11)", "description": "", "name": "tm"}, "something": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\"win easily\",\"scrape a draw\", \"get beat due to a disputed penalty\")", "description": "", "name": "something"}, "npef": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(pef^2+random(0.1..0.2#0.01),2)", "description": "", "name": "npef"}, "m2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(u < k,1,-1)", "description": "", "name": "m2"}, "k": {"templateType": "anything", "group": "Ungrouped variables", "definition": "length(indep)", "description": "", "name": "k"}, "sc1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a[t]", "description": "", "name": "sc1"}, "m1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "if(t < k,1,-1)", "description": "", "name": "m1"}, "col": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\"black\",\"brown\",\"blonde\")", "description": "", "name": "col"}, "notindep": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\n [\"A: The sky is cloudy today. B: It will rain today.\",\n \"A: A level marks in Mathematics, B: A level marks in Physics from students in the same school.\",\n \"$E\\\\; \\\\textrm{and}\\\\; F$, where $P(E)= P(F)=\\\\var{pef}$ and $P(E\\\\; \\\\textrm{and}\\\\; F)= \\\\var{npef}$\",\n \"H: Tom lies in on \"+ td + \", K: Tom is late for his \"+ tm+\" o'clock lecture on \"+ td,\n \"A student is selected at random from this class. The events H and K are such that H: the student is \"+ abbe+ \" average in height and K: the student is \"+abbe +\" average in weight.\",\n \"$E\\\\; \\\\textrm{and}\\\\; F$, where $P(E\\\\; \\\\textrm{and}\\\\; F)\\\\neq P(E)\\\\times P(F)$\",\n \"H: There is a severe thunderstorm in my home town this afternoon. K: My computer crashes this afternoon.\",\n \"A: A patient takes an abnormally long time to recover from an operation. B: The patient is elderly.\"]\n ", "description": "", "name": "notindep"}, "td": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\"Monday\",\"Tuesday\", \"Wednesday\",\"Thursday\",\"Friday\")", "description": "", "name": "td"}, "sc2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a[u]", "description": "", "name": "sc2"}, "t": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..abs(a)-1)", "description": "", "name": "t"}, "pf": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0.2..0.7#0.1)", "description": "", "name": "pf"}, "mo": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(\"January\",\"February\", \"March\", \"April\",\"June\", \"October\",\"November\",\"December\")", "description": "", "name": "mo"}}, "ungrouped_variables": ["something", "indep", "pc", "tm", "pf", "m3", "m2", "m1", "td", "pm", "abbe", "npef", "pe", "thismany", "sc1", "pef", "sc3", "sc2", "a", "mm", "mo", "notindep", "col", "u", "t", "v", "k"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"layout": {"expression": ""}, "choices": ["First Pair: {sc1}", "Second Pair: {sc2}", "Third Pair: {sc3}"], "matrix": "mm", "type": "m_n_x", "maxAnswers": 0, "shuffleChoices": false, "answers": ["Independent", "Not independent"], "scripts": {}, "minMarks": 0, "minAnswers": 0, "maxMarks": 0, "shuffleAnswers": false, "showCorrectAnswer": true, "marks": 0}], "type": "gapfill", "prompt": "

[[0]]

", "showCorrectAnswer": true, "marks": 0}], "statement": "\n

Choose whether or not the following three pairs of events are independent or not.

\n

For every wrong choice you will lose a mark.  The minimum mark you can get is 0.

\n ", "tags": ["checked2015", "MAS1403", "MAS1604"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "\n \t\t

29/12/2012:

\n \t\t

Added sc tag as can add more pairs of events. Note that if you add more then the number of independent events in the new list has to be updated in variables m1,m2,m3.**

\n \t\t

The presentation of the pairs in the MCQ is not optimal! Not sure about the rather random labelling (A and B, H and K etc).

\n \t\t

No solution given. Perhaps a general statement on independence in Advice or in Show steps.  

\n \t\t

** Split up into two arrays, independent and not independent pairs.  If you add events to these arrays then everything is automatically updated.

\n \t\t

Question tested, OK.

\n \t\t", "licence": "Creative Commons Attribution 4.0 International", "description": "

Independent events in probability. Choose whether given three given pairs of events are independent or not.

"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "

No solution provided.

"}, {"name": "Calculate probability of either of two events occurring", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variablesTest": {"condition": "", "maxRuns": 100}, "variables": {"dothisandthat": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"work on both domestic and European routes\"", "description": "", "name": "dothisandthat"}, "ans2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(1-prob1,2)", "description": "", "name": "ans2"}, "desc2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"are in training\"", "description": "", "name": "desc2"}, "things": {"templateType": "anything", "group": "Ungrouped variables", "definition": "'stewardesses'", "description": "", "name": "things"}, "dothat1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"works on European routes\"", "description": "", "name": "dothat1"}, "p3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "p-random(85..95)", "description": "", "name": "p3"}, "prob1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((p-p3)/100,2)", "description": "", "name": "prob1"}, "therest": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"The remainder\"", "description": "", "name": "therest"}, "desc1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"with a small UK-based airline\"", "description": "", "name": "desc1"}, "p2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "p-p1", "description": "", "name": "p2"}, "thing": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"stewardess\"", "description": "", "name": "thing"}, "dothis1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"works on domestic routes\"", "description": "", "name": "dothis1"}, "desc4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"is in training\"", "description": "", "name": "desc4"}, "dothat": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"work on European routes\"", "description": "", "name": "dothat"}, "dothis": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"work on domestic routes\"", "description": "", "name": "dothis"}, "p1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(40..70)", "description": "", "name": "p1"}, "p": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(105..125)", "description": "", "name": "p"}, "desc3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\"working with this airline\"", "description": "", "name": "desc3"}}, "ungrouped_variables": ["dothisandthat", "desc4", "p1", "desc1", "dothat", "desc3", "things", "ans2", "p3", "p", "p2", "dothat1", "dothis", "therest", "desc2", "thing", "dothis1", "prob1"], "functions": {}, "variable_groups": [], "preamble": {"css": "", "js": ""}, "parts": [{"customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "prompt": "\n

Find the probabilities that a randomly chosen {thing} {desc3}: 

\n

a) {dothis1} or {dothat1}.

\n

Probability = [[0]]

\n

b) {desc4}.

\n

Probability = [[1]]

\n

Enter both probabilities to 2 decimal places.

\n ", "unitTests": [], "showFeedbackIcon": true, "scripts": {}, "gaps": [{"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "prob1", "maxValue": "prob1", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "mustBeReducedPC": 0}, {"correctAnswerFraction": false, "allowFractions": false, "customMarkingAlgorithm": "", "mustBeReduced": false, "extendBaseMarkingAlgorithm": true, "minValue": "ans2", "maxValue": "ans2", "unitTests": [], "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "scripts": {}, "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "variableReplacements": [], "marks": 1, "mustBeReducedPC": 0}], "type": "gapfill", "extendBaseMarkingAlgorithm": true, "showCorrectAnswer": true, "variableReplacements": [], "marks": 0, "sortAnswers": false}], "statement": "\n

$\\var{p1}$% of {things} {desc1} {dothis}, $\\var{p2}$% {dothat} and $\\var{p3}$% {dothisandthat}. 

\n

{therest} {desc2}

\n ", "tags": ["checked2015"], "rulesets": {}, "type": "question", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Example showing how to calculate the probability of A or B using the law $p(A \\;\\textrm{or}\\; B)=p(A)+p(B)-p(A\\;\\textrm{and}\\;B)$. 

\n

Also converting percentages to probabilities.

\n

Easily adapted to other applications.

"}, "advice": "

a) There are $\\var{p1}+\\var{p2}-\\var{p3}=\\var{p-p3}$ % of stewardesses working on one of the routes. The probability that a random stewardess is working on one of these routes is therefore $\\displaystyle \\frac{\\var{p-p3}}{100}=\\var{prob1}$.

\n

b) The rest are in training and the probability that a randomly selected stewardess is in training is $1-\\var{prob1}=\\var{1-prob1}$.

"}, {"name": "Roll a pair of dice - find probability at least one die shows a given number.", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "tags": ["checked2015", "dice", "Dice", "die", "elementary probability", "events", "independence", "Independence", "independent events", "Probability", "probability", "probability dice", "statistics", "tested1"], "metadata": {"description": "

Rolling a pair of dice. Find probability that at least one die shows a given number.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

Two fair six-sided dice are rolled.

", "advice": "\n \n \n

Let $A$ be the event that first dice shows a $\\var{number}$ $\\Rightarrow P(A)=\\frac{1}{6}$.

\n \n \n \n

Let $B$ be the event that second dice shows a $\\var{number}$ $\\Rightarrow P(B)=\\frac{1}{6}$.

\n \n \n \n

$A$ and $B$ are independent events so $P(A\\cap B) = P(A)\\times P(B)$.

\n \n \n \n

We want the probability $P(A \\cup B)$ of either $A$ or $B$ showing $\\var{number}$ and

\n \n \n \n

\\[\\begin{eqnarray*}\n \n P(A \\cup B) &=& P(A)+P(B)-P(A \\cap B)\\\\\n \n &=& P(A)+P(B)-P(A)P(B)\\\\\n \n &=&\\frac{1}{6}+ \\frac{1}{6}-\\frac{1}{36}\\\\\n \n &=& \\frac{11}{36}\n \n \\end{eqnarray*}\n \n \\]

\n \n \n ", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"number": {"name": "number", "group": "Ungrouped variables", "definition": "random(1..6)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["number"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

What is the probability of at least one die showing a $\\var{number}$?

\n

Probability = [[0]]

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "11/36", "maxValue": "11/36", "correctAnswerFraction": true, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Calculate expectation and a probability from a frequency table, , , ", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [{"variables": ["idef", "thing", "episodes", "period", "activity"], "name": "Strings"}, {"variables": ["p0", "p1", "p2", "p3", "p4", "p5", "p6", "p7", "p8", "probabilities", "values"], "name": "Probabilities"}, {"variables": ["r", "s", "t", "t1", "t2", "u1", "u2", "u3", "d"], "name": "Stuff to generate probabilities"}], "variables": {"p4": {"templateType": "anything", "group": "Probabilities", "definition": "t-p8-p7-p6-p5", "description": "", "name": "p4"}, "expected_number": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sum(map(x*y,[x,y],zip(probabilities,values)))", "description": "", "name": "expected_number"}, "u2": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "u1", "description": "", "name": "u2"}, "p1": {"templateType": "anything", "group": "Probabilities", "definition": "p0+t1", "description": "", "name": "p1"}, "p3": {"templateType": "anything", "group": "Probabilities", "definition": "r-p0-p1-p2", "description": "", "name": "p3"}, "t": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "100-r", "description": "", "name": "t"}, "probexceed": {"templateType": "anything", "group": "Ungrouped variables", "definition": "sum(map(if(j>expected_number,probabilities[j],0),j,0..8))", "description": "", "name": "probexceed"}, "values": {"templateType": "anything", "group": "Probabilities", "definition": "list(0..8)", "description": "", "name": "values"}, "thing": {"templateType": "string", "group": "Strings", "definition": "\"airline\"", "description": "", "name": "thing"}, "u3": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "u1", "description": "", "name": "u3"}, "u1": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "round(d*random(70..100)/100)", "description": "", "name": "u1"}, "expect_int": {"templateType": "anything", "group": "Ungrouped variables", "definition": "floor(expected_number)", "description": "", "name": "expect_int"}, "activity": {"templateType": "string", "group": "Strings", "definition": "\"luggage handling\"", "description": "", "name": "activity"}, "probabilities": {"templateType": "anything", "group": "Probabilities", "definition": "map(x/100,x,[p0,p1,p2,p3,p4,p5,p6,p7,p8])", "description": "

Probability of there being $i$ episodes

", "name": "probabilities"}, "d": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "round(t/15)", "description": "", "name": "d"}, "episodes": {"templateType": "string", "group": "Strings", "definition": "\"complaints\"", "description": "", "name": "episodes"}, "t2": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "t1", "description": "", "name": "t2"}, "p8": {"templateType": "anything", "group": "Probabilities", "definition": "d", "description": "", "name": "p8"}, "p7": {"templateType": "anything", "group": "Probabilities", "definition": "p8+u1", "description": "", "name": "p7"}, "p5": {"templateType": "anything", "group": "Probabilities", "definition": "p6+u3", "description": "", "name": "p5"}, "idef": {"templateType": "string", "group": "Strings", "definition": "\"an\"", "description": "", "name": "idef"}, "p2": {"templateType": "anything", "group": "Probabilities", "definition": "p1+t2", "description": "", "name": "p2"}, "t1": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "round(s*random(70..100)/100)", "description": "", "name": "t1"}, "r": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "random(45..65)", "description": "", "name": "r"}, "s": {"templateType": "anything", "group": "Stuff to generate probabilities", "definition": "round(r/10)", "description": "", "name": "s"}, "p0": {"templateType": "anything", "group": "Probabilities", "definition": "s", "description": "", "name": "p0"}, "p6": {"templateType": "anything", "group": "Probabilities", "definition": "p7+u2", "description": "", "name": "p6"}, "period": {"templateType": "string", "group": "Strings", "definition": "\"day\"", "description": "", "name": "period"}}, "ungrouped_variables": ["expected_number", "expect_int", "probexceed"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"precisionPartialCredit": 0, "allowFractions": false, "correctAnswerFraction": false, "minValue": "expected_number", "maxValue": "expected_number", "precision": "2", "type": "numberentry", "precisionType": "dp", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "showCorrectAnswer": true, "marks": 2}], "type": "gapfill", "prompt": "

Find the expected number of {episodes} per {period}.

\n

Expected number = [[0]]

", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"precisionPartialCredit": 0, "allowFractions": false, "correctAnswerFraction": false, "minValue": "probexceed", "maxValue": "probexceed", "precision": "2", "type": "numberentry", "precisionType": "dp", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "showCorrectAnswer": true, "marks": 2}], "type": "gapfill", "prompt": "

What is the probability that the number of {episodes} will exceed the expected number?

\n

Probability = [[0]]

", "showCorrectAnswer": true, "marks": 0}], "statement": "

The probabilities that {idef} {thing} will receive {episodes} per {period} about its {activity} are given by the following table:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Complaints{values[0]}{values[1]}{values[2]}{values[3]}{values[4]}{values[5]}{values[6]}{values[7]}{values[8]}
Probability{probabilities[0]}{probabilities[1]}{probabilities[2]}{probabilities[3]}{probabilities[4]}{probabilities[5]}{probabilities[6]}{probabilities[7]}{probabilities[8]}
\n

Answer the following two parts, giving your answers to $2$ decimal places.

", "tags": ["checked2015", "discrete distribution", "expectation", "expected value", "MAS1604", "MAS2304", "MAS8380", "MAS8401", "mass function", "pmf", "PMF", "Probability", "probability", "probability mass function", "query", "sc", "statistics", "tested1"], "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "

7/07/2012:

\n

Added tags.

\n

Checked calculation.

\n

22/07/2012:

\n

Added description.

\n

Ticked stats extension box.

\n

31/07/2012:

\n

Added tags.

\n

Question appears to be working correctly.

\n

20/12/2012:

\n

Could increase the number of scenarios by using random string variables. Query tag added for that.

\n

Also very cumbersome use of variables. But no change proposed for now.

\n

Checked calculation, OK. Added tested1 tag.

\n

21/12/2012:

\n

Although asks for solution to 2 dps, there is no rounding as the raw values are to 2 dps. Added sc tag for possible scenarios.

", "licence": "Creative Commons Attribution 4.0 International", "description": "

Given a probability mass function $P(X=i)$ with outcomes $i \\in \\{0,1,2,\\ldots 8\\}$, find the expectation $E$ and $P(X \\gt E)$.

"}, "variablesTest": {"condition": "", "maxRuns": "100"}, "advice": "

a)

\n

The expected number of {episodes} is given by:

\n

\\[ \\simplify[]{{probabilities[0]}*{values[0]} + {probabilities[1]}*{values[1]} + {probabilities[2]}*{values[2]} + {probabilities[3]}*{values[3]} + {probabilities[4]}*{values[4]} + {probabilities[5]}*{values[5]} + {probabilities[6]}*{values[6]} + {probabilities[7]}*{values[7]} + {probabilities[8]}*{values[8]}} = \\var{expected_number} \\]

\n

b)

\n

We want the probability that the number of {episodes} exceeds $\\var{expected_number}$.

\n

Since the number of {episodes} is a whole number, this is the same as the probability that the number is $\\var{expect_int+1}$ or more and is

\n

\\[\\sum_{i=\\var{expect_int+1}}^{i=8} \\left( \\text{Probability}(\\var{episodes} = i ) \\right)= \\simplify[zeroTerm]{ {if(expect_int<1,probabilities[1],0)} + {if(expect_int<2,probabilities[2],0)} + {if(expect_int<3,probabilities[3],0)} + {if(expect_int<4,probabilities[4],0)} + {if(expect_int<5,probabilities[5],0)} + {if(expect_int<6,probabilities[6],0)} + {if(expect_int<7,probabilities[7],0)} + {if(expect_int<8,probabilities[8],0)}} = \\var{probexceed}\\]

"}, {"name": "Calculate probability, CDF, expected value and variance of binomial distribution, ", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"w": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1..100)", "description": "", "name": "w"}, "x2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(2,3,4)", "description": "", "name": "x2"}, "ans2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tans2,3)", "description": "", "name": "ans2"}, "tol": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0.001", "description": "", "name": "tol"}, "ans1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(tans1,3)", "description": "", "name": "ans1"}, "v4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(x2>3,1,0)", "description": "", "name": "v4"}, "x1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round((w+(100-w)*(n-1))/100)", "description": "", "name": "x1"}, "n": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(6..20)", "description": "", "name": "n"}, "tans1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "binomialPDF(x1,n,p)", "description": "", "name": "tans1"}, "tans2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "binomialCDF(x2,n,p)", "description": "", "name": "tans2"}, "p": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0.1..0.9#0.1)", "description": "", "name": "p"}, "v3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "switch(x2>2,1,0)", "description": "", "name": "v3"}}, "ungrouped_variables": ["w", "ans1", "ans2", "n", "p", "v3", "v4", "tol", "x2", "x1", "tans1", "tans2"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "showQuestionGroupNames": false, "parts": [{"scripts": {}, "gaps": [{"precisionPartialCredit": 0, "allowFractions": false, "correctAnswerFraction": false, "minValue": "ans1", "maxValue": "ans1", "precision": "3", "type": "numberentry", "precisionType": "dp", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "showCorrectAnswer": true, "marks": 1}], "type": "gapfill", "prompt": "

Compute $\\operatorname{P}(X=\\var{x1}) = $ [[0]]

", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"precisionPartialCredit": 0, "allowFractions": false, "correctAnswerFraction": false, "minValue": "ans2", "maxValue": "ans2", "precision": "3", "type": "numberentry", "precisionType": "dp", "showPrecisionHint": false, "strictPrecision": false, "scripts": {}, "precisionMessage": "You have not given your answer to the correct precision.", "showCorrectAnswer": true, "marks": 1}], "type": "gapfill", "prompt": "

Compute $F_X(\\var{x2}) = \\operatorname{P}(X\\le\\var{x2})=$ [[0]]

", "showCorrectAnswer": true, "marks": 0}, {"scripts": {}, "gaps": [{"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{n*p}", "minValue": "{n*p}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "{n*p*(1-p)}", "minValue": "{n*p*(1-p)}", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "

Find:

\n
    \n
  1. $\\operatorname{E}[X]=$ [[0]]
  2. \n
  3. $\\operatorname{Var}(X)=$ [[1]]
  4. \n
", "showCorrectAnswer": true, "marks": 0}], "statement": "

Enter your answers to the following questions to $3$ decimal places.

\n

Suppose $X \\sim \\operatorname{Binomial}(\\var{n},\\var{p})$

", "tags": ["binomial distribution", "Binomial distribution", "Binomial Distribution", "CDF", "cdf", "CDF of binomial distribution", "checked2015", "cr1", "cumulative density function", "Discrete random variables.", "distributions", "Expectation of binomial distribution", "MAS1604", "MAS2304", "probability", "Probability", "random variables", "statistics", "tested1", "variance of binomial distribution"], "rulesets": {"std": ["all", "!collectNumbers", "!noLeadingMinus"]}, "preamble": {"css": "", "js": "Numbas.jme.display.texOps['prob'] = function(thing,texArgs) {\n return '\\\\operatorname{P}\\\\left( '+texArgs.join(', ')+' \\\\right)';\n}"}, "type": "question", "metadata": {"notes": "

7/07/2012:

\n

Added tags.

\n

Cannot access stats extension at present, so question does not run. Issue posted.

\n

Set new tolerance variable tol=0.001 for first two answers.

\n

Calculation to be tested under Test Run.

\n

22/07/2012:

\n

Now runs after stats extension box ticked.

\n

Added description.

\n

Checked calculation.

\n

31/07/2012:

\n

Added tags.

\n

Question appears to be working correctly.

\n

 20/12/2012:

\n

Rounding seems to be OK. Added cr1 tag.  Replaced sum of pdf values by built in binomialcdf function from jstats.

\n

Checked calculation, OK. Added tested1 tag.

", "licence": "Creative Commons Attribution 4.0 International", "description": "

$X \\sim \\operatorname{Binomial}(n,p)$. Find $P(X=a)$, $P(X \\leq b)$, $E[X],\\;\\operatorname{Var}(X)$.

"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "

a)

\n

\\[ \\simplify[std,!otherNumbers]{prob(X = {x1}) = {n}! / ({n -x1}! * {x1}!) * {p} ^ {x1} * (1 -{p}) ^ {n -x1}} = \\var{ans1}\\]

\n

to 3 decimal places.

\n

b)

\n

We have:

\n

\\begin{align}
F_X (\\var{x2}) &= \\operatorname{P}(X \\le \\var{x2}) = \\simplify[std]{ prob(X = 0) + prob(X = 1) + prob(X = 2) + {v3} * prob(X = 3) + {v4} * prob(X = 4)} \\\\
&= \\simplify[unitFactor,zeroTerm,zeroFactor]{(1 -{p}) ^ {n} + {n} * (1 -{p}) ^ {n -1} * {p} + {(n * (n -1)) / 2} * (1 -{p}) ^ {n -2} * {p} ^ 2 + {v3} * {comb(n , 3)} * (1 -{p}) ^ {n -3} * {p} ^ 3 + {v4} * {comb(n , 4)} * (1 -{p}) ^ {n -4} * {p} ^ 4} \\\\
&= \\var{ans2} 
\\end{align}

\n

to 3 decimal places.

\n

c)

\n

For the binomial distribution $\\operatorname{Binomial}(n,p)$ we have:

\n

\\begin{align}
\\operatorname{E}[X] &= np \\\\
\\operatorname{Var}(X) &= np(1-p)
\\end{align}

\n

Hence in this case:

\n

\\begin{align}
\\operatorname{E}[X] &= \\var{n} \\times \\var{p} = \\var{n*p} \\\\
\\operatorname{Var}(X) &= \\var{n} \\times \\var{p} \\times \\var{(1-p)} = \\var{n*p*(1-p)}
\\end{align}

"}, {"name": "Calculate probabilities from frequency table", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"q": {"templateType": "anything", "group": "Ungrouped variables", "definition": "2", "description": "", "name": "q"}, "a0": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1000..4000#1000)", "description": "", "name": "a0"}, "ans2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((thismany-sum(n[0..v+1]))/thismany,2)", "description": "", "name": "ans2"}, "ans3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround((n[1]+n[2])/thismany,2)", "description": "", "name": "ans3"}, "thismany": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(300..1000#100)", "description": "", "name": "thismany"}, "n1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(thismany/random(3,6))", "description": "", "name": "n1"}, "sc": {"templateType": "anything", "group": "Ungrouped variables", "definition": "['A bank made '+{thismany}+' car loans last year. The amounts were as follows (\u00a3):']", "description": "", "name": "sc"}, "b0": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(1000..3000#1000)", "description": "", "name": "b0"}, "data": {"templateType": "anything", "group": "Ungrouped variables", "definition": "\n[[0,a[0]-1,n[0]],\n [a[0],a[1]-1,n[1]],\n [a[1],a[2]-1,n[2]],\n [a[2],'plus',n[3]]]\n \n\n\n\n", "description": "", "name": "data"}, "n0": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(thismany/random(15,25))", "description": "", "name": "n0"}, "t": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..abs(a)-1)", "description": "", "name": "t"}, "ans1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "precround(sum(n[0..t+1])/thismany,2)", "description": "", "name": "ans1"}, "n3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "round(thismany/random(11,14))", "description": "", "name": "n3"}, "k": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..abs(sc)-1)", "description": "", "name": "k"}, "o1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a[v]", "description": "", "name": "o1"}, "v": {"templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..abs(a)-1 except t)", "description": "", "name": "v"}, "n": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[n0,n1,thismany-n0-n1-n3,n3]", "description": "", "name": "n"}, "u1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "a[t]", "description": "", "name": "u1"}, "a": {"templateType": "anything", "group": "Ungrouped variables", "definition": "[a0,a0+b0,a0+2*b0]", "description": "", "name": "a"}, "p": {"templateType": "anything", "group": "Ungrouped variables", "definition": "0", "description": "", "name": "p"}}, "ungrouped_variables": ["a", "sc", "p", "ans1", "k", "ans3", "u1", "thismany", "n", "q", "a0", "b0", "t", "v", "n0", "n1", "n3", "data", "ans2", "o1"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {"accumdisp": {"type": "string", "language": "jme", "definition": "if(k=0,'$\\\\var{a[0]}$','$\\\\var{a[0]}$ + '+accumdisp(a[1..abs(a)],k-1))", "parameters": [["a", "list"], ["k", "number"]]}}, "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", "minValue": "ans2", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}, {"showCorrectAnswer": true, "allowFractions": false, "scripts": {}, "type": "numberentry", "maxValue": "ans3", "minValue": "ans3", "correctAnswerFraction": false, "marks": 1, "showPrecisionHint": false}], "type": "gapfill", "prompt": "\n

One of these loans is sampled randomly for review by the bank. What is the probability that it is :

\n

a) Under £$\\var{u1}$?   Probability = ? [[0]]  (answer to 2 decimal places).

\n

b) Over £$\\var{o1-1}$?     Probability = ? [[1]]  (answer to 2 decimal places).

\n

c) Between £$\\var{a[p]}$ and £$\\var{a[q]-1}$?    Probability = ? [[2]] (answer to 2 decimal places).

\n

 

\n

 

\n \n\n \n", "showCorrectAnswer": true, "marks": 0}], "statement": "\n

{sc[k]}

\n

{table(data,['  From','  To', '  Loans Made'])}

\n

 

\n \n\n \n", "tags": ["ACC1012", "acc1012", "checked2015", "probability", "Probability", "statistics", "udf"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "\n\t\t \t\t \t\t

28/12/2012:

\n\t\t \t\t \t\t

Using the inbuilt table function for now. This needs to be changed - either to direct input of an html table or improving the table function e.g. adding borders etc.

\n\t\t \t\t \t\t

The udf accumdisp(a,t) outputs a string of the form a[0]+a[1]+..a[t-1]  - useful to show in the solution the elements of the list we are summing over.

\n\t\t \t\t \t\t

There is a scenario variable sk, which is intended to be the beginning of a list of possible randomised scenarios. Probably best if this included other text based string variables (e.g. car loans could be the value of such a variable).

\n\t\t \t\t \t\t

Easy to make this have a variable number of ranges of loans. Only need to pay some attention to the creation of the list n giving the number of loans in each range - need to make that sensible.

\n\t\t \t\t \n\t\t \n\t\t", "licence": "Creative Commons Attribution 4.0 International", "description": "

Simple probability question. Counting number of occurrences of an event in a sample space with given size and finding the probability of the event.

"}, "variablesTest": {"condition": "", "maxRuns": 100}, "advice": "\n

a) The number of loans less than £$\\var{u1}$ is $\\var{accumdisp(n,t)}=\\var{sum(n[0..t+1])}$

\n

Since there are $\\var{thismany}$ loans the probability of choosing one of these loans is  $\\displaystyle \\frac{\\var{sum(n[0..t+1])}}{\\var{thismany}}=\\var{ans1}$ to 2 decimal places.

\n

b) The number of loans greater than £$\\var{o1}$ is $\\var{accumdisp(n[v+1..abs(n)],abs(n)-v-2)}=\\var{sum(n[v+1..abs(n)])}$.

\n

Since there are $\\var{thismany}$ loans the probability of choosing one of these loans is  $\\displaystyle \\frac{\\var{sum(n[v+1..abs(n)])}}{\\var{thismany}}=\\var{ans2}$ to 2 decimal places.

\n

c) There are $\\var{accumdisp(n[p+1..q+1],q-p-1)}=\\var{sum(n[p+1..q+1])}$ loans between  £$\\var{a[p]}$ and £$\\var{a[q]-1}$.

\n

Hence the probability of selecting one of these loans in this range for review is $\\displaystyle \\frac{\\var{sum(n[p+1..q+1])}}{\\var{thismany}}=\\var{ans3}$ to 2 decimal places.

\n \n\n \n"}, {"name": "Theoretical Probability vs Experimental Probability ", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Elliott Fletcher", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1591/"}], "type": "question", "statement": "

Two unbiased, 6-sided dice were rolled together and the total of the numbers shown on the faces was recorded.

\n

The experiment was repeated $\\var{no_rolls}$ times.

\n

This table gives the frequency of each outcome.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Total23456789101112
Frequency$\\var{Freq[0]}$$\\var{Freq[1]}$$\\var{Freq[2]}$$\\var{Freq[3]}$$\\var{Freq[4]}$$\\var{Freq[5]}$$\\var{Freq[6]}$$\\var{Freq[7]}$$\\var{Freq[8]}$$\\var{Freq[9]}$$\\var{Freq[10]}$
", "variablesTest": {"condition": "", "maxRuns": 100}, "variables": {"Freq2": {"group": "Ungrouped variables", "name": "Freq2", "description": "

List of Frequencies for theoretical probability.

", "templateType": "anything", "definition": "[1,2,3,4,5,6,5,4,3,2,1]"}, "sum": {"group": "Ungrouped variables", "name": "sum", "description": "

Sums obtained from no_rolls of two dice part a)

", "templateType": "anything", "definition": "repeat(random(2..12), no_rolls)"}, "gcd2": {"group": "Ungrouped variables", "name": "gcd2", "description": "

Gcd for answer in part a) ii)

", "templateType": "anything", "definition": "gcd(Freq2[x[0]],36)"}, "gcd1": {"group": "Ungrouped variables", "name": "gcd1", "description": "

Gcd of numerator and denominator for advice for part a) i).

", "templateType": "anything", "definition": "gcd(Freq[sum[0]-2], no_rolls)"}, "die": {"group": "Ungrouped variables", "name": "die", "description": "

number the die lands on in part a)

", "templateType": "anything", "definition": "[2,3,4,5,6,7,8,9,10,11,12]"}, "Freq": {"group": "Ungrouped variables", "name": "Freq", "description": "

Frequencies of each possible sum of numbers from rolling 2 die. part a

", "templateType": "anything", "definition": "map(\nlen(filter(x=j,x,sum)),\nj, 2..12)"}, "add": {"group": "Ungrouped variables", "name": "add", "description": "", "templateType": "anything", "definition": "random(-5..5 except -1 except 1 except 0)"}, "no_rolls": {"group": "Ungrouped variables", "name": "no_rolls", "description": "

Number of rolls of the die in part a.

", "templateType": "anything", "definition": "random(50..100 #10)"}, "remainder": {"group": "Ungrouped variables", "name": "remainder", "description": "", "templateType": "anything", "definition": "(ceil(10000/36)+add)+(ceil(10000/18)+add)+(ceil(2500/3)+add)+(ceil(10000/9)+add)+(ceil(12500/9)+add)+(ceil(12500/9)-add)+(ceil(10000/9)-add)+(ceil(2500/3)-add)+(ceil(5000/9)-add)+(ceil(2500/9)-add)"}, "x": {"group": "Ungrouped variables", "name": "x", "description": "

Index for part a.

", "templateType": "anything", "definition": "indices(die, sum[0])"}}, "functions": {}, "tags": ["dice", "Dice", "Experimental probability", "Experimental Probability", "experimental probability", "Probability", "probability", "sum of two dice", "taxonomy", "theoretical probability", "Theoretical Probability"], "variable_groups": [], "parts": [{"scripts": {}, "variableReplacements": [], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "gaps": [{"correctAnswerFraction": true, "scripts": {}, "type": "numberentry", "variableReplacementStrategy": "originalfirst", "allowFractions": true, "maxValue": "{Freq[{sum[0]}-2]}/{no_rolls}", "showFeedbackIcon": true, "minValue": "{Freq[{sum[0]}-2]}/{no_rolls}", "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "mustBeReduced": false, "notationStyles": ["plain", "en", "si-en"], "variableReplacements": [], "marks": 1, "showCorrectAnswer": true}], "showCorrectAnswer": true, "prompt": "

Find the experimental probability of rolling a total of $\\var{sum[0]}$.

\n

Enter your answer as a fraction.

\n

[[0]]

", "marks": 0}, {"correctAnswerFraction": true, "scripts": {}, "type": "numberentry", "variableReplacementStrategy": "originalfirst", "allowFractions": true, "maxValue": "{Freq2[{x[0]}]}/36", "showFeedbackIcon": true, "prompt": "

Now calculate the theoretical probability that the sum of the scores of the two dice is $\\var{sum[0]}$.

\n

Enter your answer as a fraction.

", "minValue": "{Freq2[{x[0]}]}/36", "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "mustBeReduced": false, "notationStyles": ["plain", "en", "si-en"], "variableReplacements": [], "marks": 1, "showCorrectAnswer": true}, {"scripts": {}, "variableReplacements": [], "type": "gapfill", "variableReplacementStrategy": "originalfirst", "showFeedbackIcon": true, "gaps": [{"scripts": {}, "minMarks": 0, "distractors": ["", ""], "variableReplacementStrategy": "originalfirst", "displayType": "radiogroup", "choices": ["

gets closer to the theoretical probability

", "

gets further away from the theoretical probability

"], "showFeedbackIcon": true, "shuffleChoices": true, "matrix": ["1", 0], "variableReplacements": [], "marks": 0, "displayColumns": 0, "showCorrectAnswer": true, "maxMarks": 0, "type": "1_n_2"}], "showCorrectAnswer": true, "prompt": "

As the number of rolls of the two dice increases, the experimental probability [[0]]

\n

", "marks": 0}], "ungrouped_variables": ["die", "no_rolls", "sum", "Freq", "Freq2", "x", "gcd1", "gcd2", "add", "remainder"], "rulesets": {}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Compute the experimental probability of a particular score on a die given a sample of throws, and compare it with the theoretical probability.

\n

The last part asks what you expect to happen to the experimental probability as the sample size increases.

"}, "preamble": {"css": "", "js": ""}, "advice": "

There are two ways of assigning probability:

\n\n

a)

\n

To calculate the experimental probability (relative frequency) of an outcome we divide the frequency of the outcome in the experiment by the number of trials.

\n

We are given that the experiment was repeated $\\var{no_rolls}$ times.

\n

We then need the number of times that the sum of the faces of the dice was equal to $\\var{sum[0]}$. From the frequency table, we can see that the frequency of rolling a $\\var{sum[0]}$ in the experiment was $\\var{Freq[sum[0]-2]}$.

\n

Therefore, the experimental probability of rolling a $\\var{sum[0]}$ is 

\n

\\[ \\begin{align} P(\\text{total}=\\var{sum[0]}) &= \\displaystyle\\frac{\\text{number of times a total of $\\var{sum[0]}$ was rolled}}{\\text{total number of rolls}}\\\\&= \\displaystyle\\frac{\\var{Freq[sum[0]-2]}}{\\var{no_rolls}}.\\end{align}\\]

\n

\\[\\begin{align} P(\\text{total}=\\var{sum[0]}) &= \\displaystyle\\frac{\\text{number of times a total of $\\var{sum[0]}$ was rolled}}{\\text{total number of rolls}}\\\\&= \\displaystyle\\frac{\\var{Freq[sum[0]-2]}}{\\var{no_rolls}}\\\\&= \\displaystyle\\var[fractionNumbers, simplifyFractions]{{Freq[sum[0]-2]/no_rolls}}.\\end{align}\\]

\n

b)

\n

When two unbiased 6-sided dice are rolled and their scores are added, there are $11$ possible outcomes: the total must be between $2$ and $12$ inclusive.

\n

To work out the probabilities of each outcome occurring, we must be very careful about how the experiment is performed.

\n

There are a total of $36$ different outcomes when rolling two dice one after the other; these are shown in Table $1$.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Table 1 
123456
1(1,1)(1,2)(1,3)(1,4)(1,5)(1,6)
2(2,1)(2,2)(2,3)(2,4)(2,5)(2,6)
3(3,1)(3,2)(3,3)(3,4)(3,5)(3,6)
4(4,1)(4,2)(4,3)(4,4)(4,5)(4,6)
5(5,1)(5,2)(5,3)(5,4)(5,5)(5,6)
6(6,1)(6,2)(6,3)(6,4)(6,5)(6,6)
\n

Note that these outcomes are all different. For example, the outcomes (2,1) and (1,2) are not the same because we know the order in which the dice were thrown so we can distinguish between these two outcomes; when the first die lands on $2$ and the second die lands on $1$ the outcome is (2,1), however when the first die lands on $1$ and the second die lands on $2$ the outcome is (1,2).

\n

The sum of the numbers in these outcomes is the same, we just count them as different outcomes.

\n

Any one of these $36$ outcomes is equally likely to occur, so the probability of each of these outcomes is $\\displaystyle\\frac{1}{36}$.

\n

However, if you roll two indistinguishable dice at the same time, you can't differentiate (a 1 and a 2) from (a 2 and a 1). From your point of view, they are the same outcome. The probabilities of the underlying events (each die's score) haven't changed, but the outcomes you observe have.

\n

In this case you have a total of $21$ outcomes; these outcomes are not all equally likely. There's only one way of obtaining two 1s, while there are two ways of obtaining a 1 and a 2, corresponding to two squares in Table $1$. Hence the probability of obtaining two 1s would be $\\displaystyle\\frac{1}{36}$, whereas the probability of obtaining a 1 and a 2 would be

\n

\\[\\displaystyle\\frac{2}{36}=\\displaystyle\\frac{1}{18}.\\]

\n

You can do the experiment this way, but it's easier when you can tell the dice apart.

\n

Table $2$ shows the corresponding total of the faces of the dice for each of the outcomes in Table $1$.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Table 2 
+123456
1234567
2345678
3456789
45678910
567891011
6789101112
\n

\n

For equally likely outcomes you can calculate the probability using the formula

\n

\\[\\text{Probability of an event} = \\displaystyle\\frac{\\text{number of favourable outcomes}}{\\text{total number of outcomes}}.\\]

\n

Table $3$ gives the theoretical probabilities of each of the possible totals of the two dice occurring:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Table 3 
Total23456789101112
Probability$\\displaystyle\\frac{1}{36}$$\\displaystyle\\frac{2}{36}$$\\displaystyle\\frac{3}{36}$$\\displaystyle\\frac{4}{36}$$\\displaystyle\\frac{5}{36}$$\\displaystyle\\frac{6}{36}$$\\displaystyle\\frac{5}{36}$$\\displaystyle\\frac{4}{36}$$\\displaystyle\\frac{3}{36}$$\\displaystyle\\frac{2}{36}$$\\displaystyle\\frac{1}{36}$
\n


\\[P(\\text{total}=\\var{sum[0]}) = \\displaystyle\\frac{\\var{Freq2[x[0]]}}{36}.\\]

\n

\\[\\begin{align} P(\\text{total}=\\var{sum[0]}) &= \\displaystyle\\frac{\\var{Freq2[x[0]]}}{36}\\\\ &= \\displaystyle\\var[fractionNumbers,simplifyFractions]{Freq2[x[0]]/36}. \\end{align}\\]

\n

c)

\n

For any experiment, as we make the number of trials very large the experimental probability tends towards the theoretical probability.

\n

For this experiment, for example, the theoretical probability of the sum of the faces of the two dice being $3$ is

\n

\\[\\displaystyle\\frac{2}{36} = \\var{sigformat(1/18,3)} \\text{ (rounded to $3$ significant figures)}.\\]

\n

If we were to roll the two dice a very large number of times, for example $10000$ times, the frequencies of each outcome would be different.

\n

The table below was produced by the recording the frequency of each outcome after rolling the two dice 10,000 times.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Total23456789101112
\n

Frequency

\n
$\\var{ceil(10000/36)+{add}}$$\\var{ceil(10000/18)+{add}}$$\\var{ceil(2500/3)+{add}}$$\\var{ceil(10000/9)+{add}}$$\\var{ceil(12500/9)+{add}}$$\\var{10000-{remainder}}$$\\var{ceil(12500/9)-{add}}$$\\var{ceil(10000/9)-{add}}$$\\var{ceil(2500/3)-{add}}$$\\var{ceil(5000/9)-{add}}$$\\var{ceil(2500/9)-{add}}$
\n

This means that the new experimental probability of the sum of the faces of the two dice being $3$ is 

\n

\\[\\displaystyle\\frac{\\var{ceil(10000/18) + {add}}}{10000} =  \\var{sigformat((ceil(10000/18)+{add})/10000,3)} \\text{ (rounded to $3$ significant figures)}.\\]

\n

This is very close to the theoretical probability, so we can see how the experimental probability changes as we increases the number of trials.

"}, {"name": "Probability - Notation and Conversion between Percentages, Decimals and Fractions", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Elliott Fletcher", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1591/"}], "variable_groups": [], "preamble": {"js": "", "css": ""}, "type": "question", "parts": [{"variableReplacementStrategy": "originalfirst", "type": "gapfill", "scripts": {}, "marks": 0, "showCorrectAnswer": true, "gaps": [{"correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "showCorrectAnswer": true, "variableReplacements": [], "precisionMessage": "You have not given your answer to the correct precision.", "precisionType": "dp", "mustBeReducedPC": 0, "precisionPartialCredit": 0, "showFeedbackIcon": true, "correctAnswerStyle": "plain", "allowFractions": false, "showPrecisionHint": true, "strictPrecision": false, "maxValue": "{percentage}/100", "precision": "2", "marks": 1, "scripts": {}, "minValue": "{percentage}/100", "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"]}, {"correctAnswerFraction": true, "mustBeReduced": true, "type": "numberentry", "showCorrectAnswer": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showFeedbackIcon": true, "correctAnswerStyle": "plain", "allowFractions": true, "scripts": {}, "minValue": "{percentage}/100", "maxValue": "{percentage}/100", "marks": 1, "variableReplacements": []}], "variableReplacements": [], "showFeedbackIcon": true, "prompt": "

The probability that it rains today is $\\var{percentage}\\%$.

\n

i)

\n

Convert this probability to a decimal.

\n

$\\mathrm{P}(\\text{Rain}) =$ [[0]]

\n

ii)

\n

Convert this probability to a fraction.

\n

$\\mathrm{P}(\\text{Rain}) =$ [[1]]

"}, {"variableReplacementStrategy": "originalfirst", "type": "gapfill", "scripts": {}, "marks": 0, "showCorrectAnswer": true, "gaps": [{"correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "showCorrectAnswer": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showFeedbackIcon": true, "correctAnswerStyle": "plain", "allowFractions": false, "scripts": {}, "minValue": "{decimal}*100", "maxValue": "{decimal}*100", "marks": 1, "variableReplacements": []}, {"correctAnswerFraction": true, "mustBeReduced": true, "type": "numberentry", "showCorrectAnswer": true, "notationStyles": ["plain", "en", "si-en"], "variableReplacementStrategy": "originalfirst", "mustBeReducedPC": 0, "showFeedbackIcon": true, "correctAnswerStyle": "plain", "allowFractions": true, "scripts": {}, "minValue": "{decimal}", "maxValue": "{decimal}", "marks": 1, "variableReplacements": []}], "variableReplacements": [], "showFeedbackIcon": true, "prompt": "

The probability that your bus is late today is $\\var{decimal}$.

\n

i)

\n

Convert this probability to a percentage (if necessary, round your answer to the nearest percent).

\n

$\\mathrm{P}(\\text{Late}) =$ [[0]]$\\%$.

\n

ii)

\n

Convert this probability to a fraction.

\n

$\\mathrm{P}(\\text{Late}) =$ [[1]]

"}, {"variableReplacementStrategy": "originalfirst", "type": "gapfill", "scripts": {}, "marks": 0, "showCorrectAnswer": true, "gaps": [{"correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "showCorrectAnswer": true, "variableReplacements": [], "precisionMessage": "You have not given your answer to the correct precision.", "precisionType": "dp", "mustBeReducedPC": 0, "precisionPartialCredit": 0, "showFeedbackIcon": true, "correctAnswerStyle": "plain", "allowFractions": false, "showPrecisionHint": false, "strictPrecision": false, "maxValue": "(1/{denominator})*100", "precision": 0, "marks": 1, "scripts": {}, "minValue": "(1/{denominator})*100", "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"]}, {"correctAnswerFraction": false, "mustBeReduced": false, "type": "numberentry", "showCorrectAnswer": true, "variableReplacements": [], "precisionMessage": "You have not given your answer to the correct precision.", "precisionType": "dp", "mustBeReducedPC": 0, "precisionPartialCredit": 0, "showFeedbackIcon": true, "correctAnswerStyle": "plain", "allowFractions": false, "showPrecisionHint": true, "strictPrecision": false, "maxValue": "(1/{denominator})", "precision": "2", "marks": 1, "scripts": {}, "minValue": "(1/{denominator})", "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"]}], "variableReplacements": [], "showFeedbackIcon": true, "prompt": "

The probability that a football match between Newcastle United and Manchester United ends in a draw is $\\displaystyle\\frac{1}{\\var{denominator}}$.

\n

i)

\n

Convert this probability to a percentage (if necessary, round your answer to the nearest percent).

\n

$\\mathrm{P}(\\text{Draw}) =$ [[0]]$\\%$.

\n

ii)

\n

Convert this probability to a decimal.

\n

$\\mathrm{P}(\\text{Draw}) =$ [[1]]

"}], "advice": "

a)

\n

We are told that $\\mathrm{P}(\\text{Rain}) = \\var{percentage}\\%$.

\n

i)

\n

To convert this to a decimal, we divide $\\var{percentage}$ by $100$.

\n

\\[\\frac{\\var{percentage}}{100} = \\simplify{{{percentage}/100}}.\\]

\n

Then, $\\mathrm{P}(\\text{Rain}) = \\simplify{{{percentage}/100}}$.

\n

ii)

\n

Similary, to convert this to a fraction, we divide $\\var{percentage}$ by $100$, but leave the fraction in its simplified form.

\n

\\[\\frac{\\var{percentage}}{100} = \\simplify{{percentage}/100}.\\]

\n

Then, $\\mathrm{P}(\\text{Rain}) = \\displaystyle\\simplify{{percentage}/100}$.

\n

b)

\n

We are told that $\\mathrm{P}(\\text{Late}) = \\var{decimal}$.

\n

i)

\n

To convert this to a percentage, we multiply $\\var{decimal}$ by $100$.

\n

\\[\\var{decimal} \\times 100 = \\simplify{{decimal}*100}.\\]

\n

Then, $\\mathrm{P}(\\text{Late}) = \\simplify{{decimal}*100}\\%$.

\n

ii)

\n

To convert this to a fraction, we multiply $\\var{decimal}$ by $\\displaystyle\\frac{100}{100}$. 

\n

\\[
\\begin{align}
\\var{decimal} \\times \\frac{100}{100} &= \\frac{\\simplify{{decimal}*100}}{100} \\\\[0.5em]
&= \\simplify{({decimal*100})/100}.
\\end{align}
\\]

\n

Then, $\\mathrm{P}(\\text{Late}) =\\displaystyle\\simplify{({decimal}*100)/100}$.

\n

c)

\n

We are told that $\\mathrm{P}(\\text{Draw}) = \\displaystyle\\frac{1}{\\var{denominator}}$.

\n

i)

\n

To convert this to a percentage, we multiply $\\displaystyle\\frac{1}{\\var{denominator}}$ by $100$.

\n

\\[
\\begin{align}
\\frac{1}{\\var{denominator}} \\times 100 &= \\var{100/{denominator}} \\\\
&= \\var{dpformat(100/{denominator},0)} & (\\text{rounded to the nearest integer}).
\\end{align}
\\]

\n

So, $\\mathrm{P}(\\text{Draw}) = \\var{dpformat(100/{denominator},0)}\\%$.

\n

ii)

\n

To convert this to a decimal, we can use a calculator to calculate $1 \\div \\var{denominator}$.

\n

\\[\\frac{1}{\\var{denominator}} = \\simplify{{1/{denominator}}}.\\]

\n

So, $\\mathrm{P}(\\text{Draw}) = \\var{dpformat(1/{denominator},2)}$ (rounded to two decimal places).

", "tags": ["conversion", "Decimals", "decimals", "fractions", "Fractions", "percentages", "Probability", "probability", "taxonomy"], "variables": {"percentage": {"templateType": "anything", "description": "

Part a.

", "definition": "random(10..90 #10)", "name": "percentage", "group": "Ungrouped variables"}, "denominator": {"templateType": "anything", "description": "

Part c.

", "definition": "random(3..9 except 5) ", "name": "denominator", "group": "Ungrouped variables"}, "decimal": {"templateType": "anything", "description": "

Part b.

", "definition": "random(0.10..0.90 #0.10 except percentage/100 )", "name": "decimal", "group": "Ungrouped variables"}}, "rulesets": {}, "variablesTest": {"condition": "", "maxRuns": 100}, "functions": {}, "ungrouped_variables": ["percentage", "decimal", "denominator"], "statement": "

Probabilities can be expressed as fractions, decimals or percentages.

\n

Convert each of the following probabilities into each of the two alternative numerical forms. 

", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Represent a given probability to a decimal, fraction or percentage.

"}}, {"name": "Probability of picking a particular colour ball from a bag", "extensions": [], "custom_part_types": [], "resources": [["question-resources/dice.svg", "/srv/numbas/media/question-resources/dice.svg"]], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "variable_groups": [], "preamble": {"css": "", "js": ""}, "type": "question", "parts": [{"variableReplacementStrategy": "originalfirst", "type": "gapfill", "showCorrectAnswer": true, "variableReplacements": [], "scripts": {}, "gaps": [{"maxMarks": 0, "type": "1_n_2", "showCorrectAnswer": true, "minMarks": 0, "distractors": ["This is the probability of not picking a blue ball.", "Divide by the total number of outcomes, not the number of unfavourable outcomes.", "", "Divide the number of favourable outcomes by the total number of outcomes.", "There's more than one blue ball."], "displayColumns": 0, "displayType": "radiogroup", "scripts": {}, "showFeedbackIcon": true, "marks": 0, "matrix": [0, 0, "1", 0, 0], "choices": ["

$\\displaystyle\\frac{\\var{red+green}}{\\var{total}}$

", "

$\\displaystyle\\frac{\\var{blue}}{\\var{green+red}}$

", "

$\\displaystyle\\frac{\\var{blue}}{\\var{total}}$

", "

$\\displaystyle\\frac{1}{\\var{blue}}$

", "

$\\displaystyle\\frac{1}{\\var{total}}$

"], "shuffleChoices": false, "variableReplacements": [], "variableReplacementStrategy": "originalfirst"}], "marks": 0, "showFeedbackIcon": true, "prompt": "

A bag contains $\\var{red}$ red balls, $\\var{blue}$ blue balls and $\\var{green}$ green balls. One ball is removed from the bag at random. What is the probability that the chosen ball will be blue? Remember to reduce any fractions into their simplest form.

\n

[[0]]

"}], "advice": "

For equally likely outcomes, you can calculate the probability of a particular event occurring by using the formula

\n

$\\text{Probability of an event} = \\displaystyle\\frac{\\text{number of favourable outcomes}}{\\text{total number of outcomes}}$.

\n

\n

We are told that the bag contains $\\var{red}$ red balls, $\\var{blue}$ blue balls and $\\var{green}$ green balls and that one ball is removed from the bag at random.

\n

The total number of balls in the bag before the chosen ball is removed is 

\n

\\[\\var{red}+\\var{blue}+\\var{green} = \\var{total}.\\]

\n

As the ball is being removed randomly from the bag, there is an equal probability of selecting any one of the $\\var{total}$ balls.

\n

Therefore, the probability of the chosen ball being blue is

\n

\\[
P(\\text{blue}) = \\displaystyle\\frac{\\text{number of favourable outcomes}}{\\text{total number of outcomes}} = \\displaystyle\\frac{\\var{blue}}{\\var{total}}
\\]

", "tags": ["taxonomy"], "variables": {"red": {"templateType": "anything", "description": "

number of red balls in part c

", "definition": "random(15,19)", "name": "red", "group": "Ungrouped variables"}, "green": {"templateType": "anything", "description": "

number of green balls in part c.

", "definition": "random(4,8,10)", "name": "green", "group": "Ungrouped variables"}, "total": {"templateType": "anything", "description": "

total number of balls in part c

", "definition": "red+blue+green", "name": "total", "group": "Ungrouped variables"}, "blue": {"templateType": "anything", "description": "

number of blue balls in part c

", "definition": "random(6,7,11)", "name": "blue", "group": "Ungrouped variables"}}, "rulesets": {}, "functions": {}, "ungrouped_variables": ["red", "blue", "green", "total"], "statement": "", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

A bag contains balls of three different colours. You're told how many there are of each, and asked the probability of picking a ball of a particular colour.

"}, "variablesTest": {"condition": "", "maxRuns": "100"}}, {"name": "Probability of flipping a coin and getting a tails", "extensions": [], "custom_part_types": [], "resources": [["question-resources/dice.svg", "/srv/numbas/media/question-resources/dice.svg"]], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "variable_groups": [], "preamble": {"js": "", "css": ""}, "type": "question", "parts": [{"variableReplacementStrategy": "originalfirst", "type": "gapfill", "scripts": {}, "marks": 0, "showCorrectAnswer": true, "gaps": [{"maxMarks": 0, "type": "1_n_2", "showCorrectAnswer": true, "minMarks": 0, "distractors": ["", "", "", ""], "variableReplacementStrategy": "originalfirst", "displayType": "radiogroup", "shuffleChoices": false, "showFeedbackIcon": true, "displayColumns": 0, "matrix": [0, "0", "1", 0], "choices": ["

$1$

", "

$\\displaystyle\\frac{2}{3}$

", "

$\\displaystyle\\frac{1}{2}$

", "

$\\displaystyle\\frac{1}{3}$

"], "scripts": {}, "variableReplacements": [], "marks": 0}], "variableReplacements": [], "showFeedbackIcon": true, "prompt": "

An unbiased coin is flipped. What is the probability of getting a tails?

\n

[[0]]

"}], "advice": "

\n

\n

When we flip an unbiased coin there are $2$ possible outcomes: heads or tails. Both outcomes are equally likely.

\n

\\[
\\begin{align}
P(\\text{tails}) &= \\displaystyle\\frac{\\text{number of favourable outcomes}}{\\text{total number of outcomes}}\\\\
&= \\displaystyle\\frac{1}{2}.
\\end{align}
\\]

\n

", "tags": ["taxonomy"], "variables": {}, "rulesets": {}, "variablesTest": {"condition": "", "maxRuns": "100"}, "functions": {}, "ungrouped_variables": [], "statement": "", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Choose the probability of getting a tails, from four options.

"}}, {"name": "Calculating expected values using theoretical probability and experimental probability", "extensions": ["random_person"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Elliott Fletcher", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1591/"}], "tags": ["dice", "Dice", "Expected Values", "Expected values", "Experimental Probability", "experimental probability", "Experimental probability", "probability", "Probability", "Relative Frequency", "relative frequency", "taxonomy", "Theoretical Probability", "theoretical probability"], "metadata": {"description": "

This question assesses

\n\n

The question also helps to show students how using experimental probability and theoretical probability results in different expected values of an outcome.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

{pname} rolls an unbiased six-sided die $\\var{no_rolls}$ times.

", "advice": "

a)

\n

Firstly, we must calculate the theoretical probability of rolling either a $\\var{num1}$ or a $\\var{num2}$.

\n

Both $\\var{num1}$ and $\\var{num2}$ only appear once on an unbiased six-sided die, so there are only $2$ possible outcomes where we roll either a $\\var{num1}$ or a $\\var{num2}$.

\n

There are $6$ possible outcomes when we roll an unbiased six-sided die.

\n

Therefore, the theoretical probability of rolling either a $\\var{num1}$ or a $\\var{num2}$ is

\n

\\[\\displaystyle\\frac{2}{6} = \\displaystyle\\frac{1}{3}.\\]

\n

Then the expected number of times that {pname} rolls either a $\\var{num1}$ or a $\\var{num2}$ is

\n

\\[\\var{no_rolls} \\times \\displaystyle\\frac{1}{3} = \\var{{no_rolls}/3}.\\]

\n

b)

\n

We are told that in {pronouns['their']} experiment, {pname} obtained either a $\\var{num1}$ or a $\\var{num2}$ on $\\var{Obtained}$ occasions. 

\n

Recall the formula for the relative frequency of an outcome.

\n

\\[ \\text{Relative Frequency} = \\displaystyle\\frac{\\text{Frequency of an outcome}}{\\text{Number of trials}}.\\]

\n

The Number of trials in the experiment is $\\var{no_rolls}$ and the frequency of the desired outcome is $\\var{Obtained}$.

\n

So the relative frequency of rolling either a $\\var{num1}$ or a $\\var{num2}$ is $\\displaystyle\\frac{\\var{Obtained}}{\\var{no_rolls}}$.

\n

c)

\n

The same die is now thrown $\\var{more_rolls}$ times.

\n

We know from b) that the relative frequency of rolling either a $\\var{num1}$ or a $\\var{num2}$ with this die was $\\displaystyle\\simplify{{Obtained}/{no_rolls}}$.

\n

Therefore using the experimental data, the number of times we would expect {pname} to roll either a $\\var{num1}$ or a $\\var{num2}$ in $\\var{more_rolls}$ throws of the die is

\n

\\[\\var{more_rolls} \\times \\displaystyle\\simplify{{Obtained}/{no_rolls}} = \\var{{more_rolls}*{Obtained}/{no_rolls}}.\\]

\n

On the other hand, we know from a) that the theoretical probability of rolling either a $\\var{num1}$ or a $\\var{num2}$ with this die is $\\displaystyle\\frac{1}{3}$.

\n

Using the theoretical probability, the number of times we would expect {pname} to roll either a $\\var{num1}$ or a $\\var{num2}$ in $\\var{more_rolls}$ throws of the die is 

\n

\\[\\var{more_rolls} \\times \\displaystyle\\frac{1}{3} = \\var{{more_rolls}/3}.\\]

", "rulesets": {}, "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"num2": {"name": "num2", "group": "Ungrouped variables", "definition": "random(4,5,6)", "description": "

Second number.

", "templateType": "anything", "can_override": false}, "pronouns": {"name": "pronouns", "group": "Ungrouped variables", "definition": "person['pronouns']", "description": "", "templateType": "anything", "can_override": false}, "Obtained": {"name": "Obtained", "group": "Ungrouped variables", "definition": "(no_rolls*multiplier)/10", "description": "

Number of times the event is obtained in the experiment.

", "templateType": "anything", "can_override": false}, "pname": {"name": "pname", "group": "Ungrouped variables", "definition": "person['name']", "description": "", "templateType": "anything", "can_override": false}, "no_rolls": {"name": "no_rolls", "group": "Ungrouped variables", "definition": "random(210..390 #30)", "description": "

Number of rolls of the die.

", "templateType": "anything", "can_override": false}, "verbs": {"name": "verbs", "group": "Ungrouped variables", "definition": "if(person['gender']='neutral','','s')", "description": "", "templateType": "anything", "can_override": false}, "multiplier": {"name": "multiplier", "group": "Ungrouped variables", "definition": "random(5,6,7)", "description": "

multiplier for the value of Obtained variable

", "templateType": "anything", "can_override": false}, "num1": {"name": "num1", "group": "Ungrouped variables", "definition": "random(1,2,3)", "description": "

First number.

", "templateType": "anything", "can_override": false}, "person": {"name": "person", "group": "Ungrouped variables", "definition": "random_person()", "description": "", "templateType": "anything", "can_override": false}, "more_rolls": {"name": "more_rolls", "group": "Ungrouped variables", "definition": "random(600..780 #30)", "description": "

Number of extra rolls of the die

", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["no_rolls", "num1", "num2", "Obtained", "more_rolls", "multiplier", "person", "pronouns", "pname", "verbs"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": "fraction {\n display: inline-block;\n vertical-align: middle;\n}\nfraction > numerator, fraction > denominator {\n float: left;\n width: 100%;\n text-align: center;\n line-height: 2.5em;\n}\nfraction > numerator {\n border-bottom: 1px solid;\n padding-bottom: 5px;\n}\nfraction > denominator {\n padding-top: 5px;\n}\nfraction input {\n line-height: 1em;\n}\n\nfraction .part {\n margin: 0;\n}\n\n.table-responsive, .fractiontable {\n display:inline-block;\n}\n.fractiontable {\n padding: 0; \n border: 0;\n}\n\n.fractiontable .tddenom \n{\n text-align: center;\n}\n\n.fractiontable .tdnum \n{\n border-bottom: 1px solid black; \n text-align: center;\n}\n\n\n.fractiontable tr {\n height: 3em;\n}\n"}, "parts": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Based on the theoretical probability of rolling a $\\var{num1}$ or a $\\var{num2}$, how many times would you expect {pronouns['them']} to roll either one of these numbers?

", "minValue": "{no_rolls}*1/3", "maxValue": "{no_rolls}*1/3", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

After performing the experiment, {pname} reports that {pronouns['they']} rolled either a $\\var{num1}$ or a $\\var{num2}$ on $\\var{Obtained}$ occasions.

\n

Calculate the relative frequency of rolling either a $\\var{num1}$ or a $\\var{num2}$.

\n

Enter your answer as a fraction.

\n

$\\text{Relative Frequency} =$ [[0]]

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "obtained/no_rolls", "maxValue": "obtained/no_rolls", "correctAnswerFraction": true, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

If {pname} rolled the same die $\\var{more_rolls}$ more times, how many times could {pronouns['they']} expect to roll either a $\\var{num1}$ or a $\\var{num2}$?

\n

Based on the experimental data: [[0]]

\n

Based on the theoretical probability: [[1]]

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{more_rolls}*({Obtained}/{no_rolls})", "maxValue": "{more_rolls}*({Obtained}/{no_rolls})", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "{more_rolls}/3", "maxValue": "{more_rolls}/3", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}, {"name": "Calculating Expected Values given a table of probabilities", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Elliott Fletcher", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1591/"}], "type": "question", "tags": ["Dice", "dice", "Expected values", "Expected Values", "Experimental Probability", "experimental probability", "Experimental probability", "Probability", "probability", "relative frequency", "Relative Frequency", "taxonomy", "Theoretical Probability", "theoretical probability"], "variablesTest": {"condition": "", "maxRuns": 100}, "variables": {"SW": {"templateType": "anything", "name": "SW", "description": "

Probability someone goes to see Star Wars

", "definition": "random(0.4..0.51 #0.05)", "group": "Ungrouped variables"}, "Avatar": {"templateType": "anything", "name": "Avatar", "description": "

Probability someone sees Avatar 

", "definition": "random(0.2..0.31 #0.05)", "group": "Ungrouped variables"}, "NYSM": {"templateType": "anything", "name": "NYSM", "description": "

Probability someone goes to see Now you see me

", "definition": "(1-(Avatar+SW))*3/5", "group": "Ungrouped variables"}, "TIJ": {"templateType": "anything", "name": "TIJ", "description": "

Probability someone goes to see the Italian Job

", "definition": "1-(Avatar+SW+NYSM)", "group": "Ungrouped variables"}, "no_people": {"templateType": "anything", "name": "no_people", "description": "

Number of people who see a movie.

", "definition": "random(100..180 #20)", "group": "Ungrouped variables"}}, "functions": {}, "statement": "

There are four films being shown in a cinema on a particular day.

\n

The probability that a person buys a ticket to see each film, denoted $P(\\text{Film})$, is given in the table below.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Film$P(\\text{Film})$Genre
Forgotten Game$\\var{Avatar}$Sci-Fi
The Diamond Valley$\\var{SW}$Sci-Fi
School of Return$\\var{NYSM}$Thriller
The Silk's Nobody$\\var{TIJ}$Crime
\n

$\\var{no_people}$ people each buy a ticket at the cinema to see a film of their own choosing during the day.

", "variable_groups": [], "parts": [{"correctAnswerFraction": false, "scripts": {}, "type": "numberentry", "variableReplacementStrategy": "originalfirst", "allowFractions": false, "maxValue": "{no_people}*{Avatar}", "showFeedbackIcon": true, "prompt": "

How many of these people would you expect to have bought tickets to see Forgotten Game?

", "minValue": "{no_people}*{Avatar}", "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "mustBeReduced": false, "notationStyles": ["plain", "en", "si-en"], "variableReplacements": [], "marks": 1, "showCorrectAnswer": true}, {"correctAnswerFraction": false, "scripts": {}, "type": "numberentry", "variableReplacementStrategy": "originalfirst", "allowFractions": false, "maxValue": "{no_people}*({Avatar}+{SW})", "showFeedbackIcon": true, "prompt": "

How many of these people would you expect to have bought tickets to see a Sci-Fi film?

", "minValue": "{no_people}*({Avatar}+{SW})", "correctAnswerStyle": "plain", "mustBeReducedPC": 0, "mustBeReduced": false, "notationStyles": ["plain", "en", "si-en"], "variableReplacements": [], "marks": 1, "showCorrectAnswer": true}], "ungrouped_variables": ["Avatar", "SW", "NYSM", "TIJ", "no_people"], "rulesets": {}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

This question assesses the students ability to find the expected number of times an event occurs given the probability of the event occurring for a single trial and the total number of trials.

"}, "preamble": {"css": "", "js": ""}, "advice": "

If we are given the probability of an event occurring in a single trial then we can calculate the expected number of times that this event would occur in a larger number of trials.

\n

To do this, we multiply the probability of the event occurring in a single trial by the total number of trials:

\n

\\[\\text{Expected number of times an event occurs} = \\text{Probability of event} \\times \\text{Number of trials}.\\] 

\n

We are given the probabilities that someone buys a ticket to see each film in the table below.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Film$P(\\text{Film})$Genre
Forgotten Game$\\var{Avatar}$Sci-Fi
The Diamond Valley$\\var{SW}$Sci-Fi
School of Return$\\var{NYSM}$Thriller
The Silk's Nobody$\\var{TIJ}$Crime
\n

We are also told that $\\var{no_people}$ people each buy a ticket at the cinema to see a film of their own choosing during this day.

\n

a)

\n

To calculate the expected number of people who bought tickets to see one of these films we multiply the probability that a person buys a ticket for that film by how many people bought tickets for a film at the cinema. 

\n

So the expected number of people who bought tickets to see Forgotten Game is

\n

\\[
\\var{Avatar} \\times \\var{no_people} = \\var{{Avatar}*{no_people}}.
\\]

\n

b)

\n

We are now asked to calculate the expected number of people who bought tickets to see a Sci-Fi film.

\n

From the table above we can see that there are two films which belong to the Sci-Fi genre: Forgotten Game and The Diamond Valley.

\n

Firstly, we need to calculate the probability that a person buys a ticket to see a Sci-Fi film, which we will denote $P(\\text{Sci-Fi})$.

\n

Since the probability that a person buys a ticket to see each film is different, it would be incorrect to say that the probability that a person buys a ticket to see a Sci-Fi film is 

\n

\\[\\displaystyle\\frac{2}{4} = \\displaystyle\\frac{1}{2}.\\]

\n

Instead we must recognise that the probability that a person buys a ticket to see a Sci-Fi film is the probability that a person buys a ticket to see either Forgotten or The Diamond Valley.

\n

Therefore to calculate this probability, we add the probabilities of a person buying a ticket to see each of these films:

\n

\\[
\\begin{align}
P(\\text{Sci-Fi}) &= P(\\text{Forgotten Game})+P(\\text{The Diamond Valley})\\\\
&= \\var{Avatar}+\\var{SW}\\\\
&= \\var{Avatar+SW}.
\\end{align}
\\]

\n

Then the expected number of people who bought tickets to see a Sci-Fi film is 

\n

\\[
\\var{Avatar+SW} \\times \\var{no_people} = \\var{({Avatar+SW})*{no_people}}.
\\]

\n

"}, {"name": "The probability of an event not happening - five friends play mini golf", "extensions": ["random_person"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Elliott Fletcher", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1591/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}], "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Given the probabilities that each of four out of five friends will win a round of mini-golf, work out the probability that the fifth friend won't win, then use that to find the probability that they will win.

"}, "advice": "

All probability situations can be reduced to two possible outcomes: success or failure.

\n

When we express the outcomes in this way we say that they are complementary.

\n

The sum of the probability of an event and its complement is always $1$.

\n

If $\\mathrm{P}(\\mathrm{E})$ is the probability of an event $\\mathrm{E}$ happening and $\\mathrm{P}(\\bar{\\mathrm{E}})$ is the probability of that event not happening then

\n

\\[\\mathrm{P}(\\mathrm{E}) +\\mathrm{P}(\\bar{\\mathrm{E}}) = 1.\\]

\n

Rearranging this equation gives:

\n

\\[\\mathrm{P}(\\bar{\\mathrm{E}}) = 1 - \\mathrm{P}(\\mathrm{E})\\]

\n

We can think of this game as having two possible outcomes: either Dexter wins or Dexter doesn't win.

\n

This means that

\n

\\[\\mathrm{P}(\\var{name}) + \\mathrm{P}(\\text{not } \\var{name}) = 1 \\text{.}\\]

\n

\n

a)

\n

If {name} doesn't win the game then that means that one of the other four players must win the game.

\n

So the probability of {name} not winning the game is the same as the probability of any of the other four players winning the game.

\n

Therefore

\n

\\begin{align}
\\mathrm{P}(\\text{not }\\var{name}) &= \\mathrm{P}(\\var{people[0]['name']})+\\mathrm{P}(\\var{people[1]['name']})+\\mathrm{P}(\\var{people[1]['name']})+\\mathrm{P}(\\var{people[1]['name']}) \\\\
&= \\var{latex(join(probs,' + '))}\\\\
&= \\var{sum(probs)}.
\\end{align}

\n

b)

\n

Rearranging the equation above gives

\n

\\[\\mathrm{P}(\\var{name}) = 1 - \\mathrm{P}(\\text{not } \\var{name}).\\]

\n

We know from a) that $\\mathrm{P}(\\text{not } \\var{name}) = \\var{sum(probs)}$.

\n

Therefore

\n

\\begin{align}
\\mathrm{P}(\\var{name}) &= 1 - \\mathrm{P}(\\text{not } \\var{name})\\\\
&= 1 - \\var{sum(probs)}\\\\
&= \\var{1-sum(probs)}.
\\end{align}

", "type": "question", "statement": "

Five friends are playing a game of mini-golf.

\n

The probability that each person wins the game, $\\mathrm{P}(\\text{Person})$, is given in the table.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Person{people[0]['name']}{people[1]['name']}{people[2]['name']}{people[3]['name']}{people[4]['name']}
$\\mathrm{P}(\\text{Person})$$\\var{probs[0]}$$\\var{probs[1]}$$\\var{probs[2]}$$\\var{probs[3]}$
", "variable_groups": [], "preamble": {"css": "", "js": ""}, "variables": {"name": {"templateType": "anything", "name": "name", "description": "", "group": "Ungrouped variables", "definition": "person['name']"}, "people": {"templateType": "anything", "name": "people", "description": "", "group": "Ungrouped variables", "definition": "random_people(5)"}, "probs": {"templateType": "anything", "name": "probs", "description": "

The probability of each of the first 4 friends winning the game. The missing person isn't included, so their probability can be 1 minus the sum of the rest, accumulating any rounding errors.

", "group": "Ungrouped variables", "definition": "map(precround(raw_probs[j]/sum(raw_probs),2),j,0..3)"}, "person": {"templateType": "anything", "name": "person", "description": "

The person whose probability is not given.

", "group": "Ungrouped variables", "definition": "people[2]"}, "raw_probs": {"templateType": "anything", "name": "raw_probs", "description": "

Uniform random values for each of the five friends. Their winning probabilities will be in proportion to this.

", "group": "Ungrouped variables", "definition": "repeat(random(0..1#0),5)"}}, "tags": ["Complement", "complement", "complementary", "Probabilities sum to 1", "Probability", "probability", "taxonomy"], "parts": [{"variableReplacements": [], "showFeedbackIcon": true, "prompt": "

\n

What is $\\mathrm{P}(\\text{not } \\var{name})$?

\n

[[0]]

\n

", "showCorrectAnswer": true, "type": "gapfill", "marks": 0, "gaps": [{"variableReplacements": [], "minValue": "sum(probs)", "type": "numberentry", "maxValue": "sum(probs)", "variableReplacementStrategy": "originalfirst", "mustBeReduced": false, "correctAnswerStyle": "plain", "correctAnswerFraction": false, "mustBeReducedPC": 0, "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "allowFractions": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1}], "variableReplacementStrategy": "originalfirst", "scripts": {}}, {"variableReplacements": [], "showFeedbackIcon": true, "prompt": "

What is $\\mathrm{P}(\\var{name})$?

\n

[[0]]

", "showCorrectAnswer": true, "type": "gapfill", "marks": 0, "gaps": [{"variableReplacements": [], "minValue": "1-sum(probs)", "type": "numberentry", "maxValue": "1-sum(probs)", "variableReplacementStrategy": "originalfirst", "mustBeReduced": false, "correctAnswerStyle": "plain", "correctAnswerFraction": false, "mustBeReducedPC": 0, "showFeedbackIcon": true, "notationStyles": ["plain", "en", "si-en"], "allowFractions": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1}], "variableReplacementStrategy": "originalfirst", "scripts": {}}], "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["people", "raw_probs", "probs", "person", "name"], "rulesets": {}, "functions": {}}, {"name": "Classify sampling methods", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "parts": [{"displayType": "radiogroup", "layout": {"type": "all", "expression": ""}, "marks": 0, "choices": ["{ch1}", "{ch2}", "{ch3}"], "matrix": "w", "prompt": "\n

Identify each of the following scenarios as one of the following:

\n \n

Note that you will lose 1 mark for every incorrect answer, however the minimum mark for this part of the question is 0.

\n

 

\n ", "minAnswers": 0, "maxAnswers": 0, "shuffleChoices": false, "warningType": "none", "scripts": {}, "maxMarks": 0, "type": "m_n_x", "minMarks": 0, "shuffleAnswers": false, "showCorrectAnswer": true, "answers": ["Simple Random Sampling", "Stratified Sampling", "Systematic Sampling", "Judgemental Sampling"]}], "variables": {"w": {"group": "Ungrouped variables", "templateType": "anything", "definition": "map(switch(chlist[x]=0,[1,-1,-1,-1],chlist[x]=1,[-1,1,-1,-1],chlist[x]=2,[-1,-1,1,-1],[-1,-1,-1,1]),x,0..2)", "name": "w", "description": ""}, "ch3": {"group": "Ungrouped variables", "templateType": "anything", "definition": "switch(chlist[2]=0,random(a except [ch1,ch2]),chlist[2]=1,random(b except [ch1,ch2]),chlist[2]=2,random(c except [ch1,ch2]),random(d except [ch1,ch2]))", "name": "ch3", "description": ""}, "b": {"group": "Ungrouped variables", "templateType": "anything", "definition": "[\"A local bus company is planning a new route to serve four housing estates. Random samples of households are taken from each estate and sample members are asked to rate on a scale of 1 (strongly opposed) to 5 (strongly in favour) their reaction to the proposed service.\",\"A company has three divisions, and auditors are attempting to estimate the total amounts of the company's accounts receivable. Simple random samples of these accounts were taken for each of the three divisions.\",\"A company has three divisions, and auditors are attempting to estimate the total amounts of the company's accounts receivable. Simple random samples of these accounts were taken for each of the three divisions.\",\"This form of sampling reflects the major groupings within a population.\"]", "name": "b", "description": ""}, "v": {"group": "Ungrouped variables", "templateType": "anything", "definition": "map(switch(chlist[x]=0,[1,-1,-1],chlist[x]=1,[1,-1,-1],chlist[x]=2,[-1,1,-1],[-1,-1,1]),x,0..2)", "name": "v", "description": ""}, "d": {"group": "Ungrouped variables", "templateType": "anything", "definition": "[\"A company director believes she knows what characteristics make up the target population for a new product her company intends to launch. The company's team of market researchers check the viability of this new product by eliciting the opinions of the target population as specified by the director.\",\"Specific members of a population are sampled because of their known honesty and integrity.\",\"This form of sampling can provide a coherent and focussed sample by asking people with experience and relevant knowledge to provide their opinions.\",\"With this form of sampling, the researcher decides what he or she constitutes a representative sample.\"]", "name": "d", "description": ""}, "ch1": {"group": "Ungrouped variables", "templateType": "anything", "definition": "switch(chlist[0]=0,random(a),chlist[0]=1,random(b),chlist[0]=2,random(c),random(d))", "name": "ch1", "description": ""}, "ch2": {"group": "Ungrouped variables", "templateType": "anything", "definition": "switch(chlist[1]=0,random(a except ch1),chlist[1]=1,random(b except ch1),chlist[1]=2,random(c except ch1),random(d except ch1))", "name": "ch2", "description": ""}, "a": {"group": "Ungrouped variables", "templateType": "anything", "definition": "[\"One hundred small businesses in Newcastle are placed in alphabetical order and then numbered 1-100. The random number generator is then used to select twenty of these businesses.\",\"Under this form of sampling, if there are five hundred elements in the population, each element has a one-in-five hundred chance of being selected. \",\"One advantage of this form of sampling is that every element in the population has an equal chance of being selected.\",\"We are interested in the employment status of 25-40 year olds in South Tyneside. The names of all such people are obtained from the electoral roll and put into a hat; one hundred of these are then selected without replacement.\",\"One of six branches of a large retail outlet is to be selected for an audit. Each outlet is assigned a number from one to six, and then a fair, six-sided die is rolled to select the branch which will be audited.\"]", "name": "a", "description": ""}, "chlist": {"group": "Ungrouped variables", "templateType": "anything", "definition": "repeat(random(0,1,2,3),3)", "name": "chlist", "description": ""}, "c": {"group": "Ungrouped variables", "templateType": "anything", "definition": "[\"The first item to be checked for faults on a production line is chosen at random, thereafter, every 100th item is checked.\",\"A credit card company wants to investigate the spending habits if its customers. From its lists, the first customer is selected at random; thereafter, every 25th customer is selected.\",\"In an inquiry on heating costs, we decide to sample every 4th house on the street.\",\"To sample 1% of its target population, consisting of 5000 members, a market research company chooses the first member at random; after that, every 100th member is also selected.\",\"This form of sampling could produce an unrepresentative sample because of patterns in the sampling frame.\"]", "name": "c", "description": ""}}, "ungrouped_variables": ["a", "c", "b", "d", "chlist", "ch1", "ch2", "ch3", "w", "v"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "functions": {}, "variable_groups": [], "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "\n

Answer the following questions on the sampling methods used in these situations.

\n

 

\n ", "tags": ["ACE2013", "checked2015"], "rulesets": {}, "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "", "licence": "Creative Commons Attribution 4.0 International", "description": "

Deciding whether or not three sampling methods are simple random sampling, stratified sampling, systematic or judgemental sampling. 

"}, "advice": "", "showQuestionGroupNames": false}, {"name": "Classify sampling methods", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "variable_groups": [], "variables": {"w": {"group": "Ungrouped variables", "templateType": "anything", "definition": "map(switch(chlist[x]=0,[1,-1,-1,-1],chlist[x]=1,[-1,1,-1,-1],chlist[x]=2,[-1,-1,1,-1],[-1,-1,-1,1]),x,0..2)", "name": "w", "description": ""}, "ch3": {"group": "Ungrouped variables", "templateType": "anything", "definition": "switch(chlist[2]=0,random(a except [ch1,ch2]),chlist[2]=1,random(b except [ch1,ch2]),chlist[2]=2,random(c except [ch1,ch2]),random(d except [ch1,ch2]))", "name": "ch3", "description": ""}, "v": {"group": "Ungrouped variables", "templateType": "anything", "definition": "map(switch(chlist[x]=0,[1,-1,-1],chlist[x]=1,[1,-1,-1],chlist[x]=2,[-1,1,-1],[-1,-1,1]),x,0..2)", "name": "v", "description": ""}, "b": {"group": "Ungrouped variables", "templateType": "anything", "definition": "[\"A local bus company is planning a new route to serve four housing estates. Random samples of households are taken from each estate and sample members are asked to rate on a scale of 1 (strongly opposed) to 5 (strongly in favour) their reaction to the proposed service.\",\"A company has three divisions, and auditors are attempting to estimate the total amounts of the company's accounts receivable. Simple random samples of these accounts were taken for each of the three divisions.\",\"A company has three divisions, and auditors are attempting to estimate the total amounts of the company's accounts receivable. Simple random samples of these accounts were taken for each of the three divisions.\",\"This form of sampling reflects the major groupings within a population.\"]", "name": "b", "description": ""}, "c": {"group": "Ungrouped variables", "templateType": "anything", "definition": "[\"The first item to be checked for faults on a production line is chosen at random, thereafter, every 100th item is checked.\",\"A credit card company wants to investigate the spending habits if its customers. From its lists, the first customer is selected at random; thereafter, every 25th customer is selected.\",\"In an inquiry on heating costs, we decide to sample every 4th house on the street.\",\"To sample 1% of its target population, consisting of 5000 members, a market research company chooses the first member at random; after that, every 100th member is also selected.\",\"This form of sampling could produce an unrepresentative sample because of patterns in the sampling frame.\"]", "name": "c", "description": ""}, "ch2": {"group": "Ungrouped variables", "templateType": "anything", "definition": "switch(chlist[1]=0,random(a except ch1),chlist[1]=1,random(b except ch1),chlist[1]=2,random(c except ch1),random(d except ch1))", "name": "ch2", "description": ""}, "a": {"group": "Ungrouped variables", "templateType": "anything", "definition": "[\"One hundred small businesses in Newcastle are placed in alphabetical order and then numbered 1-100. The random number generator is then used to select twenty of these businesses.\",\"Under this form of sampling, if there are five hundred elements in the population, each element has a one-in-five hundred chance of being selected. \",\"One advantage of this form of sampling is that every element in the population has an equal chance of being selected.\",\"We are interested in the employment status of 25-40 year olds in South Tyneside. The names of all such people are obtained from the electoral roll and put into a hat; one hundred of these are then selected without replacement.\",\"One of six branches of a large retail outlet is to be selected for an audit. Each outlet is assigned a number from one to six, and then a fair, six-sided die is rolled to select the branch which will be audited.\"]", "name": "a", "description": ""}, "d": {"group": "Ungrouped variables", "templateType": "anything", "definition": "[\"A company director believes she knows what characteristics make up the target population for a new product her company intends to launch. The company's team of market researchers check the viability of this new product by eliciting the opinions of the target population as specified by the director.\",\"Specific members of a population are sampled because of their known honesty and integrity.\",\"This form of sampling can provide a coherent and focussed sample by asking people with experience and relevant knowledge to provide their opinions.\",\"With this form of sampling, the researcher decides what he or she constitutes a representative sample.\"]", "name": "d", "description": ""}, "ch1": {"group": "Ungrouped variables", "templateType": "anything", "definition": "switch(chlist[0]=0,random(a),chlist[0]=1,random(b),chlist[0]=2,random(c),random(d))", "name": "ch1", "description": ""}, "chlist": {"group": "Ungrouped variables", "templateType": "anything", "definition": "repeat(random(0,1,2,3),3)", "name": "chlist", "description": ""}}, "ungrouped_variables": ["a", "c", "b", "d", "chlist", "ch1", "ch2", "ch3", "w", "v"], "rulesets": {}, "showQuestionGroupNames": false, "functions": {}, "parts": [{"displayType": "radiogroup", "layout": {"type": "all", "expression": ""}, "choices": ["{ch1}", "{ch2}", "{ch3}"], "matrix": "w", "prompt": "

Identify each of the following scenarios as one of the following:

\n\n

Note that you will lose 1 mark for every incorrect answer, however the minimum mark for this part of the question is 0.

\n

 

", "type": "m_n_x", "maxAnswers": 0, "shuffleChoices": false, "marks": 0, "scripts": {}, "maxMarks": 0, "minAnswers": 0, "minMarks": 0, "shuffleAnswers": false, "showCorrectAnswer": true, "answers": ["Simple Random Sampling", "Stratified Sampling", "Systematic Sampling", "Judgemental Sampling"], "warningType": "none"}, {"layout": {"expression": ""}, "choices": ["{ch1}", "{ch2}", "{ch3}"], "matrix": "v", "prompt": "

For each choice, state whether the form of the sampling described is random, quasi-random or non-random.

\n

As before, you will lose 1 mark for every incorrect answer, however the minimum mark for this part of the question is 0.

", "type": "m_n_x", "maxAnswers": 0, "shuffleChoices": false, "marks": 0, "scripts": {}, "maxMarks": 0, "minAnswers": 0, "minMarks": 0, "shuffleAnswers": true, "showCorrectAnswer": true, "answers": ["Random", "Quasi-Random", "Non-random"]}], "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "

Answer the following questions on the sampling methods used in these situations.

\n

 

", "tags": ["checked2015", "MAS1403"], "question_groups": [{"pickingStrategy": "all-ordered", "questions": [], "name": "", "pickQuestions": 0}], "preamble": {"css": "", "js": ""}, "type": "question", "metadata": {"notes": "", "licence": "Creative Commons Attribution 4.0 International", "description": "

Deciding whether or not  three sampling methods are simple random sampling, stratified sampling, systematic or judgemental sampling. Also whether or not the method of selection is random, quasi-random or non-random.

"}, "advice": ""}, {"name": "Linear regression - CO2 concentration", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "contributors": [{"name": "Mario Orsi", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/427/"}, {"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}], "tags": [], "metadata": {"description": "

Find a regression equation.

", "licence": "Creative Commons Attribution-ShareAlike 4.0 International"}, "statement": "

Average atmospheric levels of CO$_2$ in the 2000s (x) and 2010s (y) decades were recorded for ten locations (A-J) as reported in this table (in ppm units):

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Locationxy
{obj[0]}{r1[0]}{r2[0]}
{obj[1]}{r1[1]}{r2[1]}
{obj[2]}{r1[2]}{r2[2]}
{obj[3]}{r1[3]}{r2[3]}
{obj[4]}{r1[4]}{r2[4]}
{obj[5]}{r1[5]}{r2[5]}
{obj[6]}{r1[6]}{r2[6]}
{obj[7]}{r1[7]}{r2[7]}
{obj[8]}{r1[8]}{r2[8]}
{obj[9]}{r1[9]}{r2[9]}
", "advice": "

Part a):

\n

Excel:

\n\n

Minitab:

\n\n

\n

For part b and c, as well as generally for the underlying theory of linear correlation and regression, check your learning material (e.g., Chapter 8 in OpenIntro Statistics).

\n

", "rulesets": {"std": ["all", "fractionNumbers", "!collectNumbers", "!noLeadingMinus"]}, "variables": {"tol": {"name": "tol", "group": "Ungrouped variables", "definition": "0.05", "description": "", "templateType": "anything"}, "r1": {"name": "r1", "group": "Ungrouped variables", "definition": "repeat(round(normalsample(380,9)),10)", "description": "", "templateType": "anything"}, "spxy": {"name": "spxy", "group": "Ungrouped variables", "definition": "sxy-t[0]*t[1]/n", "description": "", "templateType": "anything"}, "b0": {"name": "b0", "group": "Ungrouped variables", "definition": "siground(1/n*(t[1]-spxy/ss[0]*t[0]),3)", "description": "", "templateType": "anything"}, "ssq": {"name": "ssq", "group": "Ungrouped variables", "definition": "[sum(map(x^2,x,r1)),sum(map(x^2,x,r2))]", "description": "", "templateType": "anything"}, "sc": {"name": "sc", "group": "Ungrouped variables", "definition": "r1[ch]", "description": "", "templateType": "anything"}, "ch": {"name": "ch", "group": "Ungrouped variables", "definition": "random(0..9)", "description": "", "templateType": "anything"}, "b": {"name": "b", "group": "Ungrouped variables", "definition": "random(1.01..1.09#0.01)", "description": "", "templateType": "anything"}, "t": {"name": "t", "group": "Ungrouped variables", "definition": "[sum(r1),sum(r2)]", "description": "", "templateType": "anything"}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "random(10..20)", "description": "", "templateType": "anything"}, "sxy": {"name": "sxy", "group": "Ungrouped variables", "definition": "sum(map(r1[x]*r2[x],x,0..n-1))", "description": "", "templateType": "anything"}, "ss": {"name": "ss", "group": "Ungrouped variables", "definition": "[ssq[0]-t[0]^2/n,ssq[1]-t[1]^2/n]", "description": "", "templateType": "anything"}, "n": {"name": "n", "group": "Ungrouped variables", "definition": "10", "description": "", "templateType": "anything"}, "obj": {"name": "obj", "group": "Ungrouped variables", "definition": "['A','B','C','D','E','F','G','H','I','J']", "description": "", "templateType": "anything"}, "r2": {"name": "r2", "group": "Ungrouped variables", "definition": "map(round(a+b*x+random(-9..9)),x,r1)", "description": "", "templateType": "anything"}, "b1": {"name": "b1", "group": "Ungrouped variables", "definition": "siground(spxy/ss[0],3)", "description": "", "templateType": "anything"}, "ls": {"name": "ls", "group": "Ungrouped variables", "definition": "siground(b0+b1*sc,3)", "description": "", "templateType": "anything"}, "res": {"name": "res", "group": "Ungrouped variables", "definition": "map(siground(r2[x]-(b0+b1*r1[x]),3),x,0..n-1)", "description": "", "templateType": "anything"}, "tsqovern": {"name": "tsqovern", "group": "Ungrouped variables", "definition": "[t[0]^2/n,t[1]^2/n]", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["tsqovern", "b0", "b1", "obj", "r1", "r2", "ss", "res", "ssq", "n", "a", "ch", "spxy", "ls", "tol", "t", "sc", "sxy", "b"], "variable_groups": [], "functions": {"pstdev": {"parameters": [["l", "list"]], "type": "number", "language": "jme", "definition": "sqrt(abs(l)/(abs(l)-1))*stdev(l)"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Use a spreadsheet or stats software to obtain the regression model $y = b_0 + b_1 \\times x$: 

\n

$b_0=\\;$[[0]]ppm     

\n

$b_1=\\;$[[1]] 

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": "2.5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "b0*(1-tol)", "maxValue": "b0*(1+tol)", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"type": "numberentry", "useCustomName": false, "customName": "", "marks": "2.5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "b1*(1-tol)", "maxValue": "b1*(1+tol)", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Using the model obtained above, calculate the predicted 2010s concentration for location $\\var{obj[ch]}$:

\n

$CO_2^{\\,2010\\text{s}}=$ [[0]]ppm

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": "2.5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [{"variable": "b0", "part": "p0g0", "must_go_first": false}, {"variable": "b1", "part": "p0g1", "must_go_first": false}], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": "0.5", "exploreObjective": null, "minValue": "ls*(1-tol)", "maxValue": "ls*(1+tol)", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Calculate $e_\\var{obj[ch]}$ (the residual for location $\\var{obj[ch]}$):

\n

$e_\\var{obj[ch]}=$[[0]]ppm

", "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": "2.5", "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [{"variable": "b0", "part": "p0g0", "must_go_first": false}, {"variable": "b1", "part": "p0g1", "must_go_first": false}], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": "0", "exploreObjective": null, "minValue": "res[ch]-1", "maxValue": "res[ch]+1", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always"}]}], "navigation": {"allowregen": true, "reverse": true, "browse": false, "allowsteps": true, "showfrontpage": true, "showresultspage": "never", "onleave": {"action": "warnifunattempted", "message": "

Warning, You have not attempted this question.

"}, "preventleave": true, "startpassword": ""}, "timing": {"allowPause": false, "timeout": {"action": "none", "message": ""}, "timedwarning": {"action": "warn", "message": "

5 miutes left

"}}, "feedback": {"showactualmark": false, "showtotalmark": false, "showanswerstate": false, "allowrevealanswer": false, "advicethreshold": 0, "intro": "", "feedbackmessages": []}, "contributors": [{"name": "cormac murphy", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/26/"}], "extensions": ["random_person", "stats"], "custom_part_types": [{"source": {"pk": 2, "author": {"name": "Christian Lawson-Perfect", "pk": 7}, "edit_page": "/part_type/2/edit"}, "name": "List of numbers", "short_name": "list-of-numbers", "description": "

The answer is a comma-separated list of numbers.

\n

The list is marked correct if each number occurs the same number of times as in the expected answer, and no extra numbers are present.

\n

You can optionally treat the answer as a set, so the number of occurrences doesn't matter, only whether each number is included or not.

", "help_url": "", "input_widget": "string", "input_options": {"correctAnswer": "join(\n if(settings[\"correctAnswerFractions\"],\n map(let([a,b],rational_approximation(x), string(a/b)),x,settings[\"correctAnswer\"])\n ,\n settings[\"correctAnswer\"]\n ),\n settings[\"separator\"] + \" \"\n)", "hint": {"static": false, "value": "if(settings[\"show_input_hint\"],\n \"Enter a list of numbers separated by {settings['separator']}.\",\n \"\"\n)"}, "allowEmpty": {"static": true, "value": true}}, "can_be_gap": true, "can_be_step": true, "marking_script": "bits:\nlet(b,filter(x<>\"\",x,split(studentAnswer,settings[\"separator\"])),\n if(isSet,list(set(b)),b)\n)\n\nexpected_numbers:\nlet(l,settings[\"correctAnswer\"] as \"list\",\n if(isSet,list(set(l)),l)\n)\n\nvalid_numbers:\nif(all(map(not isnan(x),x,interpreted_answer)),\n true,\n let(index,filter(isnan(interpreted_answer[x]),x,0..len(interpreted_answer)-1)[0], wrong, bits[index],\n warn(wrong+\" is not a valid number\");\n fail(wrong+\" is not a valid number.\")\n )\n )\n\nis_sorted:\nassert(sort(interpreted_answer)=interpreted_answer,\n multiply_credit(0.5,\"Not in order\")\n )\n\nincluded:\nmap(\n let(\n num_student,len(filter(x=y,y,interpreted_answer)),\n num_expected,len(filter(x=y,y,expected_numbers)),\n switch(\n num_student=num_expected,\n true,\n num_studentThe separate items in the student's answer

", "definition": "let(b,filter(x<>\"\",x,split(studentAnswer,settings[\"separator\"])),\n if(isSet,list(set(b)),b)\n)"}, {"name": "expected_numbers", "description": "", "definition": "let(l,settings[\"correctAnswer\"] as \"list\",\n if(isSet,list(set(l)),l)\n)"}, {"name": "valid_numbers", "description": "

Is every number in the student's list valid?

", "definition": "if(all(map(not isnan(x),x,interpreted_answer)),\n true,\n let(index,filter(isnan(interpreted_answer[x]),x,0..len(interpreted_answer)-1)[0], wrong, bits[index],\n warn(wrong+\" is not a valid number\");\n fail(wrong+\" is not a valid number.\")\n )\n )"}, {"name": "is_sorted", "description": "

Are the student's answers in ascending order?

", "definition": "assert(sort(interpreted_answer)=interpreted_answer,\n multiply_credit(0.5,\"Not in order\")\n )"}, {"name": "included", "description": "

Is each number in the expected answer present in the student's list the correct number of times?

", "definition": "map(\n let(\n num_student,len(filter(x=y,y,interpreted_answer)),\n num_expected,len(filter(x=y,y,expected_numbers)),\n switch(\n num_student=num_expected,\n true,\n num_studentHas every number been included the right number of times?

", "definition": "all(included)"}, {"name": "no_extras", "description": "

True if the student's list doesn't contain any numbers that aren't in the expected answer.

", "definition": "if(all(map(x in expected_numbers, x, interpreted_answer)),\n true\n ,\n incorrect(\"Your answer contains \"+extra_numbers[0]+\" but should not.\");\n false\n )"}, {"name": "interpreted_answer", "description": "A value representing the student's answer to this part.", "definition": "if(lower(studentAnswer) in [\"empty\",\"\u2205\"],[],\n map(\n if(settings[\"allowFractions\"],parsenumber_or_fraction(x,notationStyles), parsenumber(x,notationStyles))\n ,x\n ,bits\n )\n)"}, {"name": "mark", "description": "This is the main marking note. It should award credit and provide feedback based on the student's answer.", "definition": "if(studentanswer=\"\",fail(\"You have not entered an answer\"),false);\napply(valid_numbers);\napply(included);\napply(no_extras);\ncorrectif(all_included and no_extras)"}, {"name": "notationStyles", "description": "", "definition": "[\"en\"]"}, {"name": "isSet", "description": "

Should the answer be considered as a set, so the number of times an element occurs doesn't matter?

", "definition": "settings[\"isSet\"]"}, {"name": "extra_numbers", "description": "

Numbers included in the student's answer that are not in the expected list.

", "definition": "filter(not (x in expected_numbers),x,interpreted_answer)"}], "settings": [{"name": "correctAnswer", "label": "Correct answer", "help_url": "", "hint": "The list of numbers that the student should enter. The order does not matter.", "input_type": "code", "default_value": "", "evaluate": true}, {"name": "allowFractions", "label": "Allow the student to enter fractions?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": false}, {"name": "correctAnswerFractions", "label": "Display the correct answers as fractions?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": false}, {"name": "isSet", "label": "Is the answer a set?", "help_url": "", "hint": "If ticked, the number of times an element occurs doesn't matter, only whether it's included at all.", "input_type": "checkbox", "default_value": false}, {"name": "show_input_hint", "label": "Show the input hint?", "help_url": "", "hint": "", "input_type": "checkbox", "default_value": true}, {"name": "separator", "label": "Separator", "help_url": "", "hint": "The substring that should separate items in the student's list", "input_type": "string", "default_value": ",", "subvars": false}], "public_availability": "always", "published": true, "extensions": []}], "resources": [["question-resources/dice.svg", "/srv/numbas/media/question-resources/dice.svg"]]}