// Numbas version: exam_results_page_options {"name": "Draw a straight line graph by dragging points Horizontal", "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 Horizontal", "ungrouped_variables": ["m", "c"], "variables": {"m": {"group": "Ungrouped variables", "definition": "0", "name": "m", "templateType": "anything", "description": "

This is the x-value of the vertical line.

"}, "c": {"group": "Ungrouped variables", "definition": "random(-10..10)", "name": "c", "templateType": "anything", "description": ""}}, "advice": "

This is a vertical line with $x$- coordinate $x=\\var{m}$ as shown in the diagram below.

\n

{after(m)}

", "tags": [], "functions": {"dragpoint": {"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 c = (parseFloat(x1) + parseFloat(x2))/2;\n var m = x2 - 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 c = (parseFloat(x1) + parseFloat(x2))/2;\n var m = x2 - 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", "parameters": [], "language": "javascript", "type": "html"}, "after": {"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',[x,0],{size:5,name:'A'});\ne.setProperty({fixed:true});\nvar g = board.create('point',[x,2],{size:5,name:'B'});\ng.setProperty({fixed:true});\n\nboard.create('line',[e,g], {strokeColor:'blue',strokeWidth:2});\n\n\nreturn div;", "parameters": [["x", "number"]], "language": "javascript", "type": "html"}}, "rulesets": {}, "extensions": ["jsxgraph"], "preamble": {"css": "", "js": ""}, "variable_groups": [], "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

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

"}, "statement": "

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

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

{dragpoint()}

", "type": "gapfill", "showCorrectAnswer": true}], "variablesTest": {"condition": "", "maxRuns": 100}, "type": "question", "contributors": [{"name": "Mark Hodds", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/510/"}]}]}], "contributors": [{"name": "Mark Hodds", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/510/"}]}