// Numbas version: exam_results_page_options {"name": "Reading a graph of a straight line.", "extensions": ["geogebra", "jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"advice": "

(i) To find \$f(\\var{x1})\$, you start at \$\\var{x1}\$ on the \$x\$-axis, go up or down until you reach the blue line, and then look at the \$y\$-coordinate. This \$y\$-coordinate is the answer.  In this question, after going up/down from \$\\var{x1}\$, we reach the \$y\$-coordinate \$\\var{y1}\$, so the answer is \$f(\\var{x1})=\\var{y1}\$.

\n

(ii) There are two options. The first option (which is not efficient) is trial-and-error: pick some random value of \$x\$ and determine \$f(x)\$. If \$f(x) = \\var{y2}\$, then your pick is the answer.  If not, then try a different value of \$x\$, hopefully getting closer and closer each time.   The second (and better) option is to 'work backwards' - we know what \$f(x)\$ should be, which means we know what the \$y\$-coordinate should be.  So start at \$\\var{y2}\$ on the \$y\$-axis, go left or right until you reach the blue line, and look at the \$x\$-coordinate. In this question, after going left/right from \$\\var{y2}\$, we reach the \$x\$-coordinate \$\\var{x2}\$, so this is the answer.  You can check this is correct: what is \$f(\\var{x2})\$? It is \$\\var{y2}\$, as we wanted!

\n

(iii) The \$y\$-intercept is the height at which the blue line touches the \$y\$-axis.  In this question, the blue line crosses the \$y\$-axis at a height of \$\\var{c}\$, so the answer is \$\\var{c}\$.

\n

(iv) To calculate the gradient, you choose two points which lie on the line, and calculate the change in height divided by the change in \$x\$.  It does not matter which two points you choose, but to make it easier, you should pick points whose coordinates are easy to read.  In this question, two points which are on the line are \$(\\var{x1}, \\var{y1})\$ and \$(\\var{x2},\\var{y2})\$.  Then the change of height is \$\\var{y2} - \\var{y1}\$ and the change in \$x\$ is \$\\var{x2} - \\var{x1}\$.  Dividing gives the answer \$\\var{m}\$, which is the number we want.

\n

(v) The equation of a line can be written as \$y = mx + c\$.  \$m\$ is the gradient and \$c\$ is the \$y\$-intercept.  But we have calculated these two quantities in the previous two questions: the \$y\$-intercept was \$\\var{c}\$ and the gradient was \$\\var{m}\$. Replacing \$m\$ and \$c\$ with these numbers gives the equation \$y= \\var{m}x + \\var{c}\$, which is the answer.

\n

(vi) This question is asking exactly the same thing as the question in (ii), but is phrased differently. This is because the definition of \$f^{-1}\$ is that it is the function which un-does what \$f\$ does.  For example, we know that \$f(\\var{x1})=\\var{y1}\$ - therefore, automatically, \$f^{-1}(\\var{y1})\$ has to be \$\\var{x1}\$.  Re-worded, \$f\$ maps \$\\var{x1}\$ to \$\\var{y1}\$, so because \$f^{-1}\$ un-does this, it means \$f^{-1}\$ maps \$\\var{y1}\$ back to \$\\var{x1}\$.   Back to the question at hand, it asked what \$f^{-1}(\\var{y2})\$ is.  By definition, this means we want to know what value of \$x\$ is needed to get \$f(x) = \\var{y2}\$, which is exactly what was asked in (ii).

", "name": "Reading a graph of a straight line.", "preamble": {"js": "", "css": ""}, "statement": "

", "functions": {"plotgraph": {"definition": "// This functions plots the graph of y=mx+c\n// It creates the board, sets it up, then returns an\n// HTML div tag containing the board.\n\n\n// Max and min x and y values for the axis.\nvar x_min = -10;\nvar x_max = 10;\nvar y_min = -10;\nvar y_max = 10;\n\n\n// First, make the JSXGraph board.\nvar div = Numbas.extensions.jsxgraph.makeBoard(\n '500px',\n '600px',\n {\n boundingBox: [x_min,y_max,x_max,y_min],\n axis: false,\n showNavigation: true,\n grid: true\n }\n);\n\n\n\n\n// div.board is the object created by JSXGraph, which you use to \n// manipulate elements\nvar board = div.board; \n\n// create the x-axis.\nvar xaxis = board.create('line',[[0,0],[1,0]], { strokeColor: 'black', fixed: true});\nvar xticks = board.create('ticks',[xaxis,1],{\n drawLabels: true,\n label: {offset: [-4, -10]},\n minorTicks: 0\n});\n\n// create the y-axis\nvar yaxis = board.create('line',[[0,0],[0,1]], { strokeColor: 'black', fixed: true });\nvar yticks = board.create('ticks',[yaxis,1],{\ndrawLabels: true,\nlabel: {offset: [-20, 0]},\nminorTicks: 0\n});\n\n\n\n\n// Plot the function.\n board.create('functiongraph',\n [function(x){ return m*x+c;},x_min,x_max]);\n\n\n\n\nreturn div;", "language": "javascript", "type": "html", "parameters": [["m", "number"], ["c", "number"]]}}, "ungrouped_variables": ["m_denom", "m", "x1", "x2", "y1", "y2", "c"], "variablesTest": {"condition": "max(abs(y1),abs(y2))<10", "maxRuns": 100}, "parts": [{"prompt": "

{plotgraph(m,c)}

\n

Above is the graph of some function \$f\$.

\n

What is \$f(\\var{x1})\$? [[0]]

\n

What value of \$x\$ do you need to get \$f(x) = \\var{y2}\$? [[1]]

\n

What is the y-intercept? [[2]]

\n

What is the gradient of the line? [[3]]

\n

What is the equation of the line? \$y=\$[[4]]

\n

The denominator of m, the gradient.

"}, "c": {"name": "c", "definition": "random(-4..4)", "group": "Ungrouped variables", "templateType": "anything", "description": "

y-intercept of the line

"}, "y1": {"name": "y1", "definition": "m*x1+c", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "x1": {"name": "x1", "definition": "random(-2..2)*m_denom", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "x2": {"name": "x2", "definition": "random(-2..2 except x1/m_denom)*m_denom", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "y2": {"name": "y2", "definition": "m*x2+c", "group": "Ungrouped variables", "templateType": "anything", "description": ""}, "m": {"name": "m", "definition": "if(m_denom=3, random(-5..5 except [-3,0,3])/3,\n if(m_denom=2,random(-5..5 except [-4,-2,0,2,4])/2,\n random(-2..2 except 0)\n ))", "group": "Ungrouped variables", "templateType": "anything", "description": "