// Numbas version: exam_results_page_options {"name": "Set Operations", "extensions": [], "custom_part_types": [], "resources": [["question-resources/384px-Venn0111.svg.png", "/srv/numbas/media/question-resources/384px-Venn0111.svg.png"], ["question-resources/384px-Venn0001.svg.png", "/srv/numbas/media/question-resources/384px-Venn0001.svg.png"], ["question-resources/384px-Venn0110.svg.png", "/srv/numbas/media/question-resources/384px-Venn0110.svg.png"], ["question-resources/240px-Venn0100.svg.png", "/srv/numbas/media/question-resources/240px-Venn0100.svg.png"]], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Set Operations", "tags": [], "metadata": {"description": "
Simple exercises introducing the fundamental set operations, and NUMBAS syntax for sets.
", "licence": "Creative Commons Attribution-ShareAlike 4.0 International"}, "statement": "Consider the sets $A = \\var{A}$ and $B = \\var{B}$. Find the union, intersection, and set differences below. Use the NUMBAS syntax set(1,2,3)
for $\\left\\{1,2,3\\right\\}$.
The union of two sets is the set of elements from either set
\n$ A \\cup B = \\left\\{ x\\, |\\, x \\in A \\text{ or } x \\in B\\right\\}$
\nWe can think of this as the elements: in $A$ OR in $B$ OR in Both
\nThe intersection of two sets is the set of elements common to both sets
\n$ A \\cap B = \\left\\{ x\\, |\\, x \\in A \\text{ and } x \\in B\\right\\}$
\nWe can think of this as the elements: in $A$ AND in $B$
\nThe difference $A-B$ is the set of elements from $A$ which are not in $B$:
\n$ A - B = \\left\\{ x \\in A |\\, x \\notin B\\right\\}$
\nWe can think of this as the elements: in $A$ but NOT in $B$
\nSimilarly, the difference $B-A$ is the set of elements from $B$ which are not in $A$:
\n$ B - A = \\left\\{ x \\in B |\\, x \\notin A\\right\\}$
\nWe can think of this as the elements: in $B$ but NOT in $A$
\nThe symmetric difference $A \\Delta B$ is the union of the set differences, but it can also be expressed as the union minus the intersection
\n$ A \\Delta B = (A \\cup B) - (A \\cap B)$.
\nWe can think of this as the elements: in $A$ OR in $B$ but NOT in Both.
", "rulesets": {}, "extensions": [], "variables": {"listB": {"name": "listB", "group": "Ungrouped variables", "definition": "repeat(random(0..4),4)", "description": "", "templateType": "anything"}, "B": {"name": "B", "group": "Ungrouped variables", "definition": "union(set(listB),set(listN))", "description": "", "templateType": "anything"}, "A": {"name": "A", "group": "Ungrouped variables", "definition": "union(set(listA),set(listN))", "description": "", "templateType": "anything"}, "listN": {"name": "listN", "group": "Ungrouped variables", "definition": "repeat(random(1..9),2)", "description": "", "templateType": "anything"}, "listA": {"name": "listA", "group": "Ungrouped variables", "definition": "repeat(random(5..9),4)", "description": "", "templateType": "anything"}}, "variablesTest": {"condition": "not(listA = listB)", "maxRuns": 100}, "ungrouped_variables": ["listA", "listB", "A", "B", "listN"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {"validate": {"script": "try {\n var tree = Numbas.jme.compile(this.studentAnswer);\n var type = Numbas.jme.evaluate(tree,this.question.scope).type;\n \n if ('set' != type) { \n this.giveWarning(\"Your answer must be a set. Use the syntax set(1,2,3) for the set $\\\\left\\\\{1,2,3\\\\right\\\\}$\");\n return false;\n }\n \n return true;\n}\ncatch(e) {\n this.markingComment(e);\n return false;\n}", "order": "instead"}}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "What is the union $A \\cup B$?
", "answer": "{union(A,B)}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "valuegenerators": []}, {"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {"validate": {"script": "try {\n var tree = Numbas.jme.compile(this.studentAnswer);\n var type = Numbas.jme.evaluate(tree,this.question.scope).type;\n \n if ('set' != type) { \n this.giveWarning(\"Your answer must be a set. Use the syntax set(1,2,3) for the set $\\\\left\\\\{1,2,3\\\\right\\\\}$\");\n return false;\n }\n \n return true;\n}\ncatch(e) {\n this.markingComment(e);\n return false;\n}", "order": "instead"}}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "What is the intersection $A \\cap B$?
", "answer": "{intersection(A,B)}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "valuegenerators": []}, {"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {"validate": {"script": "try {\n var tree = Numbas.jme.compile(this.studentAnswer);\n var type = Numbas.jme.evaluate(tree,this.question.scope).type;\n \n if ('set' != type) { \n this.giveWarning(\"Your answer must be a set. Use the syntax set(1,2,3) for the set $\\\\left\\\\{1,2,3\\\\right\\\\}$\");\n return false;\n }\n \n return true;\n}\ncatch(e) {\n this.markingComment(e);\n return false;\n}", "order": "instead"}}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "What is $A\\setminus B$, the set of elements from $A$ which are not in $B$?
", "answer": "{A-B}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "valuegenerators": []}, {"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {"validate": {"script": "try {\n var tree = Numbas.jme.compile(this.studentAnswer);\n var type = Numbas.jme.evaluate(tree,this.question.scope).type;\n \n if ('set' != type) { \n this.giveWarning(\"Your answer must be a set. Use the syntax set(1,2,3) for the set $\\\\left\\\\{1,2,3\\\\right\\\\}$\");\n return false;\n }\n \n return true;\n}\ncatch(e) {\n this.markingComment(e);\n return false;\n}", "order": "instead"}}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "What is $B\\setminus A$, the set of elements from $B$ which are not in $A$?
", "answer": "{B-A}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "valuegenerators": []}, {"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {"validate": {"script": "try {\n var tree = Numbas.jme.compile(this.studentAnswer);\n var type = Numbas.jme.evaluate(tree,this.question.scope).type;\n \n if ('set' != type) { \n this.giveWarning(\"Your answer must be a set. Use the syntax set(1,2,3) for the set $\\\\left\\\\{1,2,3\\\\right\\\\}$\");\n return false;\n }\n \n return true;\n}\ncatch(e) {\n this.markingComment(e);\n return false;\n}", "order": "instead"}}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "What is union of the set differences $(A\\setminus B)\\cup(B\\setminus A)$? This is also called the symmetric difference $A\\Delta B$.
", "answer": "{union(A-B,B-A)}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "valuegenerators": []}, {"type": "m_n_x", "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": "Match the mathematical expression with its Venn diagram.
\n", "minMarks": 0, "maxMarks": "1", "minAnswers": 0, "maxAnswers": 0, "shuffleChoices": true, "shuffleAnswers": true, "displayType": "radiogroup", "warningType": "none", "showCellAnswerState": true, "choices": ["$A\\cup B$
", "$A \\cap B$
", "$A \\Delta B$
", "$A \\setminus B$
"], "matrix": [["0.25", 0, 0, 0], [0, "0.25", 0, 0], [0, 0, "0.25", 0], [0, 0, 0, "0.25"]], "layout": {"type": "all", "expression": ""}, "answers": ["", "", "", ""]}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Daniel Mansfield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/743/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}, {"name": "Alexander Corner", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5328/"}]}]}], "contributors": [{"name": "Daniel Mansfield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/743/"}, {"name": "Simon Thomas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3148/"}, {"name": "Alexander Corner", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/5328/"}]}