// Numbas version: exam_results_page_options {"name": "Plotting a point on a graph", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"parts": [{"extendBaseMarkingAlgorithm": true, "gaps": [{"extendBaseMarkingAlgorithm": true, "mustBeReduced": false, "allowFractions": false, "scripts": {}, "customMarkingAlgorithm": "", "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "mustBeReducedPC": 0, "minValue": "a-0.1", "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "variableReplacements": [], "maxValue": "a+0.1", "showFeedbackIcon": true, "correctAnswerFraction": false, "marks": "0.5", "unitTests": []}, {"extendBaseMarkingAlgorithm": true, "mustBeReduced": false, "allowFractions": false, "scripts": {}, "customMarkingAlgorithm": "", "type": "numberentry", "notationStyles": ["plain", "en", "si-en"], "showCorrectAnswer": true, "mustBeReducedPC": 0, "minValue": "b-0.1", "variableReplacementStrategy": "originalfirst", "correctAnswerStyle": "plain", "variableReplacements": [], "maxValue": "b+0.1", "showFeedbackIcon": true, "correctAnswerFraction": false, "marks": "0.5", "unitTests": []}], "scripts": {}, "customMarkingAlgorithm": "", "type": "gapfill", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "variableReplacements": [], "prompt": "

Place the point A at $(\\var{a},\\var{b})$ by dragging it.

\n

To be marked correct, you have to get the x and y coordinates within 0.1 of the asked for values.

\n

{dragpoint()}

\n

", "sortAnswers": false, "showFeedbackIcon": true, "marks": 0, "unitTests": []}], "variable_groups": [], "functions": {"dragpointafter": {"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 x = Numbas.jme.unwrapValue(scope.variables.a);\nvar y = Numbas.jme.unwrapValue(scope.variables.b);\n\nvar a = board.create('point',[x,y],{size:5});\na.setProperty({fixed:true});\nvar b = board.create('point',[10,0],{size:-1,name:'x'});\nb.setProperty({fixed:true});\nvar c = board.create('point',[0,10],{size:-1,name:'y'});\nc.setProperty({fixed:true});\n\nreturn div;", "type": "html", "language": "javascript", "parameters": []}, "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 x = Numbas.jme.unwrapValue(scope.variables.a);\nvar y = Numbas.jme.unwrapValue(scope.variables.b);\n\nvar a = board.create('point',[0,0],{size:5});\nvar b = board.create('point',[10,0],{size:-1,name:'x'});\nb.setProperty({fixed:true});\nvar c = board.create('point',[0,10],{size:-1,name:'y'});\nc.setProperty({fixed:true});\na.on('drag',function(){\n var x = Numbas.math.niceNumber(a.X());\n var y = Numbas.math.niceNumber(a.Y());\n Numbas.exam.currentQuestion.parts[0].gaps[0].display.studentAnswer(a.X());\n Numbas.exam.currentQuestion.parts[0].gaps[1].display.studentAnswer(y); \n});\n\nquestion.signals.on('HTMLAttached',function(e) {\n ko.computed(function(){ \nvar x = parseFloat(question.parts[0].gaps[0].display.studentAnswer());\nvar y = parseFloat(question.parts[0].gaps[1].display.studentAnswer());\nif(!(isNaN(x) || isNaN(y)) && board.mode!=board.BOARD_MODE_DRAG) {\n a.moveTo([x,y],100);\n}\n });\n a.triggerEventHandlers('drag');\n});\n\nreturn div;\n\n\n", "type": "html", "language": "javascript", "parameters": []}}, "tags": [], "extensions": ["jsxgraph"], "preamble": {"js": "", "css": ""}, "variablesTest": {"condition": "a<>0 or b<>0", "maxRuns": 100}, "name": "Plotting a point on a graph", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

This question asks you to plot a point on a graph.

"}, "variables": {"b": {"definition": "random(-10..10)", "group": "Ungrouped variables", "templateType": "anything", "description": "", "name": "b"}, "a": {"definition": "random(-10..10)", "group": "Ungrouped variables", "templateType": "anything", "description": "", "name": "a"}}, "rulesets": {}, "statement": "

This question asks you to plot a point on a graph.

", "ungrouped_variables": ["a", "b"], "advice": "

The correct position of the point A is shown in the graph below.

\n

Its $x$-coordinate is $\\var{a}$, so it is this distance from the origin in the horizontal direction (positive is to the right and negative is to the left).

\n

Its $y$-coordinate is $\\var{b}$, so it is this distance from the origin in the vertical direction (positive is upwards and negative is downwards).

\n

{dragpointafter()}

", "type": "question", "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/"}]}