// Numbas version: finer_feedback_settings {"name": "Lois's copy of set5 - Cartesian Products", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"advice": "

a)

\n

$A \\times B$ is the set of all pairs $(a,b)$, where $a \\in A$ and $b \\in B$.

\n

b)

\n

$B \\cap D$ is the set of all elements present in both $B$ and $D$, i.e. $\\var{set2 and set5}$.

\n

$A \\cap C$ is the set of all elements present in both $A$ and $C$, i.e. $\\var{set1 and set4}$.

\n

$(B\\cap D)\\times (A\\cap C)$ is the set of pairs of all pairs $(x,y)$, where $x \\in B \\cap D$ and $y \\in A \\cap C$.

\n

c)

\n

$(A\\cap C)\\times (A\\cap C)\\times (C\\cap D)$ is the set of all triples $(x,y,z)$, where $x \\in A \\cap C$, $y \\in A \\cap C$ and $z \\in C \\cap D$. Note that $x$ and $y$ do not have to be different.

\n

d)

\n

$A-C$ is the set of all elements present in $A$ but not in $C$, i.e. $\\var{set1-set4}$.

\n

$C-A$ is the set of all elements present in $C$ but not in $A$, i.e. $\\var{set4-set1}$.

\n

$(A-C) \\cup (C-A)$ is the set of all elements which are either in $A-C$, or in  $C-A$, so $(A-C) \\cup (C-A) = \\var{(set1-set4) or (set4-set1)}$.

\n

e)

\n

$(A \\times D)$ is the set of all pairs of elements $(a,d)$, with $a \\in A$ and $d \\in D$, i.e. $\\var{set(product(list(set1),list(set5)))}$.

\n

$C \\times B)$ is the set of all pairs of elements $(c,b)$, with $c \\in C$ and $b \\in B$, i.e. $\\var{set(product(list(set4),list(set2)))}$.

\n

$(A \\times D) \\cap (C \\times B)$ is the set of all pairs present in both of the previous sets.

\n

f)

\n

$C \\cap D$ is the set of all elements in both $C$ and in $D$, so $C \\cap D = \\var{(set4 and set5)}$.

\n

$C - D$ is the set of all elements in $C$ and not in $D$, so $C-D = \\var {(set4 - set5)}$.

\n

$(C \\cap D) \\times (C - D)$ is the set of all pairs of elements $(x,y)$, where $x$ is in $C \\cap D$ and $y$ is in $C - D$, so $(C \\cap D) \\times (C-D) = \\var{set(product(list(set4 and set5),list(set4 - set5)))}$.

\n

Similarly, $(D - C) \\times (C \\cap D) = \\var{set(product(list(set5-set4),list(set4 and set5)))}$.

\n

Finally, $[(C \\cap D) \\times (C - D)] \\cup [(D - C) \\times (C \\cap D)]$ is the set of all pairs present in either of the above sets, i.e. $\\var{set16}$.

", "metadata": {"description": "", "licence": "Creative Commons Attribution 4.0 International"}, "tags": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "name": "Lois's copy of set5 - Cartesian Products", "statement": "

Let $A=\\var{set1}$,  let  $B=\\var{set2}$, let  $C=\\var{set4}$ and let $D=\\var{set5}$.

\n

List the elements of the following sets.

\n

Input sets in the form set(a,b,c,d) .

\n

For example set(1,2,3) gives the set $\\{1,2,3\\}$.

\n

Element $(a,b)$ of a Cartesian product is entered, and represented, as $[a,b]$.

\n

For example set([1,1],[1,2],[2,3])gives the set $\\{[1,1], [1,2], [2,3]\\}$.

\n

The empty set is input as set().

", "functions": {"mod_set": {"type": "list", "parameters": [["a", "number"], ["b", "number"], ["c", "number"]], "language": "javascript", "definition": "//returns all integers which are divisible by c betweeen a and b\nvar l=[];\nfor(var i=a;i$A \\times B=\\;$[[0]]

", "showCorrectAnswer": true, "scripts": {}, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0, "showFeedbackIcon": true}, {"gaps": [{"type": "jme", "showCorrectAnswer": true, "vsetrange": [0, 1], "variableReplacementStrategy": "originalfirst", "answer": "{set6}", "showFeedbackIcon": true, "checkingtype": "absdiff", "checkvariablenames": false, "checkingaccuracy": 0.001, "showpreview": true, "scripts": {}, "variableReplacements": [], "marks": 1, "expectedvariablenames": [], "vsetrangepoints": 5}], "type": "gapfill", "prompt": "

$(B\\cap D)\\times (A\\cap C)=\\;$[[0]]

", "showCorrectAnswer": true, "scripts": {}, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0, "showFeedbackIcon": true}, {"gaps": [{"type": "jme", "showCorrectAnswer": true, "vsetrange": [0, 1], "variableReplacementStrategy": "originalfirst", "answer": "{set10}", "showFeedbackIcon": true, "checkingtype": "absdiff", "checkvariablenames": false, "checkingaccuracy": 0.001, "showpreview": true, "scripts": {}, "variableReplacements": [], "marks": 1, "expectedvariablenames": [], "vsetrangepoints": 5}], "type": "gapfill", "prompt": "

$(A\\cap C)\\times (A\\cap C)\\times (C\\cap D)=\\;$[[0]]

