// Numbas version: exam_results_page_options {"name": "Mark points crossing the axes", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"statement": "

The graph below shows the line with equation $y = \\simplify[fractionnumbers,all,!noleadingminus]{{slope}x + {y_intercept}}$.

", "type": "question", "variables": {"slope": {"name": "slope", "templateType": "anything", "definition": "-x_intercept/y_intercept", "description": "", "group": "Ungrouped variables"}, "y_intercept": {"name": "y_intercept", "templateType": "anything", "definition": "random(-2..2#0.1 except 0)", "description": "", "group": "Ungrouped variables"}, "x_intercept": {"name": "x_intercept", "templateType": "anything", "definition": "random(-2..2#0.1 except 0)", "description": "", "group": "Ungrouped variables"}}, "name": "Mark points crossing the axes", "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

A line with random $x$- and $y$- intercepts is plotted, and you have to drag two dots over the points where the line crosses the $x$ and $y$ axes.

"}, "variablesTest": {"maxRuns": 100, "condition": ""}, "parts": [{"type": "gapfill", "scripts": {}, "variableReplacementStrategy": "originalfirst", "marks": 0, "variableReplacements": [], "showCorrectAnswer": true, "gaps": [{"notationStyles": ["plain", "en", "si-en"], "scripts": {}, "variableReplacementStrategy": "originalfirst", "marks": 1, "type": "numberentry", "showCorrectAnswer": true, "maxValue": "x_intercept", "minValue": "x_intercept", "allowFractions": false, "correctAnswerStyle": "plain", "variableReplacements": [], "correctAnswerFraction": false, "showFeedbackIcon": true}, {"notationStyles": ["plain", "en", "si-en"], "scripts": {}, "variableReplacementStrategy": "originalfirst", "marks": 1, "type": "numberentry", "showCorrectAnswer": true, "maxValue": "0", "minValue": "0", "allowFractions": false, "correctAnswerStyle": "plain", "variableReplacements": [], "correctAnswerFraction": false, "showFeedbackIcon": true}, {"notationStyles": ["plain", "en", "si-en"], "scripts": {}, "variableReplacementStrategy": "originalfirst", "marks": 1, "type": "numberentry", "showCorrectAnswer": true, "maxValue": "0", "minValue": "0", "allowFractions": false, "correctAnswerStyle": "plain", "variableReplacements": [], "correctAnswerFraction": false, "showFeedbackIcon": true}, {"notationStyles": ["plain", "en", "si-en"], "scripts": {}, "variableReplacementStrategy": "originalfirst", "marks": 1, "type": "numberentry", "showCorrectAnswer": true, "maxValue": "y_intercept", "minValue": "y_intercept", "allowFractions": false, "correctAnswerStyle": "plain", "variableReplacements": [], "correctAnswerFraction": false, "showFeedbackIcon": true}], "prompt": "

{dragpoint()}

\n

Move point $X$ to the point where the line intercepts the $x$-axis.

\n

Move point $Y$ to the point where the line intercepts the $y$-axis.

\n

", "showFeedbackIcon": true}], "functions": {"dragpoint": {"type": "html", "definition": "var div = Numbas.extensions.jsxgraph.makeBoard('600px','400px',{boundingBox:[-4.5,4.5,3,-3],grid:false});\nvar board = div.board;\n\nvar x_intercept = Numbas.jme.unwrapValue(scope.variables['x_intercept']);\nvar y_intercept = Numbas.jme.unwrapValue(scope.variables['y_intercept']);\n\nboard.create('line',[[0,y_intercept],[x_intercept,0]]);\n\nvar a = board.create('point',[0,0],{name:'X', snapSizeX: 0.1, snapSizeY: 0.1, snapToGrid: 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.getPart('p0g0').display.studentAnswer(x);\n Numbas.exam.currentQuestion.getPart('p0g1').display.studentAnswer(y);\n});\n\nvar b = board.create('point',[1,0],{name:'Y', snapSizeX: 0.1, snapSizeY: 0.1, snapToGrid: true});\nb.on('drag',function(){\n var x = Numbas.math.niceNumber(b.X());\n var y = Numbas.math.niceNumber(b.Y());\n Numbas.exam.currentQuestion.getPart('p0g2').display.studentAnswer(x);\n Numbas.exam.currentQuestion.getPart('p0g3').display.studentAnswer(y);\n});\n\nreturn div;\n\n", "language": "javascript", "parameters": []}}, "tags": [], "extensions": ["jsxgraph"], "variable_groups": [], "rulesets": {}, "preamble": {"css": "", "js": ""}, "ungrouped_variables": ["x_intercept", "y_intercept", "slope"], "advice": "

.

", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}