// Numbas version: finer_feedback_settings
{"name": "Blathnaid'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$.
\nb)
\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$.
\nc)
\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.
\nd)
\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)}$.
\ne)
\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.
\nf)
\n$C \\cap D$ is the set of all elements in both $C$ and in $D$, so $C \\cap D = \\var{set(set4 and set5)}$.
\n$C - D$ is the set of all elements in $C$ and not in $D$, so $C-D = \\var{set(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)))}$.
\nSimilarly, $(D - C) \\times (C \\cap D) = \\var{set(product(list(set5-set4),list(set4 and set5)))}$.
\nFinally, $[(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}$.
", "functions": {"mod_set": {"parameters": [["a", "number"], ["b", "number"], ["c", "number"]], "language": "javascript", "type": "list", "definition": "//returns all integers which are divisible by c betweeen a and b\nvar l=[];\nfor(var i=a;iLet $A=\\var{set1}$, let $B=\\var{set2}$, let $C=\\var{set4}$ and let $D=\\var{set5}$.\nList the elements of the following sets.
\nInput sets in the form set(a,b,c,d)
.
\nFor example set(1,2,3)
gives the set $\\{1,2,3\\}$.
\nElement $(a,b)$ of a Cartesian product is entered, and represented, as $[a,b]$.
\nFor example set([1,1],[1,2],[2,3])
gives the set $\\{[1,1], [1,2], [2,3]\\}$.
\nThe empty set is input as set()
.
", "variablesTest": {"condition": "", "maxRuns": 100}, "tags": [], "variables": {"list9": {"templateType": "anything", "group": "Lists", "definition": "product(product(list(set7),list(set7)),list(intersection(set4,set5)))", "name": "list9", "description": ""}, "list4": {"templateType": "anything", "group": "Lists", "definition": "shuffle(list1)[0..a-1]+list_extra", "name": "list4", "description": ""}, "list5": {"templateType": "anything", "group": "Lists", "definition": "shuffle(list2)[0..b-1]+list_extra", "name": "list5", "description": ""}, "set14": {"templateType": "anything", "group": "Ungrouped variables", "definition": "set(product(list(set11),list(set12)))", "name": "set14", "description": ""}, "set6": {"templateType": "anything", "group": "Ungrouped variables", "definition": "set(product(list(set8),list(set7)))", "name": "set6", "description": ""}, "set2": {"templateType": "anything", "group": "Ungrouped variables", "definition": "set(list2)", "name": "set2", "description": ""}, "set15": {"templateType": "anything", "group": "Ungrouped variables", "definition": "intersection(set(product(list1,list5)),set(product(list4,list2)))", "name": "set15", "description": ""}, "set5": {"templateType": "anything", "group": "Ungrouped variables", "definition": "set(list5)", "name": "set5", "description": ""}, "set1": {"templateType": "anything", "group": "Ungrouped variables", "definition": "set(list1)", "name": "set1", "description": ""}, "set10": {"templateType": "anything", "group": "Ungrouped variables", "definition": "set(list10)", "name": "set10", "description": ""}, "set3": {"templateType": "anything", "group": "Ungrouped variables", "definition": "set(product(list1,list2))", "name": "set3", "description": ""}, "list1": {"templateType": "anything", "group": "Lists", "definition": "shuffle(list(1..20))[0..a]", "name": "list1", "description": ""}, "set7": {"templateType": "anything", "group": "Ungrouped variables", "definition": "intersection(set1,set4)", "name": "set7", "description": ""}, "a": {"templateType": "anything", "group": "Random numbers", "definition": "random(2..3)", "name": "a", "description": ""}, "set8": {"templateType": "anything", "group": "Ungrouped variables", "definition": "intersection(set2,set5)", "name": "set8", "description": ""}, "set16": {"templateType": "anything", "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", "description": ""}, "list2": {"templateType": "anything", "group": "Lists", "definition": "shuffle(list(25..100#5))[0..b]", "name": "list2", "description": ""}, "set4": {"templateType": "anything", "group": "Ungrouped variables", "definition": "set(list4)", "name": "set4", "description": ""}, "list_extra": {"templateType": "anything", "group": "Lists", "definition": "[random(21..24)]", "name": "list_extra", "description": ""}, "b": {"templateType": "anything", "group": "Random numbers", "definition": "5-a", "name": "b", "description": ""}, "set12": {"templateType": "anything", "group": "Ungrouped variables", "definition": "union(set2-set5,set5-set2)", "name": "set12", "description": ""}, "set11": {"templateType": "anything", "group": "Ungrouped variables", "definition": "union(set1-set4,set4-set1)", "name": "set11", "description": ""}, "list10": {"templateType": "anything", "group": "Lists", "definition": "map(list9[x][0]+list9[x][1],x,0..len(list9)-1)", "name": "list10", "description": ""}}, "ungrouped_variables": ["set1", "set2", "set3", "set4", "set5", "set6", "set7", "set8", "set10", "set11", "set12", "set14", "set15", "set16"], "variable_groups": [{"variables": ["a", "b"], "name": "Random numbers"}, {"variables": ["list1", "list2", "list4", "list5", "list9", "list10", "list_extra"], "name": "Lists"}], "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": ""}, "rulesets": {}, "preamble": {"css": "", "js": ""}, "parts": [{"gaps": [{"checkvariablenames": false, "variableReplacements": [], "marks": 1, "type": "jme", "scripts": {}, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacementStrategy": "originalfirst", "answer": "{set3}", "showCorrectAnswer": true, "vsetrangepoints": 5, "showFeedbackIcon": true, "checkingtype": "absdiff"}], "variableReplacements": [], "marks": 0, "type": "gapfill", "scripts": {}, "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "prompt": "$A \\times B=\\;$[[0]]
", "showFeedbackIcon": true}, {"gaps": [{"checkvariablenames": false, "variableReplacements": [], "marks": 1, "type": "jme", "scripts": {}, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacementStrategy": "originalfirst", "answer": "{set6}", "showCorrectAnswer": true, "vsetrangepoints": 5, "showFeedbackIcon": true, "checkingtype": "absdiff"}], "variableReplacements": [], "marks": 0, "type": "gapfill", "scripts": {}, "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "prompt": "$(B\\cap D)\\times (A\\cap C)=\\;$[[0]]
", "showFeedbackIcon": true}], "type": "question", "contributors": [{"name": "Blathnaid Sheridan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/447/"}]}]}], "contributors": [{"name": "Blathnaid Sheridan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/447/"}]}