// Numbas version: exam_results_page_options {"name": "Vicky's copy of Sketching graphs: sketch 1/x", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"advice": "

Student sketches 1/x, by plotting several points and then selecting the graph from a list

", "licence": "Creative Commons Attribution 4.0 International"}, "tags": [], "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "extensions": ["jsxgraph"], "functions": {"dragpoint": {"type": "html", "definition": "// set up the board\nvar xmin = -7;\nvar xmax = 7;\nvar ymin = -7;\nvar ymax = 7;\n\nvar div = Numbas.extensions.jsxgraph.makeBoard('700px','700px',\n {boundingBox: [xmin,ymax,xmax,ymin],\n grid:true,labels:true});\nvar board = div.board;\n\n// create the x-axis and y-axis\nvar xaxis = board.create('axis',[[0,0],[1,0]]);\n\n// create the y-axis\nvar yaxis = board.create('axis',[[0,0],[0,1]], );\n\n\n\nvar a = board.create('point',[-3,0],{size:2});\nvar b = board.create('point',[-2,0],{size:2});\nvar c = board.create('point',[-1,0],{size:2});\nvar d = board.create('point',[-0,0],{size:2});\nvar e = board.create('point',[1,0],{size:2});\nvar f = board.create('point',[2,0],{size:2});\nvar g = board.create('point',[3,0],{size:2});\nvar h = board.create('point',[4,0],{size:2});\n\na.on('drag',function(){\n var x0 = Numbas.math.niceNumber(a.X());\n var y0 = Numbas.math.niceNumber(a.Y());\n Numbas.exam.currentQuestion.parts[0].gaps[0].display.studentAnswer([[x0,y0]]);\n});\nb.on('drag',function(){\n var x0 = Numbas.math.niceNumber(b.X());\n var y0 = Numbas.math.niceNumber(b.Y());\n Numbas.exam.currentQuestion.parts[0].gaps[1].display.studentAnswer([[x0,y0]]);\n});\nc.on('drag',function(){\n var x0 = Numbas.math.niceNumber(c.X());\n var y0 = Numbas.math.niceNumber(c.Y());\n Numbas.exam.currentQuestion.parts[0].gaps[2].display.studentAnswer([[x0,y0]]);\n});\nd.on('drag',function(){\n var x0 = Numbas.math.niceNumber(d.X());\n var y0 = Numbas.math.niceNumber(d.Y());\n Numbas.exam.currentQuestion.parts[0].gaps[3].display.studentAnswer([[x0,y0]]);\n});\ne.on('drag',function(){\n var x0 = Numbas.math.niceNumber(e.X());\n var y0 = Numbas.math.niceNumber(e.Y());\n Numbas.exam.currentQuestion.parts[0].gaps[4].display.studentAnswer([[x0,y0]]);\n});\nf.on('drag',function(){\n var x0 = Numbas.math.niceNumber(f.X());\n var y0 = Numbas.math.niceNumber(f.Y());\n Numbas.exam.currentQuestion.parts[0].gaps[5].display.studentAnswer([[x0,y0]]);\n});\ng.on('drag',function(){\n var x0 = Numbas.math.niceNumber(g.X());\n var y0 = Numbas.math.niceNumber(g.Y());\n Numbas.exam.currentQuestion.parts[0].gaps[6].display.studentAnswer([[x0,y0]]);\n});\nh.on('drag',function(){\n var x0 = Numbas.math.niceNumber(h.X());\n var y0 = Numbas.math.niceNumber(h.Y());\n Numbas.exam.currentQuestion.parts[0].gaps[7].display.studentAnswer([[x0,y0]]);\n});\n\nreturn div;\n\n\n", "language": "javascript", "parameters": []}, "answer": {"type": "html", "definition": "// set up the board\nvar xmin = -7;\nvar xmax = 7;\nvar ymin = -7;\nvar ymax = 7;\n\n\n\n\n\nif (n==0) {\nvar div = Numbas.extensions.jsxgraph.makeBoard('700px','700px',\n {boundingBox: [xmin,ymax,xmax,ymin],\n grid:true,labels:true});\n}\n\nelse {\n var div = Numbas.extensions.jsxgraph.makeBoard('200px','200px',\n {boundingBox: [xmin,ymax,xmax,ymin],\n grid:true,labels:true});\n}\n\n \n\n\nvar board = div.board;\n\n// create the x-axis and y-axis\nvar xaxis = board.create('axis',[[0,0],[1,0]]);\n\n// create the y-axis\nvar yaxis = board.create('axis',[[0,0],[0,1]]);\n\n\n//define functions here\n var f1 = function(x) {return 1/x;}\n var f2 = function(x) {return 1/x;}\n var f3 = function(x) {return 4*Math.sin(x);}\n var f4 = function(x) {return x*x*x*0.05;}\n\n \n//PLOT the function\nswitch(n) {\n case 0:\n var a = board.create('point',[x0,y0],{size:3});\n var b = board.create('point',[x1,y1],{size:3});\n var c = board.create('point',[x2,y2],{size:3});\n var d = board.create('point',[x3,y3],{size:3});\n var e = board.create('point',[x4,y4],{size:3});\n var f = board.create('point',[x5,y5],{size:3});\n var g = board.create('point',[x6,y6],{size:3});\n var h = board.create('point',[x7,y7],{size:3});\n break;\n \n case 1:\n board.create('functiongraph', [f1], {strokeWidth:2});\n break;\n \n case 2:\n board.create('functiongraph', [f2,0.01,7], {strokeWidth:2});\n break;\n \n \n case 3:\n board.create('functiongraph', [f3], {strokeWidth:2});\n break;\n \n case 4:\n board.create('functiongraph', [f4], {strokeWidth:2});\n break;\n}\n \n \n \nreturn div;\n\n\n", "language": "javascript", "parameters": [["x0", "number"], ["y0", "number"], ["x1", "number"], ["y1", "number"], ["x2", "number"], ["y2", "number"], ["x3", "number"], ["y3", "number"], ["x4", "number"], ["y4", "number"], ["x5", "number"], ["y5", "number"], ["x6", "number"], ["y6", "number"], ["x7", "number"], ["y7", "number"], ["n", "number"]]}}, "variables": {"x": {"templateType": "anything", "definition": "[1,2,3,1/2,\n random([1/3,1/4,1/5]),\n -1,\n random([-2,-3,-4]),\n random([-1/2,-1/3,-1/4,-1/5])]", "description": "

The y-intercept.

", "group": "Ungrouped variables", "name": "x"}, "y": {"templateType": "anything", "definition": "\n[1/(x[0]),\n 1/(x[1]),\n 1/(x[2]),\n 1/(x[3]),\n 1/(x[4]),\n 1/(x[5]),\n 1/(x[6]),\n 1/(x[7])]", "description": "", "group": "Ungrouped variables", "name": "y"}}, "statement": "

This is a non-calculator question.

", "preamble": {"js": "", "css": ""}, "name": "Vicky's copy of Sketching graphs: sketch 1/x", "ungrouped_variables": ["x", "y"], "parts": [{"scripts": {}, "unitTests": [], "type": "gapfill", "sortAnswers": false, "variableReplacements": [], "prompt": "

Select the graph of $f(x)=\\frac{1}{x}$ from below:

\n

[[8]]

\n

", "