// Numbas version: exam_results_page_options {"name": "Stationary Points and Graphs", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"parts": [{"showCorrectAnswer": true, "customName": "", "prompt": "

Find the values of $x$ at the turning points of the function, where $x_{1}\\le x_{2}$.

\n

Point 1: $x_{1}=$[[0]]

\n

Point 2: $x_{2}=$[[1]]

", "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "marks": 0, "sortAnswers": false, "scripts": {}, "showFeedbackIcon": true, "type": "gapfill", "useCustomName": false, "gaps": [{"showCorrectAnswer": true, "customName": "", "vsetRangePoints": 5, "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "marks": 1, "checkVariableNames": false, "scripts": {}, "answer": "min({crit1},{crit2})", "checkingType": "absdiff", "valuegenerators": [], "showFeedbackIcon": true, "checkingAccuracy": 0.001, "type": "jme", "showPreview": true, "useCustomName": false, "failureRate": 1, "customMarkingAlgorithm": "", "vsetRange": [0, 1], "variableReplacementStrategy": "originalfirst", "unitTests": []}, {"showCorrectAnswer": true, "customName": "", "vsetRangePoints": 5, "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "marks": 1, "checkVariableNames": false, "scripts": {}, "answer": "max({crit1},{crit2})", "checkingType": "absdiff", "valuegenerators": [], "showFeedbackIcon": true, "checkingAccuracy": 0.001, "type": "jme", "showPreview": true, "useCustomName": false, "failureRate": 1, "customMarkingAlgorithm": "", "vsetRange": [0, 1], "variableReplacementStrategy": "originalfirst", "unitTests": []}], "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "unitTests": []}, {"showCorrectAnswer": true, "customName": "", "prompt": "

Is the turning point $\\var{whichpoint[rand]}$:

