// Numbas version: exam_results_page_options {"name": "Lois'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": [{"preamble": {"css": "", "js": ""}, "variable_groups": [], "tags": [], "variablesTest": {"condition": "not(listA = listB)", "maxRuns": 100}, "variables": {"listB": {"description": "", "group": "Ungrouped variables", "definition": "repeat(random(0..4),4)", "name": "listB", "templateType": "anything"}, "listA": {"description": "", "group": "Ungrouped variables", "definition": "repeat(random(5..9),4)", "name": "listA", "templateType": "anything"}, "listN": {"description": "", "group": "Ungrouped variables", "definition": "repeat(random(1..9),2)", "name": "listN", "templateType": "anything"}, "B": {"description": "", "group": "Ungrouped variables", "definition": "union(set(listB),set(listN))", "name": "B", "templateType": "anything"}, "A": {"description": "", "group": "Ungrouped variables", "definition": "union(set(listA),set(listN))", "name": "A", "templateType": "anything"}}, "ungrouped_variables": ["listA", "listB", "A", "B", "listN"], "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)$.

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

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

"}, "statement": "

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

", "extensions": [], "rulesets": {}, "parts": [{"marks": 1, "type": "jme", "checkingtype": "absdiff", "showpreview": true, "showCorrectAnswer": true, "expectedvariablenames": [], "prompt": "

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

", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "checkvariablenames": false, "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}"}}, "answer": "{union(A,B)}", "vsetrangepoints": 5, "variableReplacements": [], "vsetrange": [0, 1], "checkingaccuracy": 0.001}, {"marks": 1, "type": "jme", "checkingtype": "absdiff", "showpreview": true, "showCorrectAnswer": true, "expectedvariablenames": [], "prompt": "

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

", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "checkvariablenames": false, "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}"}}, "answer": "{intersection(A,B)}", "vsetrangepoints": 5, "variableReplacements": [], "vsetrange": [0, 1], "checkingaccuracy": 0.001}, {"marks": 1, "type": "jme", "checkingtype": "absdiff", "showpreview": true, "showCorrectAnswer": true, "expectedvariablenames": [], "prompt": "

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

", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "checkvariablenames": false, "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}"}}, "answer": "{A-B}", "vsetrangepoints": 5, "variableReplacements": [], "vsetrange": [0, 1], "checkingaccuracy": 0.001}, {"marks": 1, "type": "jme", "checkingtype": "absdiff", "showpreview": true, "showCorrectAnswer": true, "expectedvariablenames": [], "prompt": "

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

", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "checkvariablenames": false, "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}"}}, "answer": "{B-A}", "vsetrangepoints": 5, "variableReplacements": [], "vsetrange": [0, 1], "checkingaccuracy": 0.001}, {"marks": 1, "type": "jme", "checkingtype": "absdiff", "showpreview": true, "showCorrectAnswer": true, "expectedvariablenames": [], "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, "variableReplacementStrategy": "originalfirst", "checkvariablenames": false, "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}"}}, "answer": "{union(A-B,B-A)}", "vsetrangepoints": 5, "variableReplacements": [], "vsetrange": [0, 1], "checkingaccuracy": 0.001}, {"choices": ["

$A\\cup B$

", "

$A \\cap B$

", "

$A \\Delta B$

", "

$A - B$

"], "warningType": "none", "marks": 0, "type": "m_n_x", "shuffleChoices": true, "scripts": {}, "showCorrectAnswer": true, "displayType": "radiogroup", "matrix": [["0.25", 0, 0, 0], [0, "0.25", 0, 0], [0, 0, "0.25", 0], [0, 0, 0, "0.25"]], "prompt": "

Match the mathematical expression with its Venn diagram.

\n

", "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "maxMarks": "1", "layout": {"expression": "", "type": "all"}, "minMarks": 0, "variableReplacements": [], "minAnswers": 0, "answers": ["

", "

", "

", "

"], "maxAnswers": 0, "shuffleAnswers": true}], "name": "Lois's copy of Basic Set Theory: set operations", "functions": {}, "type": "question", "contributors": [{"name": "Lois Rollings", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/326/"}]}]}], "contributors": [{"name": "Lois Rollings", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/326/"}]}