// Numbas version: finer_feedback_settings {"name": "Nick's copy of Terry's copy of Cubic graph", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"showQuestionGroupNames": false, "preamble": {"js": "\nfunction dragpoint_board() {\n\n var scope = question.scope; \n var a = scope.variables.a.value;\n var b = scope.variables.b.value;\n var f = scope.variables.f.value;\n var g = scope.variables.g.value;\n var h = scope.variables.h.value;\n var i = scope.variables.i.value;\n var j = scope.variables.j.value;\n var k = scope.variables.k.value;\n var l = scope.variables.l.value;\n var maxy = Math.max(Math.abs(g),Math.abs(j),Math.abs(f),Math.abs(h),Math.abs(k),Math.abs(i),Math.abs(l));\n \n var div = Numbas.extensions.jsxgraph.makeBoard('800px','1100px',{boundingBox:[-5,maxy+3,5,-maxy-3],grid:true});\n $(question.display.html).find('#dragpoint').append(div);\n \n var board = div.board;\n \n //shorthand to evaluate a mathematical expression to a number\n function evaluate(expression) {\n try {\n var val = Numbas.jme.evaluate(expression,question.scope);\n return Numbas.jme.unwrapValue(val);\n }\n catch(e) {\n // if there's an error, return no number\n return NaN;\n }\n }\n \n // set up points array\n var num_points = 7;\n var points = [];\n \n \n // this function sets up the i^th point\n function make_point(i) {\n \n // calculate initial coordinates\n var x = i-(num_points-1)/2;\n \n // create an invisible vertical line for the point to slide along\n var line = board.create('line',[[x,0],[x,1]],{visible: false});\n \n // create the point\n var point = points[i] = board.create(\n 'glider',\n [i-(num_points-1)/2,0,line],\n {\n name:'',\n size:2,\n snapSizeY: 1, // the point will snap to y-coordinates which are multiples of 1\n snapToGrid: true\n }\n );\n \n // the contents of the input box for this point\n var studentAnswer = question.parts[1].gaps[i].display.studentAnswer;\n studentAnswer(0);\n \n //Here I have commented out the functions which connect the student input to the graph and the filling in of the answer fields\n //when the student drags the points on the graph.\n \n // watch the student's input and reposition the point when it changes. \n // ko.computed(function() {\n // y = evaluate(studentAnswer());\n //if(!(isNaN(y)) && board.mode!=board.BOARD_MODE_DRAG) {\n // point.moveTo([x,y],100);\n // }\n // });\n \n // when the student drags the point, update the gapfill input\n point.on('drag',function(){\n var y = Numbas.math.niceNumber(point.Y());\n studentAnswer(y);\n });\n \n }\n \n // create each point\n for(var i=0;iThis question is a case of substituting in each value of $x$ into the given equation and finding the corresponding $y$ value. Then, using the table, drag the points to the appropriate coordinates.

", "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "

You are given the cubic formula

\n

$y=\\simplify{x^3-{d}x^2+{e1}x-{f}}$

", "question_groups": [{"name": "", "questions": [], "pickingStrategy": "all-ordered", "pickQuestions": 0}], "metadata": {"description": "

Compute a table of values for a cubic function. A JSXgraph (the graph paper) plot shows the curve going through the entered values. The student input is now disconnected from the graph so that they slide the points usually after they input the values and the answer fields are not updated.

