// Numbas version: exam_results_page_options {"name": "Sketching graphs: sketch log_2", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variables": {"y": {"description": "", "definition": "[ln(x[0])/ln(2),\n ln(x[1])/ln(2),\n ln(x[2])/ln(2),\n ln(x[3])/ln(2),\n ln(x[4])/ln(2),\n ln(x[5])/ln(2),\n ln(x[6])/ln(2),\n ln(x[7])/ln(2)]", "templateType": "anything", "group": "Ungrouped variables", "name": "y"}, "x": {"description": "

The y-intercept.

", "definition": "[2,4,8,16,1,0.5,0.25,0.125]", "templateType": "anything", "group": "Ungrouped variables", "name": "x"}}, "advice": "

(i) {answer(x[0],y[0],x[1],y[1],x[2],y[2],x[3],y[3],x[4],y[4],x[5],y[5],x[6],y[6],x[7],y[7],0)}

\n

\n

See Lecture 1.4 for definition of logs and see 6.3 for connection between functions and graphs.

", "rulesets": {}, "name": "Sketching graphs: sketch log_2", "preamble": {"css": "", "js": ""}, "functions": {"answer": {"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"]], "language": "javascript", "type": "html", "definition": "// set up the board\nvar xmin = -5;\nvar xmax = 20;\nvar ymin = -5;\nvar ymax = 5;\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 Math.log(x)/Math.log(2);}\n var f2 = function(x) {return Math.pow(2,x/5);}\n var f3 = function(x) {return Math.pow(x,0.5);}\n var f4 = function(x) {return (x*0.5-4)*(x*0.5-4);}\n\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], {strokeWidth:2},-0.01, 5);\n break;\n \n case 3:\n board.create('functiongraph', [f3], {strokeWidth:2}, -0.01, 5);\n break;\n \n case 4:\n board.create('functiongraph', [f4], {strokeWidth:2});\n break;\n}\n \n \n \nreturn div;\n\n\n"}, "dragpoint": {"parameters": [], "language": "javascript", "type": "html", "definition": "// set up the board\nvar xmin = -5;\nvar xmax = 20;\nvar ymin = -5;\nvar ymax = 5;\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',[-4,0],{size:3});\nvar b = board.create('point',[-3,0],{size:3});\nvar c = board.create('point',[-2,0],{size:3});\nvar d = board.create('point',[-1,0],{size:3});\nvar e = board.create('point',[0,0],{size:3});\nvar f = board.create('point',[1,0],{size:3});\nvar g = board.create('point',[2,0],{size:3});\nvar h = board.create('point',[3,0],{size:3});\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"}}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Student is asked to sketch $f(x)=\\log_2(x)$, by plotting several points and selecting the correct graph.

"}, "variable_groups": [], "statement": "", "tags": [], "parts": [{"gaps": [{"allowFractions": false, "numColumns": "2", "correctAnswer": "matrix([x[0],y[0]])", "customName": "", "useCustomName": false, "showCorrectAnswer": true, "marks": "0.25", "type": "matrix", "extendBaseMarkingAlgorithm": true, "numRows": 1, "tolerance": "0.1", "variableReplacements": [], "adaptiveMarkingPenalty": 0, "correctAnswerFractions": false, "scripts": {}, "markPerCell": false, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "unitTests": [], "variableReplacementStrategy": "originalfirst", "allowResize": false}, {"allowFractions": false, "numColumns": "2", "correctAnswer": "matrix([x[1],y[1]])", "customName": "", "useCustomName": false, "showCorrectAnswer": true, "marks": "0.25", "type": "matrix", "extendBaseMarkingAlgorithm": true, "numRows": 1, "tolerance": "0.1", "variableReplacements": [], "adaptiveMarkingPenalty": 0, "correctAnswerFractions": false, "scripts": {}, "markPerCell": false, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "unitTests": [], "variableReplacementStrategy": "originalfirst", "allowResize": false}, {"allowFractions": false, "numColumns": "2", "correctAnswer": "matrix([x[2],y[2]])", "customName": "", "useCustomName": false, "showCorrectAnswer": true, "marks": "0.25", "type": "matrix", "extendBaseMarkingAlgorithm": true, "numRows": 1, "tolerance": "0.1", "variableReplacements": [], "adaptiveMarkingPenalty": 0, "correctAnswerFractions": false, "scripts": {}, "markPerCell": false, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "unitTests": [], "variableReplacementStrategy": "originalfirst", "allowResize": false}, {"allowFractions": false, "numColumns": "2", "correctAnswer": "matrix([x[3],y[3]])", "customName": "", "useCustomName": false, "showCorrectAnswer": true, "marks": "0.25", "type": "matrix", "extendBaseMarkingAlgorithm": true, "numRows": 1, "tolerance": "0.1", "variableReplacements": [], "adaptiveMarkingPenalty": 0, "correctAnswerFractions": false, "scripts": {}, "markPerCell": false, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "unitTests": [], "variableReplacementStrategy": "originalfirst", "allowResize": false}, {"allowFractions": false, "numColumns": "2", "correctAnswer": "matrix([x[4],y[4]])", "customName": "", "useCustomName": false, "showCorrectAnswer": true, "marks": "0.25", "type": "matrix", "extendBaseMarkingAlgorithm": true, "numRows": 1, "tolerance": "0.1", "variableReplacements": [], "adaptiveMarkingPenalty": 0, "correctAnswerFractions": false, "scripts": {}, "markPerCell": false, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "unitTests": [], "variableReplacementStrategy": "originalfirst", "allowResize": false}, {"allowFractions": false, "numColumns": "2", "correctAnswer": "matrix([x[5],y[5]])", "customName": "", "useCustomName": false, "showCorrectAnswer": true, "marks": "0.25", "type": "matrix", "extendBaseMarkingAlgorithm": true, "numRows": 1, "tolerance": "0.1", "variableReplacements": [], "adaptiveMarkingPenalty": 0, "correctAnswerFractions": false, "scripts": {}, "markPerCell": false, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "unitTests": [], "variableReplacementStrategy": "originalfirst", "allowResize": false}, {"allowFractions": false, "numColumns": "2", "correctAnswer": "matrix([x[6],y[6]])", "customName": "", "useCustomName": false, "showCorrectAnswer": true, "marks": "0.25", "type": "matrix", "extendBaseMarkingAlgorithm": true, "numRows": 1, "tolerance": "0.1", "variableReplacements": [], "adaptiveMarkingPenalty": 0, "correctAnswerFractions": false, "scripts": {}, "markPerCell": false, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "unitTests": [], "variableReplacementStrategy": "originalfirst", "allowResize": false}, {"allowFractions": false, "numColumns": "2", "correctAnswer": "matrix([x[7],y[7]])", "customName": "", "useCustomName": false, "showCorrectAnswer": true, "marks": "0.25", "type": "matrix", "extendBaseMarkingAlgorithm": true, "numRows": 1, "tolerance": "0.1", "variableReplacements": [], "adaptiveMarkingPenalty": 0, "correctAnswerFractions": false, "scripts": {}, "markPerCell": false, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "unitTests": [], "variableReplacementStrategy": "originalfirst", "allowResize": false}], "customName": "", "useCustomName": false, "showCorrectAnswer": true, "marks": 0, "type": "gapfill", "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "adaptiveMarkingPenalty": 0, "prompt": "

