// Numbas version: exam_results_page_options {"name": "Katherine's copy of 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": [{"metadata": {"description": "

Calculate the distance between two points.

", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "variables": {"x2": {"definition": "x1+random([-1,1])*triple[0]", "name": "x2", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "y1": {"definition": "l[6]", "name": "y1", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "x1": {"definition": "l[4]", "name": "x1", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "dx": {"definition": "xa2-xa1", "name": "dx", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "l": {"definition": "shuffle(-12..12)[0..8]", "name": "l", "group": "Ungrouped variables", "templateType": "anything", "description": "

l

"}, "ya1": {"definition": "l[2]", "name": "ya1", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "triple": {"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], [20, 99, 101]])", "name": "triple", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "ya2": {"definition": "l[3]", "name": "ya2", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "xa2": {"definition": "l[1]", "name": "xa2", "group": "Ungrouped variables", "templateType": "anything", "description": "

xa

"}, "dy": {"definition": "ya2-ya1", "name": "dy", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "xa1": {"definition": "l[0]", "name": "xa1", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "y2": {"definition": "y1+random([-1,1])*triple[1]", "name": "y2", "group": "Ungrouped variables", "templateType": "anything", "description": ""}}, "extensions": ["jsxgraph"], "rulesets": {}, "name": "Katherine's copy of Distance between two points", "tags": [], "advice": "

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 the simply the length of the hypotenuse of the right angled triangle given by Pythagoras' Theorem $c^2=a^2+b^2$. 

\n

{diagram()}

\n

a) 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}$

\n

\n

b) For 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}$

\n

", "parts": [{"scripts": {}, "type": "gapfill", "variableReplacementStrategy": "originalfirst", "marks": 0, "prompt": "

The distance between the points $(\\var{x1},\\var{y1})$ and $(\\var{x2},\\var{y2})$ is  [[0]] units.

\n

\n

Note: For this question your answer should be an integer. 

", "variableReplacements": [], "gaps": [{"scripts": {}, "type": "numberentry", "mustBeReduced": false, "correctAnswerFraction": true, "showFeedbackIcon": true, "showCorrectAnswer": true, "allowFractions": true, "mustBeReducedPC": 0, "correctAnswerStyle": "plain", "variableReplacementStrategy": "originalfirst", "notationStyles": ["plain", "en", "si-en"], "marks": 1, "minValue": "triple[2]", "maxValue": "triple[2]", "variableReplacements": []}], "showFeedbackIcon": true, "showCorrectAnswer": true}, {"scripts": {}, "type": "gapfill", "variableReplacementStrategy": "originalfirst", "marks": 0, "prompt": "

The distance between the points $(\\var{xa1},\\var{ya1})$ and $(\\var{xa2},\\var{ya2})$ is  [[0]] units.

\n

\n

Note: For this question you can enter exact answers by using expressions such as sqrt(200) to indicate $\\sqrt{200}$. 

", "variableReplacements": [], "gaps": [{"scripts": {}, "type": "jme", "checkvariablenames": false, "checkingtype": "absdiff", "showpreview": true, "answer": "sqrt({dx^2+dy^2})", "showFeedbackIcon": true, "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "checkingaccuracy": 0.001, "marks": 1, "expectedvariablenames": [], "vsetrange": [0, 1], "variableReplacements": [], "vsetrangepoints": 5}], "showFeedbackIcon": true, "showCorrectAnswer": true}], "variablesTest": {"condition": "", "maxRuns": 100}, "preamble": {"js": "", "css": ""}, "statement": "

Fill in the blanks.

", "functions": {"diagram": {"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", "type": "html", "language": "javascript", "parameters": []}}, "variable_groups": [], "ungrouped_variables": ["l", "xa1", "xa2", "ya1", "ya2", "dx", "dy", "x1", "y1", "x2", "y2", "triple"], "type": "question", "contributors": [{"name": "Katherine Tomlinson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1652/"}]}]}], "contributors": [{"name": "Katherine Tomlinson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1652/"}]}