", "licence": "Creative Commons Attribution 4.0 International", "notes": ""}, "functions": {}, "variables": {"k": {"name": "k", "definition": "(2-{a})(2-{b})(2-{c})", "templateType": "anything", "group": "Ungrouped variables", "description": ""}, "c": {"name": "c", "definition": "random(-4..4 except 0)", "templateType": "anything", "group": "Ungrouped variables", "description": ""}, "e1": {"name": "e1", "definition": "a*b+b*c+a*c", "templateType": "anything", "group": "Ungrouped variables", "description": ""}, "h": {"name": "h", "definition": "(-2-{a})(-2-{b})(-2-{c})", "templateType": "anything", "group": "Ungrouped variables", "description": ""}, "d": {"name": "d", "definition": "a+b+c", "templateType": "anything", "group": "Ungrouped variables", "description": ""}, "g": {"name": "g", "definition": "(-3-{a})(-3-{b})(-3-{c})", "templateType": "anything", "group": "Ungrouped variables", "description": ""}, "a": {"name": "a", "definition": "random(-2,-1,1,2)", "templateType": "anything", "group": "Ungrouped variables", "description": ""}, "f": {"name": "f", "definition": "a*b*c", "templateType": "anything", "group": "Ungrouped variables", "description": ""}, "b": {"name": "b", "definition": "random(-4..4 except 0)", "templateType": "anything", "group": "Ungrouped variables", "description": ""}, "i": {"name": "i", "definition": "(-1-{a})(-1-{b})(-1-{c})", "templateType": "anything", "group": "Ungrouped variables", "description": ""}, "values": {"name": "values", "definition": "map((x-a)(x-b)(x-c),x,-3..3)", "templateType": "anything", "group": "Ungrouped variables", "description": ""}, "l": {"name": "l", "definition": "(1-{a})(1-{b})(1-{c})", "templateType": "anything", "group": "Ungrouped variables", "description": ""}, "j": {"name": "j", "definition": "(3-{a})(3-{b})(3-{c})", "templateType": "anything", "group": "Ungrouped variables", "description": ""}}, "rulesets": {"std": ["all", "fractionNumbers"]}, "variable_groups": [], "tags": ["graph", "interactive", "Jsxgraph", "jsxgraph", "plot", "quadratic"], "ungrouped_variables": ["a", "c", "values", "b", "d", "e1", "f", "g", "h", "i", "j", "k", "l"], "name": "Nick's copy of Terry's copy of Cubic graph", "type": "question", "parts": [{"prompt": "

Fill in the table of values for $y=\\simplify{x^3-{d}x^2+{e1}x-{f}}$:

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
$x$$-3$$-2$$-1$$0$$1$$2$$3$
$y$[[0]][[1]][[2]][[3]][[4]][[5]][[6]]
", "showCorrectAnswer": true, "variableReplacements": [], "scripts": {}, "type": "gapfill", "gaps": [{"showpreview": true, "checkingaccuracy": 0.001, "variableReplacements": [], "checkvariablenames": false, "showCorrectAnswer": true, "expectedvariablenames": [], "vsetrangepoints": 5, "vsetrange": [0, 1], "answer": "(-3-{a})(-3-{b})(-3-{c})", "marks": 0.5, "scripts": {}, "type": "jme", "checkingtype": "absdiff", "variableReplacementStrategy": "originalfirst"}, {"showpreview": true, "checkingaccuracy": 0.001, "variableReplacements": [], "checkvariablenames": false, "showCorrectAnswer": true, "expectedvariablenames": [], "vsetrangepoints": 5, "vsetrange": [0, 1], "answer": "(-2-{a})(-2-{b})(-2-{c})", "marks": 0.5, "scripts": {}, "type": "jme", "checkingtype": "absdiff", "variableReplacementStrategy": "originalfirst"}, {"showpreview": true, "checkingaccuracy": 0.001, "variableReplacements": [], "checkvariablenames": false, "showCorrectAnswer": true, "expectedvariablenames": [], "vsetrangepoints": 5, "vsetrange": [0, 1], "answer": "(-1-{a})(-1-{b})(-1-{c})", "marks": 0.5, "scripts": {}, "type": "jme", "checkingtype": "absdiff", "variableReplacementStrategy": "originalfirst"}, {"showpreview": true, "checkingaccuracy": 0.001, "variableReplacements": [], "checkvariablenames": false, "showCorrectAnswer": true, "expectedvariablenames": [], "vsetrangepoints": 5, "vsetrange": [0, 1], "answer": "-{a}{b}{c}", "marks": 0.5, "scripts": {}, "type": "jme", "checkingtype": "absdiff", "variableReplacementStrategy": "originalfirst"}, {"showpreview": true, "checkingaccuracy": 0.001, "variableReplacements": [], "checkvariablenames": false, "showCorrectAnswer": true, "expectedvariablenames": [], "vsetrangepoints": 5, "vsetrange": [0, 1], "answer": "(1-{a})(1-{b})(1-{c})", "marks": 0.5, "scripts": {}, "type": "jme", "checkingtype": "absdiff", "variableReplacementStrategy": "originalfirst"}, {"showpreview": true, "checkingaccuracy": 0.001, "variableReplacements": [], "checkvariablenames": false, "showCorrectAnswer": true, "expectedvariablenames": [], "vsetrangepoints": 5, "vsetrange": [0, 1], "answer": "(2-{a})(2-{b})(2-{c})", "marks": 0.5, "scripts": {}, "type": "jme", "checkingtype": "absdiff", "variableReplacementStrategy": "originalfirst"}, {"showpreview": true, "checkingaccuracy": 0.001, "variableReplacements": [], "checkvariablenames": false, "showCorrectAnswer": true, "expectedvariablenames": [], "vsetrangepoints": 5, "vsetrange": [0, 1], "answer": "(3-{a})(3-{b})(3-{c})", "marks": 0.5, "scripts": {}, "type": "jme", "checkingtype": "absdiff", "variableReplacementStrategy": "originalfirst"}], "variableReplacementStrategy": "originalfirst", "marks": 0}, {"prompt": "
\n

