// Numbas version: exam_results_page_options {"name": "Midpoint", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"metadata": {"licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International", "description": "

Calculate the midpoint of two points.

"}, "type": "question", "preamble": {"css": "", "js": ""}, "advice": "

{line_and_2points()}

\n

\n

The midpoint of two points is simply the point whose $x$ coordinate is the average of the other $x$ coordinates, and whose $y$ coordinate is the average of the other $y$ coordinates. That is, the midpoint of $(\\var{xa1},\\var{ya1})$ and $(\\var{xa2},\\var{ya2})$ is the point $\\left(\\simplify[basic]{({xa1}+{xa2})/2},\\simplify[basic]{({ya1}+{ya2})/2}\\right)=\\left(\\simplify{({xa1}+{xa2})/2},\\simplify{({ya1}+{ya2})/2}\\right)=\\left(\\simplify{{(xa1+xa2)/2}},\\simplify{{(ya1+ya2)/2}}\\right)$.

\n

\n

", "rulesets": {}, "extensions": ["jsxgraph"], "name": "Midpoint", "ungrouped_variables": ["l", "xa1", "xa2", "ya1", "ya2", "xa", "ya"], "functions": {"line_and_2points": {"type": "html", "definition": "\nvar 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});\nboard.create('point',[(x0+x1)/2,(y0+y1)/2],{fixed:true,withLabel:false});\n\n\nboard.create('text',[(x0+x1)/2+0.5,(y0+y1)/2,'The midpoint']);\n\n\nreturn div;", "language": "javascript", "parameters": []}}, "tags": [], "variablesTest": {"condition": "", "maxRuns": 100}, "variable_groups": [], "variables": {"ya": {"name": "ya", "definition": "(ya1+ya2)/2", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "ya2": {"name": "ya2", "definition": "l[3]", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "l": {"name": "l", "definition": "shuffle(-12..12)[0..4]", "group": "Ungrouped variables", "description": "

l

", "templateType": "anything"}, "xa1": {"name": "xa1", "definition": "l[0]", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "xa2": {"name": "xa2", "definition": "l[1]", "group": "Ungrouped variables", "description": "

xa

", "templateType": "anything"}, "ya1": {"name": "ya1", "definition": "l[2]", "group": "Ungrouped variables", "description": "", "templateType": "anything"}, "xa": {"name": "xa", "definition": "(xa1+xa2)/2", "group": "Ungrouped variables", "description": "", "templateType": "anything"}}, "statement": "

Fill in the blanks.

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

The midpoint of $(\\var{xa1},\\var{ya1})$ and $(\\var{xa2},\\var{ya2})$ is $\\large($[[0]], [[1]]$\\large)$.

", "showCorrectAnswer": true, "gaps": [{"maxValue": "xa", "mustBeReduced": false, "allowFractions": true, "type": "numberentry", "variableReplacementStrategy": "originalfirst", "marks": 1, "showFeedbackIcon": true, "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"], "scripts": {}, "correctAnswerStyle": "plain", "minValue": "xa", "showCorrectAnswer": true, "variableReplacements": [], "correctAnswerFraction": true}, {"maxValue": "ya", "mustBeReduced": false, "allowFractions": true, "type": "numberentry", "variableReplacementStrategy": "originalfirst", "marks": 1, "showFeedbackIcon": true, "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"], "scripts": {}, "correctAnswerStyle": "plain", "minValue": "ya", "showCorrectAnswer": true, "variableReplacements": [], "correctAnswerFraction": true}], "showFeedbackIcon": true, "variableReplacements": []}], "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}]}], "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}, {"name": "Xiaodan Leng", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2146/"}]}