// Numbas version: exam_results_page_options {"name": "Cubic graph - student finds equation", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {"eqnline": {"definition": "// This function creates the board and sets it up, then returns an\n// HTML div tag containing the board.\n \n// The line is described by the equation \n// y = a*x + b\n\n// This function takes as its parameters the coefficients a and b,\n// and the coordinates (x2,y2) of a point on the line.\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('400px','400px',\n{boundingBox: [-13,22,13,-22],\n axis: false,\n showNavigation: false,\n grid: true\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,2],{\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,2],{\ndrawLabels: true,\nlabel: {offset: [-20, 0]},\nminorTicks: 0\n});\n\n// mark the two given points - one on the y-axis, and one at (x2,y2)\n\n\n\n\nboard.create('functiongraph',[function(x){ return (x-a)*(x-b)*(x-x2);},-13,13]);\n\nreturn div;", "type": "html", "language": "javascript", "parameters": [["a", "number"], ["b", "number"], ["x2", "number"], ["y2", "number"]]}}, "ungrouped_variables": ["a", "x2", "b", "y2", "c", "coeff2", "coeff1", "coeff0", "y"], "name": "Cubic graph - student finds equation", "tags": ["graphs", "jsxgraph", "Jsxgraph"], "preamble": {"css": "", "js": ""}, "advice": "
We know that the graph crosses the $x$-axis at $(\\var{x2},0)$, $(\\var{a},0)$ and $(\\var{b},0)$. Since this is a cubic, we know our equations has three roots, and by the previous observation, they are at $\\var{x2}$, $\\var{a}$ and $\\var{b}$. Hence we can write our equation as $\\simplify{y=(x-{a})(x-{b})(x-{x2})}$ which simplifies to $\\simplify{y=x^3+{coeff2}x^2+{coeff1}x+{coeff0}}$.
", "rulesets": {}, "parts": [{"prompt": "Write the equation of the line in the diagram.
\n$y=\\;$[[0]]
", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "answersimplification": "all", "scripts": {}, "answer": "x^3+{coeff2}x^2+{coeff1}x+{coeff0}", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}], "statement": "{eqnline(a,b,x2,y2)}
\nThe above graph shows a graph of a cubic equation, it is your task to find this equation.
\nYou are given the three points of the curve with the x axis, $(\\var{x2},0)$, $(\\var{b},0)$ and $(\\var{a},0)$, and the $y$-intercept at $(0, \\var{y})$ as indicated on the diagram.
", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"a": {"definition": "random(-4..4 except 0)", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "description": ""}, "c": {"definition": "random(-5..5 except [0,b,-b,a,-a])", "templateType": "anything", "group": "Ungrouped variables", "name": "c", "description": ""}, "b": {"definition": "random(-5..5 except [0,a,-a,x2])", "templateType": "anything", "group": "Ungrouped variables", "name": "b", "description": ""}, "y2": {"definition": "x2*a+b", "templateType": "anything", "group": "Ungrouped variables", "name": "y2", "description": ""}, "x2": {"definition": "random(-4..4 except 0 except a except -a)", "templateType": "anything", "group": "Ungrouped variables", "name": "x2", "description": ""}, "y": {"definition": "-a*b*x2", "templateType": "anything", "group": "Ungrouped variables", "name": "y", "description": ""}, "coeff2": {"definition": "-({a}+{b}+{x2})", "templateType": "anything", "group": "Ungrouped variables", "name": "coeff2", "description": ""}, "coeff1": {"definition": "({a}{b}+{b}{x2}+{a}{x2})", "templateType": "anything", "group": "Ungrouped variables", "name": "coeff1", "description": ""}, "coeff0": {"definition": "-{a}{b}{x2}", "templateType": "anything", "group": "Ungrouped variables", "name": "coeff0", "description": ""}}, "metadata": {"notes": "", "description": "Students are given a graph of a cubic, and are asked to find the equation for it.
", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}], "contributors": [{"name": "joshua boddy", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/557/"}]}]}], "contributors": [{"name": "joshua boddy", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/557/"}]}