// Numbas version: finer_feedback_settings {"name": "Draw a straight line graph by dragging points vertical", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"tags": [], "rulesets": {}, "functions": {"after": {"parameters": [["x", "number"]], "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',[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;", "type": "html"}, "dragpoint": {"parameters": [], "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 c = x2 - x1;\n var m = (parseFloat(x1) + parseFloat(x2))/2;\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 = x2 - x1;\n var m = (parseFloat(x1) + parseFloat(x2))/2;\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", "type": "html"}}, "statement": "

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

", "variables": {"m": {"templateType": "anything", "group": "Ungrouped variables", "name": "m", "description": "

This is the x-value of the vertical line.

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

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

\n

{after(m)}

", "name": "Draw a straight line graph by dragging points vertical", "metadata": {"description": "

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

", "licence": "Creative Commons Attribution 4.0 International"}, "variablesTest": {"condition": "", "maxRuns": 100}, "preamble": {"js": "", "css": ""}, "extensions": ["jsxgraph"], "parts": [{"scripts": {}, "gaps": [{"scripts": {}, "maxValue": "m+0.2", "allowFractions": false, "correctAnswerStyle": "plain", "variableReplacements": [], "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"], "minValue": "m-0.2", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "marks": "1", "type": "numberentry", "mustBeReduced": false, "showFeedbackIcon": true, "correctAnswerFraction": false}, {"scripts": {}, "maxValue": "c+0.2", "allowFractions": false, "correctAnswerStyle": "plain", "variableReplacements": [], "mustBeReducedPC": 0, "notationStyles": ["plain", "en", "si-en"], "minValue": "c-0.2", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "marks": 1, "type": "numberentry", "mustBeReduced": false, "showFeedbackIcon": true, "correctAnswerFraction": false}], "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "marks": 0, "showFeedbackIcon": true, "prompt": "

{dragpoint()}

", "variableReplacements": [], "type": "gapfill"}], "variable_groups": [], "ungrouped_variables": ["m", "c"], "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/"}]}