// Numbas version: finer_feedback_settings {"name": "Use an aswer to a mathematical expression part in a subsequent part", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Use an aswer to a mathematical expression part in a subsequent part", "tags": [], "metadata": {"description": "
This question asks the student to give a function with a particular root. It then asks them to divide by (x-{root}), and uses adaptive marking to mark against the previous answer.
\nThis uses the \"expression\" data type, which is currently undocumented and experimental.
", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "", "advice": "", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true, "j": false}, "constants": [], "variables": {"f": {"name": "f", "group": "Ungrouped variables", "definition": "poly_with_root(root)", "description": "", "templateType": "anything", "can_override": false}, "root": {"name": "root", "group": "Ungrouped variables", "definition": "random(-5..5)", "description": "", "templateType": "anything", "can_override": false}, "a": {"name": "a", "group": "Ungrouped variables", "definition": "", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["root", "f", "a"], "variable_groups": [], "functions": {"poly_with_root": {"parameters": [["root", "number"]], "type": "expression", "language": "javascript", "definition": "return Numbas.jme.compile('x-('+root+')');"}}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "jme", "useCustomName": false, "customName": "", "marks": "1", "scripts": {"mark": {"script": "try {\n var expr = Numbas.jme.compile(this.studentAnswer);\n} catch(e) {\n this.answered = false;\n this.setCredit(0);\n return;\n}\nthis.answered = true;\nvar root_ok = Numbas.jme.builtinScope.evaluate(expr,{x:variables.root}).value == 0;\n\nvar v = [0,1,2].map(function(x){return Numbas.jme.builtinScope.evaluate(expr,{x:x}).value});\nvar non_linear = v[1]-v[0] != v[2]-v[1];\n\nif(root_ok) {\n this.addCredit(0.5,'Your function has a root at $x='+variables.root+'$.');\n}\nif(non_linear) {\n this.addCredit(0.5,'Your function has at least two real roots.');\n}\n", "order": "instead"}}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "Write a polynomial $f(x)$ of degree at least 2 which satisfies $\\simplify{f({root})} = 0$.
", "answer": "x-{a}", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": [{"name": "x", "value": ""}]}, {"type": "gapfill", "useCustomName": false, "customName": "", "marks": 0, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "$\\simplify{ f(x)/(x-{root})} = $ [[0]]
", "gaps": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 1, "scripts": {}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [{"variable": "f", "part": "p0", "must_go_first": true}], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "answer": "({f})/(x-{root})", "showPreview": true, "checkingType": "absdiff", "checkingAccuracy": 0.001, "failureRate": 1, "vsetRangePoints": 5, "vsetRange": [0, 1], "checkVariableNames": false, "singleLetterVariables": false, "allowUnknownFunctions": true, "implicitFunctionComposition": false, "caseSensitive": false, "valuegenerators": [{"name": "x", "value": ""}]}], "sortAnswers": false}], "partsMode": "all", "maxMarks": 0, "objectives": [], "penalties": [], "objectiveVisibility": "always", "penaltyVisibility": "always", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}], "resources": []}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}