{dragpoint()}

\n

We want to sketch a graph of the function $f(x) = \\log_2(x)$.  We will do this be plotting several points, and then seeing the overall pattern that emerges.

\n

\n

By filling in a table like the one below, drag the points A to H to the correct location.

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
PointABCDEFGH
$x$$\\var{x[0]}$$\\var{x[1]}$$\\var{x[2]}$$\\var{x[3]}$$\\var{x[4]}$$\\var{x[5]}$$\\var{x[6]}$$\\var{x[7]}$
$f(x)$
\n

\n

\n

(Note, to be marked correctly, you only need to move the points to within 0.1 of the exact location.)

\n

", "scripts": {}, "sortAnswers": false, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "unitTests": [], "variableReplacementStrategy": "originalfirst"}, {"gaps": [{"distractors": ["", "", "", ""], "customName": "", "showCorrectAnswer": true, "type": "1_n_2", "variableReplacements": [], "maxMarks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "choices": ["

{answer(x[0],y[0],x[1],y[1],x[2],y[2],x[3],y[3],x[4],y[4],x[5],y[5],x[6],y[6],x[7],y[7],1)}

", "

{answer(x[0],y[0],x[1],y[1],x[2],y[2],x[3],y[3],x[4],y[4],x[5],y[5],x[6],y[6],x[7],y[7],2)}

", "

{answer(x[0],y[0],x[1],y[1],x[2],y[2],x[3],y[3],x[4],y[4],x[5],y[5],x[6],y[6],x[7],y[7],3)}

", "

{answer(x[0],y[0],x[1],y[1],x[2],y[2],x[3],y[3],x[4],y[4],x[5],y[5],x[6],y[6],x[7],y[7],4)}

"], "displayType": "radiogroup", "useCustomName": false, "unitTests": [], "matrix": ["1", 0, 0, 0], "marks": 0, "adaptiveMarkingPenalty": 0, "displayColumns": 0, "minMarks": 0, "showFeedbackIcon": true, "shuffleChoices": true, "showCellAnswerState": true}], "customName": "", "useCustomName": false, "showCorrectAnswer": true, "marks": 0, "type": "gapfill", "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "adaptiveMarkingPenalty": 0, "prompt": "

Hence, select the graph of $f(x)=\\log_2(x)$ from below:

\n

[[0]]

\n

\n

", "scripts": {}, "sortAnswers": false, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "unitTests": [], "variableReplacementStrategy": "originalfirst"}, {"distractors": ["", "", "", "", "", ""], "customName": "", "showCorrectAnswer": true, "type": "m_n_2", "variableReplacements": [], "minAnswers": "4", "maxMarks": 0, "scripts": {}, "customMarkingAlgorithm": "", "prompt": "

Which of the following are true for the graph of $\\log_2(x)$.

", "extendBaseMarkingAlgorithm": true, "variableReplacementStrategy": "originalfirst", "choices": ["You can only input positive values of $x$ into $\\log_2(x)$", "The $y$-axis is an asymptote", "As you increase $x$, the graph gets less and less steep", "The $x$-axis is an asymptote", "To increase the $y$ coordinate by $1$, you need to double the $x$ coordinate.", "If you increase the $x$-coordinate by $1$, the $y$-coordinate doubles."], "displayType": "checkbox", "useCustomName": false, "unitTests": [], "matrix": ["0.75", "0.75", "0.75", "-3", "0.75", "-3"], "marks": 0, "maxAnswers": 0, "warningType": "none", "adaptiveMarkingPenalty": 0, "showCellAnswerState": true, "minMarks": 0, "showFeedbackIcon": true, "shuffleChoices": true, "displayColumns": "1"}], "extensions": ["jsxgraph"], "ungrouped_variables": ["x", "y"], "variablesTest": {"condition": "", "maxRuns": 100}, "contributors": [{"name": "Lovkush Agarwal", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1358/"}]}]}], "contributors": [{"name": "Lovkush Agarwal", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1358/"}]}