// Numbas version: exam_results_page_options {"name": "Graph1", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variablesTest": {"maxRuns": 100, "condition": ""}, "parts": [{"gaps": [{"answer": "{a}x+{b}", "variableReplacements": [], "marks": 1, "showCorrectAnswer": true, "checkingtype": "absdiff", "checkvariablenames": false, "showpreview": true, "answersimplification": "all", "expectedvariablenames": [], "scripts": {}, "type": "jme", "vsetrange": [0, 1], "checkingaccuracy": 0.001, "vsetrangepoints": 5, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst"}], "type": "gapfill", "marks": 0, "showCorrectAnswer": true, "variableReplacements": [], "showFeedbackIcon": true, "prompt": "

Write the equation of the line in the diagram. The line described by your equation will also be drawn on the diagram.

\n

$y=\\;$[[0]]

", "variableReplacementStrategy": "originalfirst", "scripts": {}}], "functions": {"eqnline": {"parameters": [["a", "number"], ["b", "number"], ["x2", "number"], ["y2", "number"]], "language": "javascript", "definition": "// This function creates the board and sets it up, then returns an\n// HTML div tag containing the board.\n \n// First, make the JSXGraph board.\n// The function provided by the JSXGraph extension wraps the board up in \n// a div tag so that it's easier to embed in the page.\nvar div = Numbas.extensions.jsxgraph.makeBoard('800px','400px',\n{boundingBox: [1991.1,7.5,2002.5,-0.5],\n axis: false,\n showNavigation: false,\n grid: true\n});\n\nboard = div.board;\nboard.suspendUpdate(); \n\n//var s = board.createElement('slider', [[8,7],[11,7],[1,1,1.5]], {name:'S',strokeColor:'black',fillColor:'white'});\nvar f = [function(){return (4.5).toFixed(2);},\n function(){return (3).toFixed(2);},\n function(){return (3).toFixed(2);},\n function(){return (2).toFixed(2);},\n function(){return (2.5).toFixed(2);},\n function(){return (5.5).toFixed(2);},\n function(){return (2.5).toFixed(2);},\n function(){return (4.5).toFixed(2);},\n function(){return (3.5).toFixed(2);},\n function(){return (3).toFixed(2);},\n function(){return (1.5).toFixed(2);}\n ];\nvar g = [function(){return (1992).toFixed(2);},\n function(){return (1993).toFixed(2);},\n function(){return (1994).toFixed(2);},\n function(){return (1995).toFixed(2);},\n function(){return (1996).toFixed(2);},\n function(){return (1997).toFixed(2);},\n function(){return (1998).toFixed(2);},\n function(){return (1999).toFixed(2);},\n function(){return (2000).toFixed(2);},\n function(){return (2001).toFixed(2);},\n function(){return (2002).toFixed(2);}\n ];\n\nvar chart = board.createElement('chart', [g,f], \n {chartStyle:'bar', width:0.8,\n colorArray:['#8E1B77','#BE1679','#DC1765','#DA2130','#DB311B','#DF4917','#E36317','#E87F1A','#F1B112','#FCF302','#C1E212'], shadow:false, opacity:0.9});\n\nboard.unsuspendUpdate();\n\n\n// div.board is the object created by JSXGraph, which you use to \n// manipulate elements\n//var board = div.board; \n\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',[[1991.4,0],[1991.4,1]], { strokeColor: 'black', fixed: true });\nvar yticks = board.create('ticks',[yaxis,1],{\ndrawLabels: true,\nlabel: {offset: [-20, 0]},\nminorTicks: 0\n});\n\nreturn div;", "type": "html"}}, "name": "Graph1", "ungrouped_variables": ["x2", "b", "a", "y2"], "tags": [], "statement": "

{eqnline(a,b,x2,y2)}

\n

The above bar graph shows wheat output in kilotons each year.

\n

Which year had the highest wheat output?

", "rulesets": {}, "variables": {"y2": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "name": "y2", "definition": "x2*a+b"}, "a": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "name": "a", "definition": "random(-4..4 except 0)"}, "b": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "name": "b", "definition": "random(-6..6 except [0,a])"}, "x2": {"group": "Ungrouped variables", "templateType": "anything", "description": "", "name": "x2", "definition": "random(-3..3 except -1..1)"}}, "metadata": {"description": "

There are copious comments in the definition of the function eqnline about the voodoo needed to have a JSXGraph diagram interact with the input box for a part.

", "licence": "Creative Commons Attribution 4.0 International"}, "extensions": ["jsxgraph"], "preamble": {"js": "", "css": ""}, "advice": "\n

First Method.

\n

You are given that the line goes through $(0,\\var{b})$ and $(-1,\\var{b-a})$ and the equation of the line is of the form $y=ax+b$

\n

Hence:

\n

1) At $x=0$ we have $y=\\var{b}$, and this gives $\\var{b}=a \\times 0 +b =b$ on putting $x=0$ into $y=ax+b$.

\n

So $b=\\var{b}$.

\n

2) At $x=-1$ we have $y=\\var{b-a}$, and this gives $\\var{b-a}=a \\times (-1) +b =\\simplify[all,!collectNumbers]{-a+{b}}$ on putting $x=-1$ into $y=ax+b$.

\n

On rearranging we obtain $a=\\simplify[all,!collectNumbers]{{b}-{b-a}}=\\var{a}$. 

\n

So $a=\\var{a}$.

\n

So the equation of the line is $\\simplify{y={a}*x+{b}}$.

\n

Second Method.

\n

The equation $y=ax+b$ tells us that the graph crosses the $y$-axis (when $x=0$) at $y=b$.

\n

So looking at the graph we immediately see that $b=\\var{b}$.

\n

$a$ is the gradient of the line and is given by the change from $(-1,\\var{b-a})$ to $(0,\\var{b})$:

\n

\\[a=\\frac{\\text{Change in y}}{\\text{Change in x}}=\\frac{\\simplify[all,!collectNumbers]{({b-a}-{b})}}{-1-0}=\\var{a}\\]

\n\n", "variable_groups": [], "type": "question", "contributors": [{"name": "Raymond Corrigan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2229/"}]}]}], "contributors": [{"name": "Raymond Corrigan", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2229/"}]}