", "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "marks": 0, "shuffleChoices": false, "scripts": {}, "matrix": "markingmatrix[rand]", "choices": ["

A maximum?

", "

A minimum?

", "

An inflexion point?

"], "showFeedbackIcon": true, "displayType": "radiogroup", "type": "1_n_2", "showCellAnswerState": true, "useCustomName": false, "customMarkingAlgorithm": "", "displayColumns": 0, "variableReplacementStrategy": "originalfirst", "unitTests": [], "minMarks": 0, "maxMarks": 0}, {"showCellAnswerState": true, "scripts": {}, "marks": 0, "choices": ["

{graph({crits},{freevbls})}

", "

{graph([{min(-crit1,2*crit2)},{max(-crit1,2*crit2)}],{freevbls})}

", "

{graph({crits},[{-coeff},{const}])}

", "

{graph([{min(-crit1,crit2)},{max(-crit1,crit2)}],[{-coeff},{const}])}

"], "useCustomName": false, "distractors": ["", "", "", ""], "variableReplacementStrategy": "originalfirst", "unitTests": [], "displayColumns": 0, "showCorrectAnswer": true, "customName": "", "extendBaseMarkingAlgorithm": true, "prompt": "

Select the graph that represents the function.

", "shuffleChoices": true, "displayType": "radiogroup", "showFeedbackIcon": true, "variableReplacements": [], "matrix": ["1", 0, 0, 0], "customMarkingAlgorithm": "", "type": "1_n_2", "minMarks": 0, "maxMarks": 0}, {"showCorrectAnswer": true, "customName": "", "prompt": "

Find the equations of the tangent line and normal line at $x=\\var{tanpoint}$. Give your answer in the form $y=mx+c$, where $m$ and $c$ are to be determined.

\n

Tangent line: $y=$[[0]]

\n

Normal line: $y=$[[1]]

", "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "marks": 0, "sortAnswers": false, "scripts": {}, "showFeedbackIcon": true, "type": "gapfill", "useCustomName": false, "gaps": [{"showCorrectAnswer": true, "customName": "", "vsetRangePoints": 5, "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "marks": "2", "checkVariableNames": false, "scripts": {}, "answer": "{coeff*(tanpoint-crit1)*(tanpoint-crit2)}(x-{tanpoint})+{coeff*tanpoint*tanpoint*tanpoint/3-coeff*(crit1+crit2)*tanpoint*tanpoint/2+coeff*crit1*crit2*tanpoint+const}", "checkingType": "absdiff", "valuegenerators": [{"name": "x", "value": ""}], "showFeedbackIcon": true, "checkingAccuracy": 0.001, "type": "jme", "showPreview": true, "useCustomName": false, "failureRate": 1, "customMarkingAlgorithm": "", "vsetRange": [0, 1], "variableReplacementStrategy": "originalfirst", "unitTests": []}, {"showCorrectAnswer": true, "customName": "", "vsetRangePoints": 5, "extendBaseMarkingAlgorithm": true, "variableReplacements": [], "marks": 1, "checkVariableNames": false, "scripts": {}, "answer": "-1/{coeff*(tanpoint-crit1)*(tanpoint-crit2)}(x-{tanpoint})+{coeff*tanpoint*tanpoint*tanpoint/3-coeff*(crit1+crit2)*tanpoint*tanpoint/2+coeff*crit1*crit2*tanpoint+const}", "checkingType": "absdiff", "valuegenerators": [{"name": "x", "value": ""}], "showFeedbackIcon": true, "checkingAccuracy": 0.001, "type": "jme", "showPreview": true, "useCustomName": false, "failureRate": 1, "customMarkingAlgorithm": "", "vsetRange": [0, 1], "variableReplacementStrategy": "originalfirst", "unitTests": []}], "customMarkingAlgorithm": "", "variableReplacementStrategy": "originalfirst", "unitTests": []}, {"scripts": {}, "marks": 1, "checkingType": "absdiff", "vsetRangePoints": 5, "answer": "{mini}", "useCustomName": false, "variableReplacementStrategy": "originalfirst", "unitTests": [], "showCorrectAnswer": true, "customName": "", "extendBaseMarkingAlgorithm": true, "prompt": "

Find the minimum of the function on $[\\var{start},\\var{end}]$.

", "checkVariableNames": false, "valuegenerators": [], "showFeedbackIcon": true, "checkingAccuracy": 0.001, "variableReplacements": [], "showPreview": true, "customMarkingAlgorithm": "", "failureRate": 1, "type": "jme", "vsetRange": [0, 1]}], "variable_groups": [], "tags": [], "metadata": {"description": "

Uses JSXGraph to generate a plot for a cubic, with given critical points, along with three other incorrect graphs with modified properties. JSXGraph code is commented.

a) Critical points of $f(x)$ are found as solutions to $f'(x)=0$. For a cubic function $f(x)$ the differential is quadratic, so you will find two (not necessarily distinct, in general) roots.

\n

b) The nature of a critical point $x_{*}$ of $f(x)$ is determined by the sign of $f''(x_{*})$. If $f''(x_{*})>0$, $x_{*}$ is a minimum; if $f''(x_{*})=0$, $x_{*}$ is a saddle point; if $f''(x_{*})<0$, $x_{*}$ is a maximum.

\n

c) To match the function to a graph, the elements to consider are:

\n
\n
1. Roots of the function: $x$ such that $f(x)=0$. This gives the crossings on the $x$-axis;
2. \n
3. Critical points: $x$ such that $f'(x)=0$. This gives the turning points on the graph;
4. \n
5. Nature of critical points.
6. \n
\n

d) The gradient of a tangent line at a point $x_{0}$ is simply $f'(x_{0})$. Writing the equation of a line as $y-y_{0}=m(x-x_{0})$, we can see that the equation of the tangent line at $x_{0}$ can be written as $y-f(x_{0})=f'(x_{0})(x-x_{0})$, from which we can find the equation in the form $y=mx+c$. If $m_{t}$ is the gradient of the tangent line, then the gradient of the normal is $m_{n}=-1/m_{t}$, and given that the normal line also passes through the point $(x_{0},f(x_{0}))$, we can find the normal line equation similarly.

\n

e) There are two places where a minimum of a continuous function can occur on a closed interval $[a,b]$: either at an endpoint, giving minimum $f(a)$ or $f(b)$, or at a turning point of the function, provided the turning point is a minimum. So we simply check the value of $f(x)$ at the endpoints $x=a$ and $x=b$, and check $f(x)$ at any critical points (found in (a)), and pick the minimum of those.

