// Numbas version: exam_results_page_options {"name": "Simon's copy of 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": [{"variables": {"listB": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "listB", "definition": "repeat(random(0..4),4)"}, "B": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "B", "definition": "union(set(listB),set(listN))"}, "A": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "A", "definition": "union(set(listA),set(listN))"}, "listN": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "listN", "definition": "repeat(random(1..9),2)"}, "listA": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "listA", "definition": "repeat(random(5..9),4)"}}, "rulesets": {}, "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

We can think of this as the elements:       in $A$  OR  in $B$  OR  in Both

\n
\n

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

\n

We can think of this as the elements:       in  $A$  AND  in  $B$ 

\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

We can think of this as the elements:       in  $A$  but  NOT  in  $B$

\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

We can think of this as the elements:       in  $B$  but  NOT  in  $A$

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

\n

We can think of this as the elements:       in $A$  OR  in  $B$  but  NOT  in Both.

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": "not(listA = listB)"}, "name": "Simon's copy of Basic Set Theory: set operations", "preamble": {"css": "", "js": ""}, "metadata": {"licence": "Creative Commons Attribution-ShareAlike 4.0 International", "description": "

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

"}, "parts": [{"showPreview": true, "expectedVariableNames": [], "variableReplacementStrategy": "originalfirst", "marks": 1, "type": "jme", "prompt": "

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

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

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

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

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

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

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

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

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

", "vsetRange": [0, 1], "failureRate": 1, "checkVariableNames": false, "vsetRangePoints": 5, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "unitTests": [], "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"}}, "answer": "{union(A-B,B-A)}", "variableReplacements": [], "showCorrectAnswer": true, "showFeedbackIcon": true}, {"choices": ["

$A\\cup B$

", "

$A \\cap B$

", "

$A \\Delta B$

", "

$A - B$

"], "showFeedbackIcon": true, "unitTests": [], "layout": {"expression": "", "type": "all"}, "maxAnswers": 0, "minAnswers": 0, "displayType": "radiogroup", "showCellAnswerState": true, "variableReplacements": [], "showCorrectAnswer": true, "minMarks": 0, "answers": ["

", "

", "

", "

"], "variableReplacementStrategy": "originalfirst", "type": "m_n_x", "marks": 0, "prompt": "

Match the mathematical expression with its Venn diagram.

\n

", "matrix": [["0.25", 0, 0, 0], [0, "0.25", 0, 0], [0, 0, "0.25", 0], [0, 0, 0, "0.25"]], "shuffleChoices": true, "warningType": "none", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "shuffleAnswers": true, "scripts": {}, "maxMarks": "1"}], "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\\}$.

", "ungrouped_variables": ["listA", "listB", "A", "B", "listN"], "tags": [], "extensions": [], "functions": {}, "type": "question", "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/"}]}]}], "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/"}]}