Slide the points to the correct $y$ values.

\n

", "showCorrectAnswer": true, "variableReplacements": [], "scripts": {}, "type": "gapfill", "gaps": [{"type": "numberentry", "allowFractions": false, "variableReplacements": [], "showCorrectAnswer": false, "correctAnswerFraction": false, "maxValue": "{values[0]}", "minValue": "{values[0]}", "scripts": {}, "variableReplacementStrategy": "originalfirst", "marks": "0.5", "showPrecisionHint": false}, {"type": "numberentry", "allowFractions": false, "variableReplacements": [], "showCorrectAnswer": false, "correctAnswerFraction": false, "maxValue": "{values[1]}", "minValue": "{values[1]}", "scripts": {}, "variableReplacementStrategy": "originalfirst", "marks": "0.5", "showPrecisionHint": false}, {"type": "numberentry", "allowFractions": false, "variableReplacements": [], "showCorrectAnswer": false, "correctAnswerFraction": false, "maxValue": "{values[2]}", "minValue": "{values[2]}", "scripts": {}, "variableReplacementStrategy": "originalfirst", "marks": "0.5", "showPrecisionHint": false}, {"type": "numberentry", "allowFractions": false, "variableReplacements": [], "showCorrectAnswer": false, "correctAnswerFraction": false, "maxValue": "{values[3]}", "minValue": "{values[3]}", "scripts": {}, "variableReplacementStrategy": "originalfirst", "marks": "0.5", "showPrecisionHint": false}, {"type": "numberentry", "allowFractions": false, "variableReplacements": [], "showCorrectAnswer": false, "correctAnswerFraction": false, "maxValue": "{values[4]}", "minValue": "{values[4]}", "scripts": {}, "variableReplacementStrategy": "originalfirst", "marks": "0.5", "showPrecisionHint": false}, {"type": "numberentry", "allowFractions": false, "variableReplacements": [], "showCorrectAnswer": false, "correctAnswerFraction": false, "maxValue": "{values[5]}", "minValue": "{values[5]}", "scripts": {}, "variableReplacementStrategy": "originalfirst", "marks": "0.5", "showPrecisionHint": false}, {"type": "numberentry", "allowFractions": false, "variableReplacements": [], "showCorrectAnswer": false, "correctAnswerFraction": false, "maxValue": "{values[6]}", "minValue": "{values[6]}", "scripts": {}, "variableReplacementStrategy": "originalfirst", "marks": "0.5", "showPrecisionHint": false}], "variableReplacementStrategy": "originalfirst", "marks": 0}], "contributors": [{"name": "joshua boddy", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/557/"}, {"name": "Nick Walker", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2416/"}, {"name": "Terry Young", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3130/"}]}]}], "contributors": [{"name": "joshua boddy", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/557/"}, {"name": "Nick Walker", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2416/"}, {"name": "Terry Young", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3130/"}]}