", "showCorrectAnswer": true, "scripts": {}, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0, "showFeedbackIcon": true}, {"gaps": [{"type": "jme", "showCorrectAnswer": true, "vsetrange": [0, 1], "variableReplacementStrategy": "originalfirst", "answer": "{set14}", "showFeedbackIcon": true, "checkingtype": "absdiff", "checkvariablenames": false, "checkingaccuracy": 0.001, "showpreview": true, "scripts": {}, "variableReplacements": [], "marks": 1, "expectedvariablenames": [], "vsetrangepoints": 5}], "type": "gapfill", "prompt": "

$[(A - C)\\cup (C-A)]\\times [(B-D)\\cup(D-B)]=\\;$[[0]]

", "showCorrectAnswer": true, "scripts": {}, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0, "showFeedbackIcon": true}, {"gaps": [{"type": "jme", "showCorrectAnswer": true, "vsetrange": [0, 1], "variableReplacementStrategy": "originalfirst", "answer": "{set15}", "showFeedbackIcon": true, "checkingtype": "absdiff", "checkvariablenames": false, "checkingaccuracy": 0.001, "showpreview": true, "scripts": {}, "variableReplacements": [], "marks": 1, "expectedvariablenames": [], "vsetrangepoints": 5}], "type": "gapfill", "prompt": "

$(A\\times D)\\cap (C\\times B)=\\;$[[0]]

", "showCorrectAnswer": true, "scripts": {}, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0, "showFeedbackIcon": true}, {"gaps": [{"type": "jme", "showCorrectAnswer": true, "vsetrange": [0, 1], "variableReplacementStrategy": "originalfirst", "answer": "{set16}", "showFeedbackIcon": true, "checkingtype": "absdiff", "checkvariablenames": false, "checkingaccuracy": 0.001, "showpreview": true, "scripts": {}, "variableReplacements": [], "marks": 1, "expectedvariablenames": [], "vsetrangepoints": 5}], "type": "gapfill", "prompt": "

$[(C\\cap D)\\times (C-D)]\\cup [(D-C)\\times (C\\cap D)]=\\;$[[0]]

", "showCorrectAnswer": true, "scripts": {}, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "marks": 0, "showFeedbackIcon": true}], "variables": {"set12": {"group": "Ungrouped variables", "definition": "union(set2-set5,set5-set2)", "name": "set12", "templateType": "anything", "description": ""}, "list10": {"group": "Lists", "definition": "map(list9[x][0]+list9[x][1],x,0..len(list9)-1)", "name": "list10", "templateType": "anything", "description": ""}, "set8": {"group": "Ungrouped variables", "definition": "intersection(set2,set5)", "name": "set8", "templateType": "anything", "description": ""}, "list5": {"group": "Lists", "definition": "shuffle(list2)[0..b-1]+list_extra", "name": "list5", "templateType": "anything", "description": ""}, "a": {"group": "Random numbers", "definition": "random(2..3)", "name": "a", "templateType": "anything", "description": ""}, "set5": {"group": "Ungrouped variables", "definition": "set(list5)", "name": "set5", "templateType": "anything", "description": ""}, "set14": {"group": "Ungrouped variables", "definition": "set(product(list(set11),list(set12)))", "name": "set14", "templateType": "anything", "description": ""}, "set16": {"group": "Ungrouped variables", "definition": "union(set(product(list(intersection(set4,set5)),list(set4-set5))),set(product(list(set5-set4),list(intersection(set4,set5)))))", "name": "set16", "templateType": "anything", "description": ""}, "set10": {"group": "Ungrouped variables", "definition": "set(list10)", "name": "set10", "templateType": "anything", "description": ""}, "set15": {"group": "Ungrouped variables", "definition": "intersection(set(product(list1,list5)),set(product(list4,list2)))", "name": "set15", "templateType": "anything", "description": ""}, "set4": {"group": "Ungrouped variables", "definition": "set(list4)", "name": "set4", "templateType": "anything", "description": ""}, "list9": {"group": "Lists", "definition": "product(product(list(set7),list(set7)),list(intersection(set4,set5)))", "name": "list9", "templateType": "anything", "description": ""}, "list2": {"group": "Lists", "definition": "shuffle(list(25..100#5))[0..b]", "name": "list2", "templateType": "anything", "description": ""}, "b": {"group": "Random numbers", "definition": "5-a", "name": "b", "templateType": "anything", "description": ""}, "list1": {"group": "Lists", "definition": "shuffle(list(1..20))[0..a]", "name": "list1", "templateType": "anything", "description": ""}, "set3": {"group": "Ungrouped variables", "definition": "set(product(list1,list2))", "name": "set3", "templateType": "anything", "description": ""}, "set2": {"group": "Ungrouped variables", "definition": "set(list2)", "name": "set2", "templateType": "anything", "description": ""}, "list4": {"group": "Lists", "definition": "shuffle(list1)[0..a-1]+list_extra", "name": "list4", "templateType": "anything", "description": ""}, "set7": {"group": "Ungrouped variables", "definition": "intersection(set1,set4)", "name": "set7", "templateType": "anything", "description": ""}, "set6": {"group": "Ungrouped variables", "definition": "set(product(list(set8),list(set7)))", "name": "set6", "templateType": "anything", "description": ""}, "set1": {"group": "Ungrouped variables", "definition": "set(list1)", "name": "set1", "templateType": "anything", "description": ""}, "set11": {"group": "Ungrouped variables", "definition": "union(set1-set4,set4-set1)", "name": "set11", "templateType": "anything", "description": ""}, "list_extra": {"group": "Lists", "definition": "[random(21..24)]", "name": "list_extra", "templateType": "anything", "description": ""}}, "extensions": [], "rulesets": {}, "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/"}]}