// Numbas version: finer_feedback_settings {"name": "Terry's copy of The gradient of an interval between two points", "extensions": ["jsxgraph", "polynomials"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"statement": "

Fill in the blanks.

", "variable_groups": [], "functions": {"line_and_2points": {"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.x0);\ny0 = Numbas.jme.unwrapValue(scope.variables.y0);\nx1 = Numbas.jme.unwrapValue(scope.variables.x1);\ny1 = Numbas.jme.unwrapValue(scope.variables.y1);\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});\n\nvar rise = board.create('text',[x0+0.25,(y0+y1)/2,'rise']);\nvar run = board.create('text',[(x0+x1)/2,y1-0.5,'run']);\n\nreturn div;", "language": "javascript", "type": "html", "parameters": []}}, "rulesets": {}, "parts": [{"marks": 0, "scripts": {}, "variableReplacementStrategy": "originalfirst", "prompt": "

The gradient of the interval between the points ({x0},{y0}) and ({x1},{y1}) is $m=$ [[0]].

\n

\n

", "variableReplacements": [], "gaps": [{"answersimplification": "all", "vsetrangepoints": 5, "checkingtype": "absdiff", "variableReplacements": [], "vsetrange": [0, 1], "checkvariablenames": true, "showFeedbackIcon": true, "expectedvariablenames": ["x"], "marks": "1", "notallowed": {"partialCredit": 0, "message": "", "showStrings": false, "strings": ["="]}, "showpreview": true, "scripts": {}, "variableReplacementStrategy": "originalfirst", "answer": "{y1-y0}/{x1-x0}", "type": "jme", "showCorrectAnswer": true, "checkingaccuracy": 0.001}], "type": "gapfill", "showFeedbackIcon": true, "showCorrectAnswer": true}], "variables": {"const": {"definition": "(x1*y0-x0*y1)/(x1-x0)", "description": "", "name": "const", "group": "Ungrouped variables", "templateType": "anything"}, "m": {"definition": "(y1-y0)/(x1-x0)", "description": "", "name": "m", "group": "Ungrouped variables", "templateType": "anything"}, "y1": {"definition": "random(-10..10 except y0)", "description": "", "name": "y1", "group": "Ungrouped variables", "templateType": "anything"}, "x1": {"definition": "random(-10..10 except [x0,0])", "description": "", "name": "x1", "group": "Ungrouped variables", "templateType": "anything"}, "y0": {"definition": "random(-10..10 except 0)", "description": "", "name": "y0", "group": "Ungrouped variables", "templateType": "anything"}, "x0": {"definition": "random(-10..10 except 0)", "description": "", "name": "x0", "group": "Ungrouped variables", "templateType": "anything"}}, "preamble": {"js": "", "css": ""}, "advice": "

{line_and_2points()}

\n

\n

Determine the gradient by $m=\\dfrac{\\text{rise}}{\\text{run}}$, or $m=\\dfrac{y_2-y_1}{x_2-x_1}$. 

\n

\n

So in particular, $\\displaystyle m=\\frac{\\simplify[!collectNumbers]{{y1}-{y0}}}{\\simplify[!collectNumbers]{{x1}-{x0}}}$$=\\dfrac{\\simplify{{y1-y0}}}{\\simplify{{x1-x0}}}$$\\displaystyle =\\simplify[basic, fractionNumbers, simplifyFractions]{{(y1-y0)/(x1-x0)}}$.

\n

", "metadata": {"description": "

Identifying y=mx+b given two points

", "licence": "Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International"}, "ungrouped_variables": ["x0", "y0", "x1", "y1", "m", "const"], "tags": [], "name": "Terry's copy of The gradient of an interval between two points", "variablesTest": {"maxRuns": 100, "condition": ""}, "extensions": ["jsxgraph", "polynomials"], "type": "question", "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}, {"name": "Terry Young", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3130/"}]}]}], "contributors": [{"name": "Ben Brawn", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/605/"}, {"name": "Terry Young", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3130/"}]}