// Numbas version: exam_results_page_options {"name": "Sin graph horizontal shift 1 (with answers using script to check)", "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('600px','600px',\n{boundingBox: [-360,2,360,-2],\n axis: false,\n showNavigation: true,\n //grid: true\n grid: false\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,60],{\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// mark the two given points - one on the y-axis, and one at (x2,y2)\n\n\n\n\n//board.create('functiongraph',[function(x){ return (x-a)*(x-b);},-8,8]);\n//board.create('functiongraph',[function(x){ return (x-a)*(x-b)+v;},-8,8],{ strokeColor: 'red'});\n\nboard.create('functiongraph',[function(x){ return Math.sin(x*(Math.PI/180));},-360,360]);\nboard.create('functiongraph',[function(x){ return Math.sin((x-60*v)*(Math.PI/180));},-360,360],{ strokeColor: 'red'});\n//board.create('functiongraph',[function(x){ return Math.sin((x+60*v)*(Math.PI/180));},-360,360],{ strokeColor: 'black' });\n\nreturn div;", "type": "html", "language": "javascript", "parameters": [["a", "number"], ["b", "number"], ["x2", "number"], ["y2", "number"], ["v", "number"]]}}, "ungrouped_variables": ["a", "x2", "b", "y2", "c", "v", "degrees", "radians", "input"], "name": "Sin graph horizontal shift 1 (with answers using script to check)", "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": "

Write the equation of the line red line.

\n

\n

$g(x)= sin\\;$[[0]]

", "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "gaps": [{"vsetrangepoints": 5, "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrange": [0, 1], "showpreview": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "answersimplification": "all", "scripts": {"validate": {"order": "instead", "script": "// get the student's answer\nvar integral = this.studentAnswer;\n\n// compute its derivative\n\n\n// set the \"student's answer\" to the derivative\nthis.studentAnswer = derivative;\n\n// mark the JME part - the correct answer is the function which was to be integrated\nNumbas.parts.JMEPart.prototype.mark.apply(this);\n\n// set the student's answer back to what they typed\nthis.studentAnswer = integral;\n\nthis.markingFeedback = [];\n\n// If the derivative matches the original expression\nif(this.credit==1) { \n this.markingComment('Your answer is correct. Well done!');\n \n "}}, "answer": "sin(x-{degrees})", "marks": 1, "checkvariablenames": false, "checkingtype": "absdiff", "type": "jme"}], "showCorrectAnswer": true, "scripts": {}, "marks": 0, "type": "gapfill"}], "extensions": ["jsxgraph"], "statement": "

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

\n

The Blue graph shows a graph of a quadratic equation, $f(x)=sin(x)$

\n

The Blue graph has been transformed onto the red graph $g(x)$, type in the new function definition:

\n

e.g   $g(x)=A*f(B*x\\pm C)$

\n

$\\simplify g(x)= sin(x-\\var{degrees})$         $\\simplify h(x)= sin(x+  (360 -\\var{degrees}))$    

\n

                                                                 

\n

$g(x)=f(x-\\var{degrees})$                       $h(x)=f(x+(360-\\var{degrees})$

", "variable_groups": [], "variablesTest": {"maxRuns": 100, "condition": ""}, "variables": {"a": {"definition": "random(-4..4 except 0)", "templateType": "anything", "group": "Ungrouped variables", "name": "a", "description": ""}, "c": {"definition": "a*b", "templateType": "anything", "group": "Ungrouped variables", "name": "c", "description": ""}, "b": {"definition": "random(-5..5 except [0,a,-a])", "templateType": "anything", "group": "Ungrouped variables", "name": "b", "description": ""}, "radians": {"definition": "degrees*(pi/180)", "templateType": "anything", "group": "Ungrouped variables", "name": "radians", "description": ""}, "degrees": {"definition": "60*v", "templateType": "anything", "group": "Ungrouped variables", "name": "degrees", "description": ""}, "v": {"definition": "random(2..4)", "templateType": "anything", "group": "Ungrouped variables", "name": "v", "description": ""}, "x2": {"definition": "random(-3..3 except -1..1)", "templateType": "anything", "group": "Ungrouped variables", "name": "x2", "description": ""}, "input": {"definition": "2", "templateType": "anything", "group": "Ungrouped variables", "name": "input", "description": ""}, "y2": {"definition": "x2*a+b", "templateType": "anything", "group": "Ungrouped variables", "name": "y2", "description": ""}}, "metadata": {"description": "

Given th 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": "steve kilgallon", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/268/"}]}]}], "contributors": [{"name": "steve kilgallon", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/268/"}]}