// Numbas version: exam_results_page_options {"name": "Linjer som krysser akser", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"metadata": {"description": "

En linje

\n

En linje med en tilfeldig \$x\$- og \$y\$- skjæring plottes, og du må dra to punkter til de stedene der linja krysser \$x\$- og \$y\$- aksene.

", "licence": "Creative Commons Attribution 4.0 International"}, "ungrouped_variables": ["x_intercept", "y_intercept", "slope"], "rulesets": {}, "statement": "

Grafen under viser linja med likning \$y = \\simplify[fractionnumbers,all,!noleadingminus]{{slope}x + {y_intercept}}\$.

", "preamble": {"css": "", "js": ""}, "variables": {"y_intercept": {"group": "Ungrouped variables", "name": "y_intercept", "templateType": "anything", "description": "", "definition": "random(-2..2#0.1 except 0)"}, "slope": {"group": "Ungrouped variables", "name": "slope", "templateType": "anything", "description": "", "definition": "-x_intercept/y_intercept"}, "x_intercept": {"group": "Ungrouped variables", "name": "x_intercept", "templateType": "anything", "description": "", "definition": "random(-2..2#0.1 except 0)"}}, "tags": [], "name": "Linjer som krysser akser", "extensions": ["jsxgraph"], "advice": "

.

{dragpoint()}

\n

Dra punktet \$X\$ til det stedet der linja krysser \$x\$-aksen.

\n

Dra punktet \$Y\$ til det stedet der linja krysser \$y\$-aksen.

\n

", "type": "gapfill", "variableReplacementStrategy": "originalfirst", "scripts": {}}], "functions": {"dragpoint": {"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", "type": "html", "parameters": [], "language": "javascript"}}, "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "type": "question", "contributors": [{"name": "Morten Brekke", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/478/"}]}]}], "contributors": [{"name": "Morten Brekke", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/478/"}]}