// Numbas version: finer_feedback_settings {"name": "Number of Stationary Points of a Cubic", "extensions": ["geogebra", "jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"metadata": {"description": "

Given a graph of a cubic, the student is asked how many stationary points f has.

", "licence": "Creative Commons Attribution 4.0 International"}, "variablesTest": {"condition": "", "maxRuns": 100}, "variable_groups": [], "name": "Number of Stationary Points of a Cubic", "statement": "

This is a non-calculator question

", "advice": "

See Lecture 11.4 for the definition and examples of stationary points

", "preamble": {"css": "", "js": ""}, "variables": {"a": {"definition": "random(-1..1 except 0)", "templateType": "anything", "description": "

Coefficient of x^3

", "name": "a", "group": "Ungrouped variables"}, "vshift": {"definition": "random(-2..2)", "templateType": "anything", "description": "

Random amount of vertifical shift for sake of variability.

", "name": "vshift", "group": "Ungrouped variables"}, "num_roots": {"definition": "if(num_stat = 2, random(1..3), 1)", "templateType": "anything", "description": "

The number of roots.

", "name": "num_roots", "group": "Ungrouped variables"}, "hshift": {"definition": "random(-2..2)", "templateType": "anything", "description": "

Random amount of horizontal shift to create variability.

", "name": "hshift", "group": "Ungrouped variables"}, "num_stat": {"definition": "random(0..2)", "templateType": "anything", "description": "

Number of stationary points

", "name": "num_stat", "group": "Ungrouped variables"}}, "rulesets": {}, "tags": [], "functions": {"plotgraph": {"type": "html", "definition": "// This functions plots a cubic with a certain number of\n// stationary points and roots.\n// It creates the board, sets it up, then returns an\n// HTML div tag containing the board.\n\n\n// Max and min x and y values for the axis.\nvar x_min = -6;\nvar x_max = 6;\nvar y_min = -10;\nvar y_max = 10;\n\n\n// First, make the JSXGraph board.\nvar div = Numbas.extensions.jsxgraph.makeBoard(\n '500px',\n '600px',\n {\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\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\n\n// Plot the function.\n\nswitch (num_stat) {\n case 0:\n board.create('functiongraph',\n [function(x){ return a*(Math.pow(x+h,3)+2*(x+h)+v);},x_min,x_max]);\n break;\n \n case 1:\n board.create('functiongraph',\n [function(x){ return a*(Math.pow(x+h,3)+v);},x_min,x_max]);\n break;\n \n case 2:\n switch (num_roots) {\n case 1:\n board.create('functiongraph',\n [function(x){ return a*((x+2+h)*(x+h)*(x-2+h)+5);},x_min,x_max]);\n break;\n \n case 2:\n board.create('functiongraph',\n [function(x){ return a*((x+1+h)*(x+1+h)*(x-2+h));},x_min,x_max]);\n break;\n break;\n \n case 3:\n board.create('functiongraph',\n [function(x){ return a*((x+2+h)*(x+h)*(x-2+h));},x_min,x_max]);\n break;\n }\n \n \n break;\n}\n\n\n// num_stat\n\n\n\n\n\nreturn div;", "language": "javascript", "parameters": [["num_stat", "number"], ["num_roots", "number"], ["a", "number"], ["h", "number"], ["v", "number"]]}}, "parts": [{"type": "gapfill", "scripts": {}, "variableReplacements": [], "showFeedbackIcon": true, "prompt": "

{plotgraph(num_stat,num_roots, a, hshift, vshift)}

\n

Above is the graph of some function $f$.

\n

How many stationary points does $f$ have? [[0]]

", "showCorrectAnswer": true, "variableReplacementStrategy": "originalfirst", "gaps": [{"type": "numberentry", "scripts": {}, "notationStyles": ["plain", "en", "si-en"], "correctAnswerFraction": false, "mustBeReducedPC": 0, "minValue": "num_stat", "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "mustBeReduced": false, "variableReplacements": [], "allowFractions": false, "showFeedbackIcon": true, "correctAnswerStyle": "plain", "maxValue": "num_stat", "marks": 1}], "marks": 0}], "extensions": ["geogebra", "jsxgraph"], "ungrouped_variables": ["num_roots", "num_stat", "a", "hshift", "vshift"], "type": "question", "contributors": [{"name": "Lovkush Agarwal", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1358/"}], "resources": []}]}], "contributors": [{"name": "Lovkush Agarwal", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1358/"}]}