// Numbas version: finer_feedback_settings {"name": "Relations: Partial Ordering and Hasse Diagram", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [["question-resources/hasse.png", "/srv/numbas/media/question-resources/hasse.png"]], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Relations: Partial Ordering and Hasse Diagram", "tags": [], "metadata": {"description": "", "licence": "None specified"}, "statement": "
Another important relation is called a partial order. We say that a relation $\\leq$ is a partial order when it has the three characteristic qualities:
\nTypically, we take a set together with partial ordering such as \"less than or equal to\" $\\leq$, \"subset\" $\\subseteq$ or \"divides\" $|$. Together, the partial ordering and set are called a partially ordered set or poset.
\nInstead of an arrow diagram, we use a Hasse Diagram to visualise a poset. This communicates the relation between elements of the set with as few edges as possible.
\nConsider the set
\n$A = \\left\\{ \\left\\{1\\right\\} ,\\left\\{2 \\right\\} ,\\left\\{3 \\right\\},\\left\\{1,2 \\right\\} ,\\left\\{ 3,4\\right\\},\\left\\{1,2,4 \\right\\},\\left\\{1,3,4 \\right\\},\\left\\{1,2,4,5 \\right\\},\\left\\{ 1,2,3,5 \\right\\} \\right\\} $
\ntogether with the partial ordering $\\subseteq$.
", "advice": "See the steps section above for a general description for how to design Hasse diagrams.
\nA good rule of thumb is to work from the bottom up. Join all 1-element sets to those 2-element sets that contain them as a subset. Then do the same for 2-element sets to 3-element sets, and 3-element sets to 4-element sets.
\nNext check if any of the 1-element sets are contained in any of the 3-element sets that they are not already connected to by a path of edges. If they are, join these vertices. Do the same for 2-element sets contained in 4-element sets.
\nFinally, check if any of the 1-element sets are contained in any of the 4-element sets that they are not already connected to by a path of edges.
", "rulesets": {}, "extensions": ["jsxgraph"], "variables": {"b": {"name": "b", "group": "Ungrouped variables", "definition": "random(0.1 .. 1#0.1)", "description": "", "templateType": "randrange"}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "random(0.1 .. 1#0.1)", "description": "", "templateType": "randrange"}}, "variablesTest": {"condition": "a<>b", "maxRuns": 100}, "ungrouped_variables": ["a", "b"], "variable_groups": [], "functions": {"createNetwork": {"parameters": [], "type": "html", "language": "javascript", "definition": "// This function creates the board and sets it up, then returns an\n// HTML div tag containing the board.\n \n// The line is described by the equation \n// y = a*x + b\n\n// This function takes as its parameters the coefficients a and b,\n// and the coordinates (x2,y2) of a point on the line.\n\n// First, make the JSXGraph board.\n// The function provided by the JSXGraph extension wraps the board up in \n// a div tag so that it's easier to embed in the page.\nvar div = Numbas.extensions.jsxgraph.makeBoard('300px','400px',\n{boundingBox: [0,4.5,1,0.5],\n axis: false,\n showNavigation: false,\n grid: false\n});\n\n//console.log(\"Extensions\")\n//console.log(Numbas.extensions);\n\n// div.board is the object created by JSXGraph, which you use to \n// manipulate elements\n\nvar redColor='#ff0000';\nvar blueColor='#0000ff';\nvar grayColor='#9b9b9b';\n\nvar PointStyle={face:'o', size:4, fixed:false,label:{fontSize:20}};\nvar LineStyle={fixed:true,straightFirst:false,straightLast:false,strokeWidth:2,dash:0,strokeColor:blueColor};\n\n\nquestion.parts[0].trueEdges=new Set([\"{1,2,4,5}gt{1,2,4}\", \"{1,2,3,5}gt{1,2}\", \"{1,2,3,5}gt{3}\", \"{1,3,4}gt{3,4}\", \"{1,3,4}gt{1}\", \"{1,2,4}gt{1,2}\", \"{1,2}gt{1}\", \"{1,2}gt{2}\", \"{3,4}gt{3}\"]);\n\nquestion.parts[0].allEdges = new Set([\"{1,2,4,5}gt{1,2,4}\", \"{1,2,4,5}gt{1,2}\", \"{1,2,4,5}gt{1}\", \"{1,2,4,5}gt{2}\", \"{1,2,3,5}gt{1,2}\", \"{1,2,3,5}gt{1}\", \"{1,2,3,5}gt{2}\", \"{1,2,3,5}gt{3}\", \"{1,3,4}gt{3,4}\", \"{1,3,4}gt{1}\", \"{1,3,4}gt{3}\", \"{1,2,4}gt{1,2}\", \"{1,2,4}gt{1}\", \"{1,2,4}gt{2}\", \"{1,2}gt{1}\", \"{1,2}gt{2}\", \"{3,4}gt{3}\"]);\n\nquestion.parts[0].removableEdges = new Set([\"{1,2,4,5}gt{1,2}\", \"{1,2,4,5}gt{1}\", \"{1,2,4,5}gt{2}\", \"{1,2,4,5}gt{1}\", \"{1,2,4,5}gt{2}\", \"{1,2,3,5}gt{1}\", \"{1,2,3,5}gt{2}\", \"{1,3,4}gt{3}\", \"{1,2,4}gt{1}\", \"{1,2,4}gt{2}\"]);\n\nquestion.parts[0].constructedEdges=new Set();\n\nvar lineDict={};\n\nvar point0selected=false\nvar point0\n\n\nfunction changePointStyle(){\n //console.log(this);\n if(this.selected==true){\n this.selected=false;\n this.setAttribute({fillColor:redColor,strokeColor:redColor});\n \n point0selected=false\n \n } else {\n this.selected=true ;\n this.setAttribute({fillColor:blueColor,strokeColor:blueColor});\n \n if(point0selected==false){\n point0selected=true\n point0=this\n } else {\n if(point0.Y()>this.Y()){\n lineName=point0.name+\"gt\"+this.name;\n } else if (point0.Y()Make a Hasse Diagram for this poset. Click on two verticies to make or destroy the edge between them.
\n{createNetwork()}
", "stepsPenalty": 0, "steps": [{"type": "information", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "For example, the poset $(\\left\\{1,2,3,4,5,6\\right\\},|)$ is a poset. Its corresponding Hasse diagram is
\n"}]}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "type": "question", "contributors": [{"name": "Daniel Mansfield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/743/"}, {"name": "Sean Gardiner", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2443/"}]}]}], "contributors": [{"name": "Daniel Mansfield", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/743/"}, {"name": "Sean Gardiner", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2443/"}]}