// Numbas version: exam_results_page_options {"name": "Alan's copy of Graph of a quadratic function", "extensions": ["jsxgraph"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

Compute a table of values for a quadratic function. A JSXgraph plot shows the curve going through the entered values.

"}, "extensions": ["jsxgraph"], "variables": {"x_2": {"templateType": "anything", "definition": "random(-4..4 except 0)", "description": "", "name": "x_2", "group": "Ungrouped variables"}, "x_1": {"templateType": "anything", "definition": "random(-2..2)", "description": "", "name": "x_1", "group": "Ungrouped variables"}}, "variablesTest": {"maxRuns": 100, "condition": ""}, "parts": [{"showCorrectAnswer": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "marks": 0, "scripts": {}, "extendBaseMarkingAlgorithm": true, "customMarkingAlgorithm": "", "unitTests": [], "showFeedbackIcon": true, "type": "gapfill", "prompt": "

Fill in the table of values for $y=\\simplify[std]{x^2+{x_1+x_2}x+{x_1}*{x_2}}$:

\n\n\n\n\n\n\n\n\n\n\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]]
\n
", "gaps": [{"vsetRange": [0, 1], "vsetRangePoints": 5, "showCorrectAnswer": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "marks": 0.5, "scripts": {}, "checkingType": "absdiff", "extendBaseMarkingAlgorithm": true, "customMarkingAlgorithm": "", "answer": "{a}*9+{c}", "showFeedbackIcon": true, "checkingAccuracy": 0.001, "type": "jme", "checkVariableNames": false, "failureRate": 1, "unitTests": [], "showPreview": true, "expectedVariableNames": []}, {"vsetRange": [0, 1], "vsetRangePoints": 5, "showCorrectAnswer": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "marks": 0.5, "scripts": {}, "checkingType": "absdiff", "extendBaseMarkingAlgorithm": true, "customMarkingAlgorithm": "", "answer": "{a}*4+{c}", "showFeedbackIcon": true, "checkingAccuracy": 0.001, "type": "jme", "checkVariableNames": false, "failureRate": 1, "unitTests": [], "showPreview": true, "expectedVariableNames": []}, {"vsetRange": [0, 1], "vsetRangePoints": 5, "showCorrectAnswer": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "marks": 0.5, "scripts": {}, "checkingType": "absdiff", "extendBaseMarkingAlgorithm": true, "customMarkingAlgorithm": "", "answer": "{a}*1+{c}", "showFeedbackIcon": true, "checkingAccuracy": 0.001, "type": "jme", "checkVariableNames": false, "failureRate": 1, "unitTests": [], "showPreview": true, "expectedVariableNames": []}, {"vsetRange": [0, 1], "vsetRangePoints": 5, "showCorrectAnswer": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "marks": 0.5, "scripts": {}, "checkingType": "absdiff", "extendBaseMarkingAlgorithm": true, "customMarkingAlgorithm": "", "answer": "{c}", "showFeedbackIcon": true, "checkingAccuracy": 0.001, "type": "jme", "checkVariableNames": false, "failureRate": 1, "unitTests": [], "showPreview": true, "expectedVariableNames": []}, {"vsetRange": [0, 1], "vsetRangePoints": 5, "showCorrectAnswer": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "marks": 0.5, "scripts": {}, "checkingType": "absdiff", "extendBaseMarkingAlgorithm": true, "customMarkingAlgorithm": "", "answer": "{a}*1+{c}", "showFeedbackIcon": true, "checkingAccuracy": 0.001, "type": "jme", "checkVariableNames": false, "failureRate": 1, "unitTests": [], "showPreview": true, "expectedVariableNames": []}, {"vsetRange": [0, 1], "vsetRangePoints": 5, "showCorrectAnswer": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "marks": 0.5, "scripts": {}, "checkingType": "absdiff", "extendBaseMarkingAlgorithm": true, "customMarkingAlgorithm": "", "answer": "{a}*4+{c}", "showFeedbackIcon": true, "checkingAccuracy": 0.001, "type": "jme", "checkVariableNames": false, "failureRate": 1, "unitTests": [], "showPreview": true, "expectedVariableNames": []}, {"vsetRange": [0, 1], "vsetRangePoints": 5, "showCorrectAnswer": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "marks": 0.5, "scripts": {}, "checkingType": "absdiff", "extendBaseMarkingAlgorithm": true, "customMarkingAlgorithm": "", "answer": "{a}*9+{c}", "showFeedbackIcon": true, "checkingAccuracy": 0.001, "type": "jme", "checkVariableNames": false, "failureRate": 1, "unitTests": [], "showPreview": true, "expectedVariableNames": []}], "sortAnswers": false}], "advice": "", "variable_groups": [], "name": "Alan's copy of Graph of a quadratic function", "functions": {}, "statement": "

You are given the quadratic formula

\n

$y=\\simplify[std]{{a}x^2+{c}}$

", "tags": [], "rulesets": {"std": ["all", "fractionNumbers"]}, "preamble": {"js": "function dragpoint_board() {\n var scope = question.scope;\n \n var x_1 = scope.variables.x_1.value;\n var x_2 = scope.variables.x_2.value;\n var maxy = Math.max((-5-x_1)*(-5-x_2),(5-x_1)*(5-x_2));\n var miny = -[(x_1+x_2)/2]^2+x_1*x_2-3;\n \n var div = Numbas.extensions.jsxgraph.makeBoard('250px','400px',{boundingBox:[-5,maxy,5,miny],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: 0.1, // the point will snap to y-coordinates which are multiples of 0.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 \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;i