// Numbas version: exam_results_page_options {"name": "Custom marking - answer is a set", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"name": "Custom marking - answer is a set", "tags": ["custom marking", "demo"], "metadata": {"description": "", "licence": "Creative Commons Attribution 4.0 International"}, "statement": "", "advice": "", "rulesets": {}, "extensions": [], "builtin_constants": {"e": true, "pi,\u03c0": true, "i": true}, "constants": [], "variables": {"odds": {"name": "odds", "group": "Ungrouped variables", "definition": "mod(im(qb+det),2)+mod(re(qb+det),2)", "description": "", "templateType": "anything", "can_override": false}, "eb": {"name": "eb", "group": "Ungrouped variables", "definition": "-f*(x0+x1)", "description": "", "templateType": "anything", "can_override": false}, "roots": {"name": "roots", "group": "Ungrouped variables", "definition": "if(im(det)<>0,[],if(det=0,[x0],[x0,x1]))", "description": "", "templateType": "anything", "can_override": false}, "x1": {"name": "x1", "group": "Ungrouped variables", "definition": "(-qb-det)/2", "description": "", "templateType": "anything", "can_override": false}, "x0": {"name": "x0", "group": "Ungrouped variables", "definition": "(-qb+det)/2", "description": "", "templateType": "anything", "can_override": false}, "f": {"name": "f", "group": "Ungrouped variables", "definition": "if(odds=0,1,4)", "description": "", "templateType": "anything", "can_override": false}, "ea": {"name": "ea", "group": "Ungrouped variables", "definition": "f", "description": "", "templateType": "anything", "can_override": false}, "det": {"name": "det", "group": "Ungrouped variables", "definition": "random(0..3)*random(1,i)", "description": "", "templateType": "anything", "can_override": false}, "ec": {"name": "ec", "group": "Ungrouped variables", "definition": "x0*x1*f", "description": "", "templateType": "anything", "can_override": false}, "qb": {"name": "qb", "group": "Ungrouped variables", "definition": "random(-3..3)", "description": "", "templateType": "anything", "can_override": false}}, "variablesTest": {"condition": "", "maxRuns": 100}, "ungrouped_variables": ["f", "ea", "odds", "det", "ec", "eb", "qb", "x0", "x1", "roots"], "variable_groups": [], "functions": {}, "preamble": {"js": "", "css": ""}, "parts": [{"type": "jme", "useCustomName": false, "customName": "", "marks": 2, "scripts": {"mark": {"script": "// evaluate the student's answer\ntry {\n var list = Numbas.jme.evaluate(this.studentAnswer,this.question.scope);\n}\ncatch(e)\n{\n this.setCredit(0,R('part.jme.answer invalid',e.message));\n return;\n}\n\n// check the answer is a list\nthis.notAList = list.type!='list';\nif(this.notAList) {\n this.setCredit(0,'Your answer is not a list of numbers.');\n return;\n}\n\nvar variables = this.question.scope.variables;\nvar unwrap = Numbas.jme.unwrapValue;\n\n// get the roots of the equation\nvar roots = variables.roots.value.map(v => unwrap(Numbas.jme.castToType(v,'number')));\n\n// unwrap the student's list to a Javascript array of numbers\nvar list = list.value.map(v => unwrap(Numbas.jme.castToType(v,'number')));\n\n// get the coefficients of the equation\nvar ea = unwrap(Numbas.jme.castToType(variables.ea,'number'));\nvar eb = unwrap(Numbas.jme.castToType(variables.eb,'number'));\nvar ec = unwrap(Numbas.jme.castToType(variables.ec,'number'));\n\n// check each root the student gave, keeping track of how many they got right\nvar got = 0;\nvar wrong = [];\nfor(var i=0;iroots.length) {\n this.setCredit(0,\"This equation does not have \"+(list.length)+\" real-valued \"+Numbas.util.pluralise(list.length,'root','roots')+\".\");\n} else if(got[1,2].');\n return false;\n}\nreturn true;", "order": "instead"}}, "customMarkingAlgorithm": "", "extendBaseMarkingAlgorithm": true, "unitTests": [], "showCorrectAnswer": true, "showFeedbackIcon": true, "variableReplacements": [], "variableReplacementStrategy": "originalfirst", "nextParts": [], "suggestGoingBack": false, "adaptiveMarkingPenalty": 0, "exploreObjective": null, "prompt": "

Give the set of real-valued roots of the equation 

\n

\\[ \\simplify[all,fractionnumbers]{{ea}x^2+{eb}x+{ec}}=0 \\]

\n

Enter your answer as a list of numbers separated by commas and enclosed by square brackets, e.g. [1,2].

\n

If the equation has no roots, enter []

", "answer": "{roots}", "answerSimplification": "fractionNumbers", "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": []}], "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/"}, {"name": "Chris Graham", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/369/"}]}]}], "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/"}]}