// Numbas version: exam_results_page_options {"name": "Basic Set Theory: 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": [{"metadata": {"licence": "Creative Commons Attribution-ShareAlike 4.0 International", "description": "

Simple exercises introducing the fundamental set operations, and NUMBAS syntax for sets.

"}, "ungrouped_variables": ["listA", "listB", "A", "B", "listN"], "variablesTest": {"maxRuns": 100, "condition": "not(listA = listB)"}, "variable_groups": [], "functions": {}, "advice": "

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\\}$

\n
\n

The intersetction 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\\}$

\n
\n

The 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\\}$

\n
\n

Similarly, 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\\}$

\n
\n

The 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)$.

", "statement": "

Consider the sets $A = \\var{A}$ and $B = \\var{B}$. Find the union, intsersection and set differences below. Use the NUMBAS syntax set(1,2,3) for $\\left\\{1,2,3\\right\\}$.

", "parts": [{"checkingType": "absdiff", "vsetRangePoints": 5, "valuegenerators": [], "marks": 1, "customMarkingAlgorithm": "", "customName": "", "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "checkVariableNames": false, "useCustomName": false, "failureRate": 1, "scripts": {"validate": {"order": "instead", "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}"}}, "prompt": "

What is the union $A \\cup B$?

", "showFeedbackIcon": true, "checkingAccuracy": 0.001, "vsetRange": [0, 1], "unitTests": [], "showPreview": true, "type": "jme", "answer": "{union(A,B)}"}, {"checkingType": "absdiff", "vsetRangePoints": 5, "valuegenerators": [], "marks": 1, "customMarkingAlgorithm": "", "customName": "", "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "checkVariableNames": false, "useCustomName": false, "failureRate": 1, "scripts": {"validate": {"order": "instead", "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}"}}, "prompt": "

What is the intersection $A \\cap B$?

", "showFeedbackIcon": true, "checkingAccuracy": 0.001, "vsetRange": [0, 1], "unitTests": [], "showPreview": true, "type": "jme", "answer": "{intersection(A,B)}"}, {"checkingType": "absdiff", "vsetRangePoints": 5, "valuegenerators": [], "marks": 1, "customMarkingAlgorithm": "", "customName": "", "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "checkVariableNames": false, "useCustomName": false, "failureRate": 1, "scripts": {"validate": {"order": "instead", "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}"}}, "prompt": "

What is $A-B$, the set of elements from $A$ which are not in $B$?

", "showFeedbackIcon": true, "checkingAccuracy": 0.001, "vsetRange": [0, 1], "unitTests": [], "showPreview": true, "type": "jme", "answer": "{A-B}"}, {"checkingType": "absdiff", "vsetRangePoints": 5, "valuegenerators": [], "marks": 1, "customMarkingAlgorithm": "", "customName": "", "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "checkVariableNames": false, "useCustomName": false, "failureRate": 1, "scripts": {"validate": {"order": "instead", "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}"}}, "prompt": "

What is $B-A$, the set of elements from $B$ which are not in $A$?

", "showFeedbackIcon": true, "checkingAccuracy": 0.001, "vsetRange": [0, 1], "unitTests": [], "showPreview": true, "type": "jme", "answer": "{B-A}"}, {"checkingType": "absdiff", "vsetRangePoints": 5, "valuegenerators": [], "marks": 1, "customMarkingAlgorithm": "", "customName": "", "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "checkVariableNames": false, "useCustomName": false, "failureRate": 1, "scripts": {"validate": {"order": "instead", "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}"}}, "prompt": "

What is union of the set differences $(A-B)\\cup(B-A)$? This is also called the symmetric difference $A\\Delta B$.

", "showFeedbackIcon": true, "checkingAccuracy": 0.001, "vsetRange": [0, 1], "unitTests": [], "showPreview": true, "type": "jme", "answer": "{union(A-B,B-A)}"}, {"customMarkingAlgorithm": "", "marks": 0, "maxMarks": "1", "customName": "", "showCorrectAnswer": true, "matrix": [["0.25", 0, 0, 0], [0, "0.25", 0, 0], [0, 0, "0.25", 0], [0, 0, 0, "0.25"]], "shuffleAnswers": true, "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "minMarks": 0, "maxAnswers": 0, "showCellAnswerState": true, "variableReplacementStrategy": "originalfirst", "displayType": "radiogroup", "warningType": "none", "useCustomName": false, "layout": {"expression": "", "type": "all"}, "shuffleChoices": true, "scripts": {}, "prompt": "

Match the mathematical expression with its Venn diagram, where the left circle represents the set $A$ and the right circle represents $B$.

\n

", "showFeedbackIcon": true, "choices": ["

$A\\cup B$

", "

$A \\cap B$

", "

$A \\Delta B$

", "

$A - B$

"], "answers": ["

", "

", "

", "

"], "unitTests": [], "minAnswers": 0, "type": "m_n_x"}], "tags": [], "variables": {"listA": {"name": "listA", "definition": "repeat(random(5..9),4)", "templateType": "anything", "description": "", "group": "Ungrouped variables"}, "listN": {"name": "listN", "definition": "repeat(random(1..9),2)", "templateType": "anything", "description": "", "group": "Ungrouped variables"}, "listB": {"name": "listB", "definition": "repeat(random(0..4),4)", "templateType": "anything", "description": "", "group": "Ungrouped variables"}, "B": {"name": "B", "definition": "union(set(listB),set(listN))", "templateType": "anything", "description": "", "group": "Ungrouped variables"}, "A": {"name": "A", "definition": "union(set(listA),set(listN))", "templateType": "anything", "description": "", "group": "Ungrouped variables"}}, "name": "Basic Set Theory: set operations", "rulesets": {}, "preamble": {"css": "", "js": ""}, "extensions": [], "type": "question", "contributors": [{"name": "Daniel Mansfield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/743/"}, {"name": "Sean Gardiner", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2443/"}]}]}], "contributors": [{"name": "Daniel Mansfield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/743/"}, {"name": "Sean Gardiner", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2443/"}]}