", "preamble": {"js": "", "css": ""}, "variables": {"rand": {"description": "

See in whichpoint.

", "definition": "random([0,1])", "group": "Ungrouped variables", "name": "rand", "templateType": "anything"}, "markingmatrix": {"description": "

A marking matrix for part (b). The first entry gives a marking matrix for if $x_{1}$ was selected by rand and whichpoint; similarly for the second entry.

", "definition": "[if(2*coeff*crits[0]-coeff*(crit1+crit2)<0,[1,-1,-1],if(2*coeff*crits[0]-coeff*(crit1+crit2)>0,[-1,1,-1],[-1,-1,1])),if(2*coeff*crits[1]-coeff*(crit1+crit2)<0,[1,-1,-1],if(2*coeff*crits[1]-coeff*(crit1+crit2)>0,[-1,1,-1],[-1,-1,1]))]", "group": "Ungrouped variables", "name": "markingmatrix", "templateType": "anything"}, "tanpoint": {"description": "

A point from which the tangent and normal lines in part (d) should be calculated.

", "definition": "random(-2..2 except [crit1,crit2])", "group": "Ungrouped variables", "name": "tanpoint", "templateType": "anything"}, "freevbls": {"description": "

A list of free variables to be passed to the custom JavaScript graph generator.

", "definition": "[coeff,const]", "group": "Ungrouped variables", "name": "freevbls", "templateType": "anything"}, "crit1func": {"description": "

The function value at the first critical point.

\n

This is defined here for ease of notation in finding the minimum of the function.

", "definition": "coeff*crit1^3/3-coeff*(crit1+crit2)/2 * crit1^2+coeff*crit1^2*crit2+const", "group": "Ungrouped variables", "name": "crit1func", "templateType": "anything"}, "end": {"description": "

Upper bound of the interval in (e).

", "definition": "random([0,1] except start)", "group": "Ungrouped variables", "name": "end", "templateType": "anything"}, "coeff": {"description": "

The coefficient of $x$ in $f'(x)$.

", "definition": "random(-6..6 except 0)", "group": "Ungrouped variables", "name": "coeff", "templateType": "anything"}, "crits": {"description": "

As in freevbls, but provides the critical points as a list.

", "definition": "[min(crit1,crit2),max(crit1,crit2)]", "group": "Ungrouped variables", "name": "crits", "templateType": "anything"}, "mini": {"description": "

Works out the minimum of the function for (e). Takes the minimum of the f(start), f(end), and f(crit1), f(crit2). f(crit1), f(crit2) is only included if crit1, crit2 respectively lie in the interval; else they are assigned the value $\\infty$ (so as to be excluded as a possible minimum).

", "definition": "min([if(crit1>=start and crit1<=end and markingmatrix[0][1]=1,crit1func,infinity),if(crit2>=start and crit2<=end and markingmatrix[1][1]=1,crit2func,infinity),coeff*end^3/3-coeff*(crit1+crit2)*end^2/2+coeff*crit1*crit2*end+const,coeff*start^3/3-coeff*(crit1+crit2)*start^2/2+coeff*crit1*crit2*start+const])", "group": "Ungrouped variables", "name": "mini", "templateType": "anything"}, "whichpoint": {"description": "

This (with rand below) picks a random critical point that the student should use in part (b).

", "definition": "[latex('x_{1}'),latex('x_{2}')]", "group": "Ungrouped variables", "name": "whichpoint", "templateType": "anything"}, "crit2": {"description": "

A turning point of the function f(x).

