// Numbas version: exam_results_page_options {"name": "Min_max_v1", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"functions": {"": {"language": "jme", "type": "number", "parameters": [], "definition": ""}, "poly1": {"language": "javascript", "type": "html", "parameters": [["a1", "number"], ["a2", "number"], ["a3", "number"], ["a4", "number"], ["maxy_poly", "number"]], "definition": "var div = Numbas.extensions.jsxgraph.makeBoard('600px','400px', {boundingbox:[-2,100,10,-10], axis:false});\n var brd=div.board;\n \n // Initial function term\n var poly = function(x){ return a1*x*x*x-a2*x*x+a3*x+a4; };\n //var poly = function(x){ return a1*Math.sin(x)*Math.exp(3*x)+a2*Math.cos(x)*Math.exp(3*x); };\n //var poly = function(x){ return a1*Math.exp(x)*a2*Math.log(2*x, 2.71); };\n //var poly = function(x){ return a1*x*x*x*Math.exp(x/3)-a2*x*x*Math.exp(x/3)+a3*x*Math.exp(x/3)+a4*Math.exp(x/3); };\n var graph_poly = function(x) { return poly(x); };\n \n // Start value\n var s = 2;\n \n \n \n var i;\n var ax = brd.create('axis', [[0,0], [1,0]], {strokeColor: 'black'});\n var ay = brd.create('axis', [[0,0], [0,1]], {strokeColor: 'black'});\n \n var g = brd.create('functiongraph', [function(x){return graph_poly(x);}],{strokeWidth: 2, dash:0});\n \n \t\n return div;"}, "tan": {"language": "javascript", "type": "html", "parameters": [], "definition": "var div = Numbas.extensions.jsxgraph.makeBoard('600px','400px', {boundingbox:[-3.5,5,3.5,-5], axis:false});\n var brd=div.board;\n\n// boundingbox\n\n // Initial function term\n //var poly = function(x){ return a1*x*x*x-a2*x*x+a3*x+a4; };\n var func = function(x){ return Math.tan(x); };\n //var poly = function(x){ return a1*Math.exp(x)*a2*Math.log(2*x, 2.71); };\n //var poly = function(x){ return a1*x*x*x*Math.exp(x/3)-a2*x*x*Math.exp(x/3)+a3*x*Math.exp(x/3)+a4*Math.exp(x/3); };\n var graph_func = function(x) { return func(x); };\n \n var i;\n var ax = brd.create('axis', [[0,0], [1,0]], {strokeColor: 'black'});\n var ay = brd.create('axis', [[0,0], [0,1]], {strokeColor: 'black'});\n \n var g = brd.create('functiongraph', [function(x){return graph_func(x);}],{strokeWidth: 2, dash:0});\n \n \t\n return div;"}, "fun": {"language": "jme", "type": "number", "parameters": [["m", "number"], ["b", "number"], ["a", "number"], ["c", "number"]], "definition": "((m*c-1)*e^(m*c)+a)/(m*e^(m*c)+b)"}, "sincos": {"language": "javascript", "type": "html", "parameters": [["as1", "number"], ["as2", "number"], ["as3", "number"], ["minysincos", "number"], ["maxysincos", "number"]], "definition": "var div = Numbas.extensions.jsxgraph.makeBoard('600px','400px', {boundingbox:[-3.5,maxysincos,3.5,minysincos], axis:false});\n var brd=div.board;\n\n// boundingbox\n\n // Initial function term\n //var poly = function(x){ return a1*x*x*x-a2*x*x+a3*x+a4; };\n var func = function(x){ return as2*Math.sin(x)*Math.exp(x/as1)-as3*Math.cos(x)*Math.exp(x/as1); };\n //var poly = function(x){ return a1*Math.exp(x)*a2*Math.log(2*x, 2.71); };\n //var poly = function(x){ return a1*x*x*x*Math.exp(x/3)-a2*x*x*Math.exp(x/3)+a3*x*Math.exp(x/3)+a4*Math.exp(x/3); };\n var graph_func = function(x) { return func(x); };\n \n // Start value\n var s = 2;\n \n \n \n var i;\n var ax = brd.create('axis', [[0,0], [1,0]], {strokeColor: 'black'});\n var ay = brd.create('axis', [[0,0], [0,1]], {strokeColor: 'black'});\n \n var g = brd.create('functiongraph', [function(x){return graph_func(x);}],{strokeWidth: 2, dash:0});\n \n \t\n return div;"}, "nr": {"language": "jme", "type": "list", "parameters": [["m", "number"], ["b", "number"], ["a", "number"], ["c", "number"], ["n", "number"], ["l", "list"]], "definition": "if(n=5,l+[fun(m,b,a,c)]+[fun(m,b,a,fun(m,b,a,c))],nr(m,b,a,fun(m,b,a,c),n-1,l+[c]))"}, "test": {"language": "javascript", "type": "html", "parameters": [["m", "number"], ["b", "number"], ["a", "number"], ["maxy", "number"]], "definition": "var div = Numbas.extensions.jsxgraph.makeBoard('600px','400px', {boundingbox:[0,maxy,3,-30], axis:false});\n var brd=div.board;\n // Initial function term\n var term = function(x) { return Math.exp(m*x)+b*x-a; };\n var graph = function(x) { return term(x); };\n // Recursion depth\n var steps = 4;\n // Start value\n var s = 2;\n \n //for (i = 0; i < steps; i++) {\n //document.write('x' + i + ' = ');\n //}\n \n var i;\n var ax = brd.create('axis', [[0,0], [1,0]], {strokeColor: 'black'});\n var ay = brd.create('axis', [[0,0], [0,1]], {strokeColor: 'black'});\n \n var g = brd.create('functiongraph', [function(x){return graph(x);}],{strokeWidth: 2, dash:0});\n // var x = brd.create('glider',[s,0,ax], {name: 'x_{0}', strokeColor: 'magenta', fillColor: 'yellow'});\n \n // newton(x, steps, brd);\t\n \n //function xval() {\n //for (i = 0; i < steps; i++)\n //document.getElementById('xv' + i).innerHTML = (brd.select('x_{' + i + '}').X()).toFixed(14);\n //}\n \n //brd.addHook(xval);\n \n function newton(p, i, board) {\t\n board.suspendUpdate();\t\n if(i>0) {\n var f = board.create('glider',[function(){return p.X();}, function(){return graph(p.X())},g], {name: '', style: 3, strokeColor: 'green', fillColor: 'yellow'});\n var l = board.create('line', [p,f],{strokeWidth: 0.5, dash: 1, straightFirst: false, straightLast: false, strokeColor: 'black'});\n // var t = board.create('tangent',[f],{strokeWidth: 0.5, strokeColor: '#0080c0', dash: 0});\n //var x = board.create('intersection',[ax,t,0],{name: 'x_{'+(steps-i+1) + '}', style: 4, strokeColor: 'magenta', fillColor: 'yellow'});\n // newton(x,--i, board);\n }\n board.unsuspendUpdate(); \n \n \n }\t\n return div;"}, "poly2": {"language": "javascript", "type": "number", "parameters": [], "definition": "var div = Numbas.extensions.jsxgraph.makeBoard('600px','200px',{boundingBox:[0,2,0,1],grid:false});\nvar board = div.board;\nvar ap1 = Numbas.jme.unwrapValue(scope.variables.a1);\nvar ap2 = Numbas.jme.unwrapValue(scope.variables.a2);\nvar ap3 = Numbas.jme.unwrapValue(scope.variables.a3);\nvar ap4 = Numbas.jme.unwrapValue(scope.variables.a4);\n\nvar graph_poly2 = board.create('functiongraph', function(x){return Math.ap1*x^3-ap2*x^2+ap3*x+ap4});\nreturn div;\n"}, "funfornr": {"language": "javascript", "type": "html", "parameters": [], "definition": "var div = Numbas.extensions.jsxgraph.makeBoard('600px','200px',{boundingBox:[0,10,1,-8],grid:false});\n var board = div.board;\n var m = Numbas.jme.unwrapValue(scope.variables.m);\n var be = Numbas.jme.unwrapValue(scope.variables.b);\n var al = Numbas.jme.unwrapValue(scope.variables.a);\n var ans = Numbas.jme.unwrapValue(scope.variables.ans1)\n var a = board.create('point',[ans,0],'$A$');\n \n var graph = board.create('functiongraph',function(x){return Math.exp(m*x)+be*x-al});\n \n return div;\n "}}, "ungrouped_variables": ["a", "maxy", "ans1", "m", "results", "b", "tol", "ans", "tans", "a1", "a2", "a3", "a4", "maxy_poly", "maxysincos", "as1", "as2", "as3", "minysincos", "ANSas2", "ANSas3", "inv_tan_sol1", "inv_tan_sol2", "inv_tan_sol3", "inv_tan_sol4", "f_min", "f_max"], "extensions": ["jsxgraph"], "preamble": {"css": "", "js": ""}, "advice": "", "tags": [], "variable_groups": [], "statement": "

