// Numbas version: finer_feedback_settings {"name": "Distance between two points", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Distance between two points", "tags": [], "metadata": {"description": "
Calculate the midpoint of two points.
", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "statement": "Fill in the blanks.
", "advice": "", "rulesets": {}, "extensions": ["jsxgraph"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"y1": {"name": "y1", "group": "Ungrouped variables", "definition": "l[6]", "description": "", "templateType": "anything", "can_override": false}, "dy": {"name": "dy", "group": "Ungrouped variables", "definition": "ya2-ya1", "description": "", "templateType": "anything", "can_override": false}, "y2": {"name": "y2", "group": "Ungrouped variables", "definition": "y1+random([-1,1])*triple[1]", "description": "", "templateType": "anything", "can_override": false}, "triple": {"name": "triple", "group": "Ungrouped variables", "definition": "random([[3, 4, 5], [5, 12, 13], [7, 24, 25], [8, 15, 17], [9, 40, 41], [11, 60, 61], [12, 35, 37], [16, 63, 65], [20, 21, 29]])", "description": "", "templateType": "anything", "can_override": false}, "x2": {"name": "x2", "group": "Ungrouped variables", "definition": "x1+random([-1,1])*triple[0]", "description": "", "templateType": "anything", "can_override": false}, "ya2": {"name": "ya2", "group": "Ungrouped variables", "definition": "l[3]", "description": "", "templateType": "anything", "can_override": false}, "dx": {"name": "dx", "group": "Ungrouped variables", "definition": "xa2-xa1", "description": "", "templateType": "anything", "can_override": false}, "l": {"name": "l", "group": "Ungrouped variables", "definition": "shuffle(-12..12)[0..8]", "description": "l
", "templateType": "anything", "can_override": false}, "ya1": {"name": "ya1", "group": "Ungrouped variables", "definition": "l[2]", "description": "", "templateType": "anything", "can_override": false}, "xa1": {"name": "xa1", "group": "Ungrouped variables", "definition": "l[0]", "description": "", "templateType": "anything", "can_override": false}, "xa2": {"name": "xa2", "group": "Ungrouped variables", "definition": "l[1]", "description": "xa
", "templateType": "anything", "can_override": false}, "x1": {"name": "x1", "group": "Ungrouped variables", "definition": "l[4]", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["l", "xa1", "xa2", "ya1", "ya2", "dx", "dy", "x1", "y1", "x2", "y2", "triple"], "variable_groups": [], "functions": {"diagram": {"parameters": [], "type": "html", "language": "javascript", "definition": "var div = Numbas.extensions.jsxgraph.makeBoard('600px','600px',{boundingBox:[-13,13,13,-13],grid:true,axis:false});\nvar board = div.board;\n\n// create the x-axis.\nvar xaxis = board.create('line',[[0,0],[1,0]], { strokeColor: 'black', fixed: true});\nvar xticks = board.create('ticks',[xaxis,2],{\n drawLabels: true,\n label: {offset: [-4, -10]},\n minorTicks: 0\n});\n\n// create the y-axis\nvar yaxis = board.create('line',[[0,0],[0,1]], { strokeColor: 'black', fixed: true });\nvar yticks = board.create('ticks',[yaxis,2],{\ndrawLabels: true,\nlabel: {offset: [-20, 0]},\nminorTicks: 0\n});\n\n\nx0 = Numbas.jme.unwrapValue(scope.variables.xa1);\ny0 = Numbas.jme.unwrapValue(scope.variables.ya1);\nx1 = Numbas.jme.unwrapValue(scope.variables.xa2);\ny1 = Numbas.jme.unwrapValue(scope.variables.ya2);\n\nboard.create('point',[x0,y0],{fixed:true,withLabel:false});\nboard.create('point',[x1,y1],{fixed:true,withLabel:false});\n\nvar vline = board.create('line',[[x0,y0],[x0,y1]], {straightFirst:false, straightLast:false, strokeWidth:2, fixed:true});\nvar hline = board.create('line',[[x0,y1],[x1,y1]], {straightFirst:false, straightLast:false, strokeWidth:2, fixed:true});\nvar dia = board.create('line',[[x0,y0],[x1,y1]], {straightFirst:false, straightLast:false, strokeWidth:2, fixed:true});\n\nvar rise = board.create('text',[x0+0.25,(y0+y1)/2,'b']);\nvar run = board.create('text',[(x0+x1)/2,y1-0.5,'a']);\nvar hyp = board.create('text',[(x0+x1)/2,(y0+y1)/2+0.5,'c']);\n\nreturn div;\n"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "gapfill", "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": "The distance between the points $(\\var{x1},\\var{y1})$ and $(\\var{x2},\\var{y2})$ is [[0]] units.
\n\nNote: For this question your answer should be an integer.
", "stepsPenalty": "1", "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": "The distance between the points $(x_1,y_1)$ and $(x_2,y_2)$ is $\\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}$ units. This is simply the length of the hypotenuse of the right-angled triangle given by Pythagoras' Theorem $c^2=a^2+b^2$. For the points $(\\var{x1},\\var{y1})$ and $(\\var{x2},\\var{y2})$ this is a distance of
\n$\\begin{align}\\sqrt{\\simplify[basic]{({x2}-{x1})^2+({y2}-{y1})^2}}&=\\sqrt{\\simplify[basic]{({x2-x1})^2+({y2-y1})^2}}\\\\&=\\sqrt{\\simplify[basic]{{(x2-x1)^2}+{(y2-y1)^2}}}\\\\&=\\sqrt{\\simplify[basic]{{(x2-x1)^2+(y2-y1)^2}}}\\\\&=\\var{triple[2]} \\quad \\text{units.}\\end{align}$
"}], "gaps": [{"type": "numberentry", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "minValue": "triple[2]", "maxValue": "triple[2]", "correctAnswerFraction": true, "allowFractions": true, "mustBeReduced": false, "mustBeReducedPC": 0, "displayAnswer": "", "showFractionHint": false, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}, {"type": "gapfill", "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": "The distance between the points $(\\var{xa1},\\var{ya1})$ and $(\\var{xa2},\\var{ya2})$ is [[0]] units.
\n\nNote: For this question you can enter exact answers by using expressions such as sqrt(200) to indicate $\\sqrt{200}$.
", "stepsPenalty": "1", "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": "The distance between the points $(x_1,y_1)$ and $(x_2,y_2)$ is $\\sqrt{(x_2-x_1)^2+(y_2-y_1)^2}$ units. This is simply the length of the hypotenuse of the right-angled triangle given by Pythagoras' Theorem $c^2=a^2+b^2$.
\n{diagram()}
\nFor the points $(\\var{xa1},\\var{ya1})$ and $(\\var{xa2},\\var{ya2})$ this is a distance of
\n$\\begin{align}\\sqrt{\\simplify[basic]{({xa2}-{xa1})^2+({ya2}-{ya1})^2}}&=\\sqrt{\\simplify[basic]{({xa2-xa1})^2+({ya2-ya1})^2}}\\\\&=\\sqrt{\\simplify[basic]{{(xa2-xa1)^2}+{(ya2-ya1)^2}}}\\\\&=\\sqrt{\\simplify[basic]{{(xa2-xa1)^2+(ya2-ya1)^2}}} \\quad \\text{units.}\\end{align}$
"}], "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "sqrt({dx^2+dy^2})", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": []}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}], "resources": []}]}], "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}]}