// Numbas version: exam_results_page_options {"name": "Draw a straight line graph by dragging points m<0", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Draw a straight line graph by dragging points m<0", "tags": [], "metadata": {"description": "

This question asks a student to draw a straight line graph by dragging points.

", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "

Draw the graph of the function $\\simplify[all,fractionNumbers]{y={m}x+{c}}$ by dragging the points A and B.

\n

Note that to be marked correct, you have to get the slope and the $y$-intercept to within 0.2 of the asked for values. If necessary, you can zoom in on the graph by using ctrl-+, that is holding down the ctrl key and pressing +. To return to the normal zoom, you can use ctrl-0.

\n

Also note that you have to drag at least one of the points in order to be able to submit your answer.

", "advice": "

The points used to find the line shown below are the point A, the $y$-intercept $\\left(0,\\var[fractionNumbers]{c}\\right)$ and the point B, $\\left(2,\\var[fractionNumbers]{2*m+c}\\right)$ found by letting $x=2$ in the equation $\\simplify[all,fractionNumbers]{y={m}x+{c}}$.

\n

{line(m,c)}

", "rulesets": {}, "extensions": ["jsxgraph"], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"m": {"name": "m", "group": "Ungrouped variables", "definition": "random(-3..-1)", "description": "

The slope of the line.

", "templateType": "anything", "can_override": false}, "c": {"name": "c", "group": "Ungrouped variables", "definition": "random(-5..5)", "description": "

The y-intercept.

", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "m<>0 or c<>0", "maxRuns": 100}, "ungrouped_variables": ["m", "c"], "variable_groups": [], "functions": {"line": {"parameters": [["m", "number"], ["c", "number"]], "type": "html", "language": "javascript", "definition": "// set up the board\nvar div = Numbas.extensions.jsxgraph.makeBoard('500px','500px',{boundingBox:[-11,11,11,-11],grid:true,withLabel:true});\n\nvar board = div.board;\n\nvar d = board.create('point',[10,0],{size:-1,name:'x'});\nd.setProperty({fixed:true});\nvar f = board.create('point',[0,10],{size:-1,name:'y'});\nf.setProperty({fixed:true});\nvar e = board.create('point',[0,c],{size:5,name:'A'});\ne.setProperty({fixed:true});\nvar g = board.create('point',[2,c+2*m],{size:5,name:'B'});\ng.setProperty({fixed:true});\n\nboard.create('functiongraph',[function(x){ return m*x+c;},-11,11],{strokeColor:'blue',strokeWidth:2});\n\nreturn div;"}, "dragpoint": {"parameters": [], "type": "html", "language": "javascript", "definition": "// set up the board\nvar div = Numbas.extensions.jsxgraph.makeBoard('500px','500px',{boundingBox:[-11,11,11,-11],grid:true,labels:true});\nvar board = div.board;\n\nvar x1 = -8;\nvar y1 = 0;\nvar x2 = 8;\nvar y2 = 0;\n\nvar e = board.create('point',[10,0],{size:-1,name:'x'});\ne.setProperty({fixed:true});\nvar f = board.create('point',[0,10],{size:-1,name:'y'});\nf.setProperty({fixed:true});\n\nvar a = board.create('point',[-8,0],{size:5});\nvar b = board.create('point',[8,0],{size:5});\n\na.on('drag',function(){\n var x1 = Numbas.math.niceNumber(a.X());\n var y1 = Numbas.math.niceNumber(a.Y());\n var x2 = Numbas.math.niceNumber(b.X());\n var y2 = Numbas.math.niceNumber(b.Y());\n var m = (y2-y1)/(x2-x1);\n var c = y1-m*x1;\n Numbas.exam.currentQuestion.parts[0].gaps[0].display.studentAnswer(m);\n Numbas.exam.currentQuestion.parts[0].gaps[1].display.studentAnswer(c);\n});\nb.on('drag',function(){\n var x1 = Numbas.math.niceNumber(a.X());\n var y1 = Numbas.math.niceNumber(a.Y());\n var x2 = Numbas.math.niceNumber(b.X());\n var y2 = Numbas.math.niceNumber(b.Y());\n var m = (y2-y1)/(x2-x1);\n var c = y1-m*x1;\n Numbas.exam.currentQuestion.parts[0].gaps[0].display.studentAnswer(m);\n Numbas.exam.currentQuestion.parts[0].gaps[1].display.studentAnswer(c);\n});\n\nvar line = board.create('line',[a,b], {strokeColor:'blue',strokeWidth:2});\n\nreturn div;\n\n\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": "

{dragpoint()}

\n

", "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": "m-0.2", "maxValue": "m+0.2", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}, {"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": "c-0.2", "maxValue": "c+0.2", "correctAnswerFraction": false, "allowFractions": false, "mustBeReduced": false, "mustBeReducedPC": 0, "showFractionHint": true, "notationStyles": ["plain", "en", "si-en"], "correctAnswerStyle": "plain"}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Anthony Brown", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/799/"}]}]}], "contributors": [{"name": "Anthony Brown", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/799/"}]}