// Numbas version: exam_results_page_options {"name": "Factorise a quadratic", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"advice": "", "preamble": {"js": "", "css": ""}, "variablesTest": {"condition": "", "maxRuns": 100}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

The student is asked to factorise a quadratic $x^2 + ax + b$. A custom marking script uses pattern matching to ensure that the student's answer is of the form $(x+a)(x+b)$, $(x+a)^2$, or $x(x+a)$.

\n

To find the script, look in the Scripts tab of part a.

"}, "rulesets": {}, "statement": "", "tags": [], "functions": {}, "variables": {"b": {"description": "", "templateType": "anything", "definition": "random(-5..5 except 0)", "group": "Ungrouped variables", "name": "b"}, "a": {"description": "", "templateType": "anything", "definition": "random(-5..5)", "group": "Ungrouped variables", "name": "a"}}, "extensions": [], "variable_groups": [], "parts": [{"extendBaseMarkingAlgorithm": true, "checkingAccuracy": 0.001, "useCustomName": false, "scripts": {"mark": {"order": "after", "script": "// Parse the student's answer as a syntax tree\nvar studentTree = Numbas.jme.compile(this.studentAnswer,Numbas.jme.builtinScope);\n\n// Create the pattern to match against \n// we just want two sets of brackets, each containing two terms\n// or one of the brackets might not have a constant term\n// or for repeated roots, you might write (x+a)^2\nvar rule = Numbas.jme.compile('m_any( (x+??)(x+??), (x+??)^2, x*(x+??) )');\n\n// Check the student's answer matches the pattern. \nvar m = Numbas.jme.display.matchTree(rule,studentTree,true);\n// If not, take away marks\nif(!m) {\n this.multCredit(0.5,'Your answer is not in the form $(\\\\dots)(\\\\dots)$.');\n}\n"}}, "customName": "", "marks": "1", "showCorrectAnswer": true, "unitTests": [], "type": "jme", "answer": "(x+{a})(x+{b})", "customMarkingAlgorithm": "", "failureRate": 1, "variableReplacements": [], "checkingType": "absdiff", "adaptiveMarkingPenalty": 0, "vsetRange": [0, 1], "prompt": "

Factorise $\\simplify{x^2+{a+b}x+{a*b}}$

", "valuegenerators": [{"value": "", "name": "x"}], "checkVariableNames": false, "showFeedbackIcon": true, "showPreview": true, "vsetRangePoints": 5, "variableReplacementStrategy": "originalfirst"}], "ungrouped_variables": ["a", "b"], "name": "Factorise a quadratic", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}, {"name": "Thomas Waters", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3649/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}, {"name": "Thomas Waters", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/3649/"}]}