// Numbas version: exam_results_page_options {"name": "a cos(bx) graph", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {"eqncos": {"definition": "// This function creates the board and sets it up, then returns an\n// HTML div tag containing the board.\n\n//Put in your values of x here\n\nvar x_min = -2*3.14159;\nvar x_max = 2*3.14159;\nvar y_min = -3;\n//var y_min = -(a*b+2);\n//var y_min = (((a*b)-((a+b)/2)^2)-2);\n\nvar y_max = 3;\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('600px','600px',\n//{boundingBox: [-8,10,8,-10],\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// 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 // PUT YOUR FUNCTION HERE\n\n\n\nboard.create('functiongraph',[function(x){ return a*Math.cos(b*x);},x_min,x_max]);\n\n\n\nreturn div;", "type": "html", "language": "javascript", "parameters": [["a", "number"], ["b", "number"]]}}, "ungrouped_variables": ["a", "b"], "name": "a cos(bx) graph", "tags": [], "preamble": {"css": "", "js": ""}, "advice": "

We know that the graph crosses the $x$-axis at both $(\\var{a},0)$ and $(\\var{b},0)$. Since this is a quadratic, we know our equations has two roots, and by the previous observation, they are at $\\var{a}$ and $\\var{b}$. Hence we can write our equation as $\\simplify{y=(x-{a})(x-{b})}$ which simplifies to $\\simplify{y=x^2-({a}+{b})x+({a}*{b})}$.

\n

\n

To find the coefficients of the turning point of the quadratic, we know the x-coordinate of the turning point will correspond to the solution to $dy/dx=0$. So we get $\\simplify{2x-({a}+{b})}=0$ hence $\\simplify{x=({a}+{b})/2}$. We substitute this value of x back into the equation of the quadratic to find the corresponding y-coordinate.

", "rulesets": {}, "parts": [{"prompt": "

The graph is of the form $a\\cos(bx)$ where $b$ is a positive integers and $a$ is a positive or negative integer.

\n

$y(x)=$[[0]] cos([[1]]$x$)

\n

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"integerPartialCredit": 0, "integerAnswer": true, "allowFractions": false, "variableReplacements": [], "maxValue": "{a}", "minValue": "{a}", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": "1", "type": "numberentry"}, {"integerPartialCredit": 0, "integerAnswer": true, "allowFractions": false, "variableReplacements": [], "maxValue": "{b}", "minValue": "{b}", "variableReplacementStrategy": "originalfirst", "correctAnswerFraction": false, "showCorrectAnswer": true, "scripts": {}, "marks": 1, "type": "numberentry"}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}], "extensions": ["jsxgraph"], "statement": "

{eqncos(a,b)}

\n

Give the equation of the graph.

\n

              

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"a": {"definition": "random(-1,-2,-3,1,2,3)", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "description": ""}, "b": {"definition": "random(1..3)", "templateType": "anything", "group": "Ungrouped variables", "name": "b", "description": ""}}, "metadata": {"description": "

Given the original formula the student enters the transformed formula

", "licence": "Creative Commons Attribution 4.0 International"}, "type": "question", "showQuestionGroupNames": false, "question_groups": [{"name": "", "pickingStrategy": "all-ordered", "pickQuestions": 0, "questions": []}], "contributors": [{"name": "Paul Howes", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/632/"}]}]}], "contributors": [{"name": "Paul Howes", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/632/"}]}