// Numbas version: exam_results_page_options {"name": "Luis'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{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)))}$.

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

", "preamble": {"css": "", "js": ""}, "question_groups": [{"questions": [], "pickingStrategy": "all-ordered", "pickQuestions": 0, "name": ""}], "name": "Luis's copy of set5 - Cartesian Products", "variable_groups": [{"name": "Random numbers", "variables": ["a", "b"]}, {"name": "Lists", "variables": ["list1", "list2", "list4", "list5", "list9", "list10", "list_extra"]}], "type": "question", "functions": {"mod_set": {"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}$.

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

", "parts": [{"variableReplacements": [], "prompt": "

$A \\times B=\\;$[[0]]

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

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

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

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

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

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

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

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

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

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

", "scripts": {}, "gaps": [{"variableReplacements": [], "scripts": {}, "checkingtype": "absdiff", "type": "jme", "expectedvariablenames": [], "marks": 1, "showCorrectAnswer": true, "checkingaccuracy": 0.001, "vsetrange": [0, 1], "variableReplacementStrategy": "originalfirst", "showpreview": true, "answer": "{set16}", "vsetrangepoints": 5, "checkvariablenames": false}], "variableReplacementStrategy": "originalfirst", "type": "gapfill", "showCorrectAnswer": true, "marks": 0}], "ungrouped_variables": ["set1", "set2", "set3", "set4", "set5", "set6", "set7", "set8", "set10", "set11", "set12", "set14", "set15", "set16"], "metadata": {"notes": "", "description": "", "licence": "Creative Commons Attribution 4.0 International"}, "tags": [], "showQuestionGroupNames": false, "rulesets": {}, "variables": {"set6": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "set6", "definition": "set(product(list(set8),list(set7)))"}, "list10": {"templateType": "anything", "group": "Lists", "description": "", "name": "list10", "definition": "map(list9[x][0]+list9[x][1],x,0..len(list9)-1)"}, "set15": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "set15", "definition": "intersection(set(product(list1,list5)),set(product(list4,list2)))"}, "list5": {"templateType": "anything", "group": "Lists", "description": "", "name": "list5", "definition": "shuffle(list2)[0..b-1]+list_extra"}, "list1": {"templateType": "anything", "group": "Lists", "description": "", "name": "list1", "definition": "shuffle(list(1..20))[0..a]"}, "set16": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "set16", "definition": "union(set(product(list(intersection(set4,set5)),list(set4-set5))),set(product(list(set5-set4),list(intersection(set4,set5)))))"}, "set10": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "set10", "definition": "set(list10)"}, "set3": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "set3", "definition": "set(product(list1,list2))"}, "set1": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "set1", "definition": "set(list1)"}, "set8": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "set8", "definition": "intersection(set2,set5)"}, "a": {"templateType": "anything", "group": "Random numbers", "description": "", "name": "a", "definition": "random(2..3)"}, "set7": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "set7", "definition": "intersection(set1,set4)"}, "set4": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "set4", "definition": "set(list4)"}, "b": {"templateType": "anything", "group": "Random numbers", "description": "", "name": "b", "definition": "5-a"}, "set12": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "set12", "definition": "union(set2-set5,set5-set2)"}, "set14": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "set14", "definition": "set(product(list(set11),list(set12)))"}, "list9": {"templateType": "anything", "group": "Lists", "description": "", "name": "list9", "definition": "product(product(list(set7),list(set7)),list(intersection(set4,set5)))"}, "set5": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "set5", "definition": "set(list5)"}, "list4": {"templateType": "anything", "group": "Lists", "description": "", "name": "list4", "definition": "shuffle(list1)[0..a-1]+list_extra"}, "set11": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "set11", "definition": "union(set1-set4,set4-set1)"}, "list2": {"templateType": "anything", "group": "Lists", "description": "", "name": "list2", "definition": "shuffle(list(25..100#5))[0..b]"}, "set2": {"templateType": "anything", "group": "Ungrouped variables", "description": "", "name": "set2", "definition": "set(list2)"}, "list_extra": {"templateType": "anything", "group": "Lists", "description": "", "name": "list_extra", "definition": "[random(21..24)]"}}, "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Luis Hernandez", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2870/"}]}]}], "contributors": [{"name": "Newcastle University Mathematics and Statistics", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/697/"}, {"name": "Luis Hernandez", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2870/"}]}