Test for ${e^{x/\\var{as1}}}({\\var{as2}}sin(x)-{\\var{as3}cos(x))}$

\n

Find local extrema in the range $-\\pi \\le x \\le \\pi$

\n

Think about constants as they are important for the stationary points (unless it is possible to put a condition (whether to add or substract pi - see below)

\n

Check whether the ymin and ymax work

\n

\n

", "parts": [{"marks": 0, "useCustomName": false, "choices": ["Choice 1
{sincos(as1,as2,as3,minysincos,maxysincos)}", "Choice 2
{sincos(-as1,-as2,-as3,minysincos,maxysincos)}", "Choice 3
{sincos(as1,1/as2,as3,minysincos,maxysincos)}", "Choice 4
{sincos(as1,as2,1/as3,minysincos,maxysincos)}"], "maxMarks": 0, "showFeedbackIcon": true, "variableReplacements": [], "minMarks": 0, "stepsPenalty": 0, "showCorrectAnswer": true, "adaptiveMarkingPenalty": 0, "prompt": "

Which of the following graphs represent the function

\n

${e^{x/\\var{as1}}}({\\var{as2}}sin(x)-{\\var{as3}cos(x))}$

\n

Notes:

\n
\n
1. Make sure min/max is ok with current definitions
2. \n
4. \n
\n

", "customMarkingAlgorithm": "", "unitTests": [], "shuffleChoices": false, "showCellAnswerState": true, "displayType": "radiogroup", "matrix": ["1", 0, 0, 0], "type": "1_n_2", "variableReplacementStrategy": "originalfirst", "steps": [{"variableReplacements": [], "unitTests": [], "marks": 0, "useCustomName": false, "showFeedbackIcon": true, "type": "information", "variableReplacementStrategy": "originalfirst", "scripts": {}, "prompt": "

", "showCorrectAnswer": true, "adaptiveMarkingPenalty": 0, "customName": "", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true}], "displayColumns": 0, "scripts": {}, "distractors": ["", "", "", ""], "customName": "", "extendBaseMarkingAlgorithm": true}, {"marks": 0, "useCustomName": false, "maxMarks": 0, "showFeedbackIcon": true, "variableReplacements": [], "minMarks": 0, "choices": ["Choice 1
${\\frac{df(x)}{dx}=\\frac{1}{\\var{as1}}e^{x/\\var{as1}}}({\\var{as2}}cos(x)-{\\var{as3}sin(x))}$", "Choice 2 - should be correct (no simplification)
${\\frac{df(x)}{dx}=\\frac{1}{\\var{as1}}e^{x/\\var{as1}}}({\\var{as2}}sin(x)-{\\var{as3}cos(x))}+e^{x/\\var{as1}}({\\var{as2}}cos(x)+{\\var{as3}sin(x))}$", "Choice 3 - I am proposing to put the simplified version here which could (should) also be correct
${\\frac{df(x)}{dx}=e^{x/\\var{as1}}({\\frac{\\var{ANSas3}}{\\var{as1}}sin(x)}+{\\frac{\\var{ANSas2}}{\\var{as1}}}cos(x))}$", "Choice 4

(In order to find minumum and/or maximum) Calculate the derivative of the function

\n

${f(x)=e^{x/\\var{as1}}}({\\var{as2}}sin(x)-{\\var{as3}cos(x))}$

\n

Note:

\n
\n
1. Prompt - you must use the product rule
2. \n
3. Use the table?
4. \n
5. This could be as a choice question or gapfill (the other below)
6. \n
7. I don't understand how choices work...
8. \n
", "customMarkingAlgorithm": "", "unitTests": [], "shuffleChoices": false, "showCellAnswerState": true, "displayType": "radiogroup", "matrix": [0, "1", "1", 0], "type": "1_n_2", "variableReplacementStrategy": "originalfirst", "displayColumns": 0, "scripts": {}, "distractors": ["", "", "", ""], "customName": "", "extendBaseMarkingAlgorithm": true}, {"variableReplacements": [], "unitTests": [], "marks": 0, "useCustomName": false, "sortAnswers": false, "gaps": [{"marks": 1, "useCustomName": false, "showFeedbackIcon": true, "variableReplacementStrategy": "originalfirst", "checkingType": "absdiff", "variableReplacements": [], "valuegenerators": [{"value": "", "name": "x"}], "checkVariableNames": false, "answerSimplification": "all", "showCorrectAnswer": true, "adaptiveMarkingPenalty": 0, "customMarkingAlgorithm": "", "unitTests": [], "failureRate": 1, "type": "jme", "showPreview": true, "checkingAccuracy": 0.001, "scripts": {}, "vsetRangePoints": 5, "answer": "e^(x/{as1})({{ANSas2}/{as1}}cos(x)+{{ANSas3}/{as1}}sin(x))", "customName": "", "extendBaseMarkingAlgorithm": true, "vsetRange": [0, 1]}], "showFeedbackIcon": true, "type": "gapfill", "variableReplacementStrategy": "originalfirst", "scripts": {}, "prompt": "

(In order to find minumum and/or maximum) Calculate the derivative of the function

\n

${f(x)=e^{x/\\var{as1}}}({\\var{as2}}sin(x)-{\\var{as3}cos(x))}$

\n

Simplify your answer and present it in a form: (what form would be the best?)

\n

${\\frac{df(x)}{dx}=\\frac{A}{B}e^{x/\\var{as1}}(Csin(x)+Dcos(x))}$, where A, B, C and D are any real constants

\n

[[0]]

\n

(there's something wrong with this gap number) - if does not compile - change the number to 0 or 1, compile again, maybe change agian

\n

", "showCorrectAnswer": true, "adaptiveMarkingPenalty": 0, "customName": "", "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true}, {"marks": 0, "useCustomName": false, "choices": ["Choice 1
There are two stationary points for $-\\pi \\le x \\le \\pi$:
${x_1=\\var{inv_tan_sol1}, x_2=\\var{inv_tan_sol2}}$
Note: how can we limit this to 3-4 sf?", "Choice 2
There are three stationary points for $-\\pi \\le x \\le \\pi$:
${x_1=-\\pi ,x_2=0, x_2=\\pi}$
Note: add more choices", "Choice 3
There are two stationary points for $-\\pi \\le x \\le \\pi$:
${x_1=\\var{inv_tan_sol3}, x_2=\\var{inv_tan_sol4}}$
Note: how can we limit this to 3-4 sf?"], "maxMarks": 0, "showFeedbackIcon": true, "variableReplacements": [], "minMarks": 0, "stepsPenalty": 0, "showCorrectAnswer": true, "adaptiveMarkingPenalty": 0, "prompt": "

What are the stationary points of $f(x)$?

\n

", "customMarkingAlgorithm": "", "unitTests": [], "shuffleChoices": false, "showCellAnswerState": true, "displayType": "radiogroup", "matrix": ["2", 0, 0], "type": "1_n_2", "variableReplacementStrategy": "originalfirst", "steps": [{"variableReplacements": [], "unitTests": [], "marks": 0, "useCustomName": false, "showFeedbackIcon": true, "type": "information", "variableReplacementStrategy": "originalfirst", "scripts": {}, "prompt": "

In order to find the stationary points you must solve the following equation

\n

${\\frac{df(x)}{dx}=0}$

\n

Once you solve this you might find the graph of $g(x) = tan(x)$ useful

\n

{tan()}

The function has a minimum point at: $x =$ [[0]] and the value of the function is : $f(x) =$ [[1]]

\n

Note (correct answer): ${\\var{f_min}}$ - to be deleted

The function has a maximum point at: $x =$ [[0]] and the value of the function is $f(x)=$ [[1]]

\n

Note (correct answer): ${\\var{f_max}}$ - to be deleted

Calculate the local extrema of a function ${f(x) = e^{x/C1}(C2sin(x)-C3cos(x))}$

The graph of f(x) has to be identified.

The first derivative of f(x) has to be calculated.

The min max points have to be identified using the graph and/or calculated using the first derivative method.  Requires solving trigonometric equation

", "licence": "Creative Commons Attribution 4.0 International"}, "name": "Min_max_v1", "rulesets": {"std": ["all", "!collectNumbers", "!noLeadingMinus"]}, "variablesTest": {"condition": "", "maxRuns": 100}, "variables": {"maxy_poly": {"definition": "ceil({a1}^3)+5", "templateType": "anything", "description": "

{\\var{a1}}x^3-{\\var{a2}}x^2+{\\var{a3}}x-{\\var{a4}}

", "name": "maxy_poly", "group": "Ungrouped variables"}, "a4": {"definition": "random(0.1 .. 0.9#0.1)", "templateType": "randrange", "description": "", "name": "a4", "group": "Ungrouped variables"}, "ans1": {"definition": "precround(results[6],4)", "templateType": "anything", "description": "", "name": "ans1", "group": "Ungrouped variables"}, "a2": {"definition": "random(11 .. 19#1)", "templateType": "randrange", "description": "", "name": "a2", "group": "Ungrouped variables"}, "inv_tan_sol1": {"definition": "arctan(-ANSas2/ANSas3)", "templateType": "anything", "description": "

Solution to stationary points

", "name": "inv_tan_sol1", "group": "Ungrouped variables"}, "inv_tan_sol2": {"definition": "inv_tan_sol1+3.14", "templateType": "anything", "description": "", "name": "inv_tan_sol2", "group": "Ungrouped variables"}, "minysincos": {"definition": "floor(-{as2})-5", "templateType": "anything", "description": "", "name": "minysincos", "group": "Ungrouped variables"}, "m": {"definition": "random(1.5..2#0.1)", "templateType": "anything", "description": "", "name": "m", "group": "Ungrouped variables"}, "ANSas3": {"definition": "as2+as3*as1", "templateType": "anything", "description": "", "name": "ANSas3", "group": "Ungrouped variables"}, "as2": {"definition": "random(2..9 except as3)", "templateType": "anything", "description": "", "name": "as2", "group": "Ungrouped variables"}, "a": {"definition": "random(2..15)", "templateType": "anything", "description": "", "name": "a", "group": "Ungrouped variables"}, "a3": {"definition": "random(11 .. 19#1)", "templateType": "randrange", "description": "", "name": "a3", "group": "Ungrouped variables"}, "results": {"definition": "nr(m,b,a,2,10,[])", "templateType": "anything", "description": "", "name": "results", "group": "Ungrouped variables"}, "a1": {"definition": "random(2 .. 9#0.1)", "templateType": "randrange", "description": "", "name": "a1", "group": "Ungrouped variables"}, "f_min": {"definition": "e^(inv_tan_sol1/as1)(as2*sin(inv_tan_sol1)-as3*cos(inv_tan_sol1))", "templateType": "anything", "description": "", "name": "f_min", "group": "Ungrouped variables"}, "as1": {"definition": "random(2 .. 9#1)", "templateType": "randrange", "description": "", "name": "as1", "group": "Ungrouped variables"}, "ANSas2": {"definition": "-as3+as2*as1", "templateType": "anything", "description": "", "name": "ANSas2", "group": "Ungrouped variables"}, "maxy": {"definition": "ceil(e^(2*m)+2*b-a)+5", "templateType": "anything", "description": "", "name": "maxy", "group": "Ungrouped variables"}, "f_max": {"definition": "e^(inv_tan_sol2/as1)(as2*sin(inv_tan_sol2)-as3*cos(inv_tan_sol2))", "templateType": "anything", "description": "", "name": "f_max", "group": "Ungrouped variables"}, "as3": {"definition": "random(2..9 except as1)", "templateType": "anything", "description": "", "name": "as3", "group": "Ungrouped variables"}, "tol": {"definition": "0", "templateType": "anything", "description": "", "name": "tol", "group": "Ungrouped variables"}, "ans": {"definition": "precround(tans,4)", "templateType": "anything", "description": "", "name": "ans", "group": "Ungrouped variables"}, "tans": {"definition": "((2*m-1)*exp(2*m)+a)/(m*exp(2*m)+b)", "templateType": "anything", "description": "", "name": "tans", "group": "Ungrouped variables"}, "b": {"definition": "random((a+1)..9)", "templateType": "anything", "description": "", "name": "b", "group": "Ungrouped variables"}, "maxysincos": {"definition": "ceil({as2}*3)", "templateType": "anything", "description": "", "name": "maxysincos", "group": "Ungrouped variables"}, "inv_tan_sol3": {"definition": "arctan(as3/as2)", "templateType": "anything", "description": "", "name": "inv_tan_sol3", "group": "Ungrouped variables"}, "inv_tan_sol4": {"definition": "inv_tan_sol3-3.14", "templateType": "anything", "description": "", "name": "inv_tan_sol4", "group": "Ungrouped variables"}}, "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Anna Strzelecka", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2945/"}, {"name": "Mario Stevanovski", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2979/"}, {"name": "Maria Aneiros", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3388/"}]}]}], "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Anna Strzelecka", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2945/"}, {"name": "Mario Stevanovski", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2979/"}, {"name": "Maria Aneiros", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3388/"}]}