", "definition": "random(-3..3#0.5)", "group": "Ungrouped variables", "name": "crit2", "templateType": "anything"}, "crit2func": {"description": "

The function value at the second critical point.

\n

This is defined here for ease of notation in finding the minimum of the function.

", "definition": "coeff*crit2^3/3-coeff*(crit1+crit2)/2 * crit2^2+coeff*crit1*crit2^2+const", "group": "Ungrouped variables", "name": "crit2func", "templateType": "anything"}, "crit1": {"description": "

A turning point of the function f(x).

", "definition": "random(-3..3#0.5)", "group": "Ungrouped variables", "name": "crit1", "templateType": "anything"}, "const": {"description": "

The constant part of $f'(x)$.

", "definition": "random(-10..10)", "group": "Ungrouped variables", "name": "const", "templateType": "anything"}, "start": {"description": "

Lower bound of the interval in (e).

", "definition": "random([-1,0])", "group": "Ungrouped variables", "name": "start", "templateType": "anything"}}, "statement": "

Consider the function $y=\\simplify[all,fractionNumbers]{{coeff/3}*x^3-{coeff*(crit1+crit2)/2} *x^2+{coeff*crit1*crit2}*x+{const}}$.

", "functions": {"graph": {"type": "html", "language": "javascript", "definition": "/* Given a function defined by its critical points f'(x)=a(x-c1)(x-c2), this takes the critical points\nand the free variables (the coefficient a and some constant b) and produces a graph containing the axes,\nand roughly centred around the critical points. \nTo call this in a question, we use {graph([{crit1},{crit2}],[{freevbl1,freevbl2})}. See Part c)*/\n// NOTE THAT THIS MUST BE SET TO OUTPUT HTML IN THE FUNCTION DESCRIPTION ABOVE\n\n// Simple boring function to evaluate f(x) at a point.\nfunction funcval(val)\n{\n return freevbls[0]/3 *math.pow(val,3)-freevbls[0]/2 *(crits[0]+crits[1])*val*val+freevbls[0]*crits[0]*crits[1]*val+freevbls[1];\n}\n\n// An artifact of me changing the plot limits a lot and being too lazy to change it everywhere.\nvar dist=2;\n\n// Since JSXGraph takes the region of plotting in the form of a bounding box: (upperleftcoords, bottomrightcoords),\n// this finds the maximum and minimum of the region to be plotted.\nvar uppercritval = Numbas.math.max(funcval(crits[0]),funcval(crits[1]));\nvar lowercritval = Numbas.math.min(funcval(crits[0]),funcval(crits[1]));\nvar leftlim = Numbas.math.max(funcval(crits[0]-dist),funcval(crits[1]+dist));\nvar rightlim = Numbas.math.min(funcval(crits[1]+dist),funcval(crits[0]-dist));\n\n/* JSXGraph code. The first line initialises the plotting region: height and width settings are given\nfor the output, then we define a bounding box. Here I've checked max and min again to ensure that\nthe axes are present in any plot we make. Finally, we can choose to show axes and a grid if wanted. */\nvar grdiv = Numbas.extensions.jsxgraph.makeBoard('200px','200px',{boundingbox:[Numbas.math.min(-0.5,crits[0])-dist,Numbas.math.max(leftlim,Numbas.math.max(0.5,uppercritval))+dist,Numbas.math.max(0.5,crits[1])+dist,Numbas.math.min(rightlim,Numbas.math.min(lowercritval,-0.5))-dist],axis:true,grid:false});\n// The object in JSXGraph is the 'board'. Adding graphs, points etc is equivalent to creating things on the board.\nvar board = grdiv.board;\n/* Creating the function. Relatively straightforward: 'functiongraph' is the JSXGraph name, then we define\na function to plot (using my funcval()), along with a start and endpoint for the plotting. */\nvar graph = board.create('functiongraph',[function(x){return funcval(x);},math.floor(crits[0]-dist)-1,math.floor(crits[1]+dist)+1]);\n// Chucks out the board, with the plot on it!\nreturn grdiv;", "parameters": [["crits", "list"], ["freevbls", "list"]]}}, "ungrouped_variables": ["crit1", "crit2", "crit1func", "crit2func", "coeff", "const", "whichpoint", "rand", "markingmatrix", "freevbls", "crits", "tanpoint", "mini", "start", "end"], "name": "Stationary Points and Graphs", "rulesets": {}, "variablesTest": {"maxRuns": 100, "condition": "not (crit1=0 or crit2=0)"}, "contributors": [{"name": "Andrew Iskauskas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/724/"}, {"name": "Ruth Hand", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3228/"}]}]}], "contributors": [{"name": "Andrew Iskauskas", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/724/"}, {"name": "Ruth Hand", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3228/"}]}