// Numbas version: exam_results_page_options {"name": "Coding Error Probabilities", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Coding Error Probabilities", "tags": [], "metadata": {"description": "

Short question in recognising errors in binary strings transmitted over a binary symmetric channel, as well as calculating probabilities of these errors occuring. Randomised 7-bit strings between 64 and 128, randomised probability between 0.05 and 0.1. Randomised error pattern.

", "licence": "None specified"}, "statement": "

Below you will be asked about the probabilities of making errors in the transmission of binary strings over a binary symmetric channel, where the probability of error is $p = \\var{prob}$.

\n

You transmit the 7-bit binary string $m = \\var{binstring}$ and your recipient receives the 7-bit binary string $r = \\var{recstring}$.

", "advice": "
    \n
  1. The message string was $\\var{binstring}$ and the received string was $\\var{recstring}$. The error pattern is another binary string where there is a 1 wherever the message string and received string differ: $\\var{errpattern}$
  2. \n
  3. The number of errors is the number of 1s in the error pattern. So in $\\var{errpattern}$ there are $\\var{numerr}$ errors.
  4. \n
  5. Since there are $\\var{numerr}$ errors in the received message, there are $\\simplify{7-{numerr}}$ correct positions. The probability is then calculated as $p^\\var{numerr}(1-p)^{(7-\\var{numerr})} = \\simplify{({prob}^{numerr})*(1-{prob})^(7-{numerr})}$.
  6. \n
  7. If there are $k$ errors, then the probability of exactly $k$ errors occuring in transmission is given by \\[\\binom{7}{k}p^k(1-p)^{7-k}.\\]
  8. \n
", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"binstring": {"name": "binstring", "group": "Ungrouped variables", "definition": "tobinary(random(64..127))", "description": "", "templateType": "anything", "can_override": false}, "recstring": {"name": "recstring", "group": "Ungrouped variables", "definition": "tobinary(random(64..127))", "description": "", "templateType": "anything", "can_override": false}, "bins": {"name": "bins", "group": "Ungrouped variables", "definition": "map(binstring[k],k,0..6)", "description": "", "templateType": "anything", "can_override": false}, "recs": {"name": "recs", "group": "Ungrouped variables", "definition": "map(recstring[k],k,0..6)", "description": "", "templateType": "anything", "can_override": false}, "errors": {"name": "errors", "group": "Ungrouped variables", "definition": "map(mod(dec(bins[k])+dec(recs[k]),2),k,0..6)", "description": "", "templateType": "anything", "can_override": false}, "errstrings": {"name": "errstrings", "group": "Ungrouped variables", "definition": "map(string(errors[k]),k,0..6)", "description": "", "templateType": "anything", "can_override": false}, "errpattern": {"name": "errpattern", "group": "Ungrouped variables", "definition": "errstrings[0] + errstrings[1]+ errstrings[2]+ errstrings[3]+ errstrings[4]+ errstrings[5] + errstrings[6]", "description": "", "templateType": "anything", "can_override": false}, "prob": {"name": "prob", "group": "Ungrouped variables", "definition": "random([0.05,0.06,0.07,0.08,0.09,0.1])", "description": "", "templateType": "anything", "can_override": false}, "numerr": {"name": "numerr", "group": "Ungrouped variables", "definition": "sum(errors)", "description": "", "templateType": "anything", "can_override": false}, "rand": {"name": "rand", "group": "Ungrouped variables", "definition": "random(1..3)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["binstring", "recstring", "bins", "recs", "errors", "errstrings", "errpattern", "prob", "numerr", "rand"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "patternmatch", "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": "

What is the error pattern?

", "answer": "{errpattern}", "displayAnswer": "{errpattern}", "matchMode": "regex"}, {"type": "patternmatch", "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": "

How many errors were made in transmission? I.e., what is the Hamming weight of the error pattern?

", "answer": "{numerr}", "displayAnswer": "{numerr}", "matchMode": "regex"}, {"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": "

What is the probability of receiving the string $r = \\var{recstring}$ instead of the transmitted string $m = \\var{binstring}$? Reminder: $p = \\var{prob}$.

", "minValue": "({prob}^{numerr})*(1-{prob})^(7-{numerr})", "maxValue": "({prob}^{numerr})*(1-{prob})^(7-{numerr})", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": false, "showPrecisionHint": 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, "prompt": "

What is the probability of making exactly $\\var{rand}$ errors when transmitting a 7-bit binary string on this channel?

", "minValue": "comb(7,{rand})*{prob}^{rand}*(1-{prob})^(7-{rand})", "maxValue": "comb(7,{rand})*{prob}^{rand}*(1-{prob})^(7-{rand})", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "precisionType": "dp", "precision": "3", "precisionPartialCredit": 0, "precisionMessage": "You have not given your answer to the correct precision.", "strictPrecision": true, "showPrecisionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Alexander Corner", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5328/"}]}]}], "contributors": [{"name": "Alexander Corner", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5328/"}]}