// Numbas version: exam_results_page_options {"name": "Josh's copy of Custom marking - answer is a set", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": ""}, "preamble": {"css": "", "js": ""}, "extensions": [], "ungrouped_variables": ["f", "ea", "odds", "det", "ec", "eb", "qb", "x0", "x1", "roots"], "rulesets": {}, "statement": "", "variable_groups": [], "tags": [], "functions": {}, "name": "Josh's copy of Custom marking - answer is a set", "advice": "", "variablesTest": {"condition": "", "maxRuns": 100}, "parts": [{"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 `[]`

", "variableReplacementStrategy": "originalfirst", "type": "jme", "showPreview": true, "showCorrectAnswer": true, "customName": "", "customMarkingAlgorithm": "", "useCustomName": false, "variableReplacements": [], "valuegenerators": [], "checkingType": "absdiff", "unitTests": [], "checkVariableNames": false, "answer": "{roots}", "checkingAccuracy": 0.001, "vsetRange": [0, 1], "failureRate": 1, "showFeedbackIcon": true, "extendBaseMarkingAlgorithm": true, "vsetRangePoints": 5, "scripts": {"validate": {"script": "// Use the built-in validation function to catch syntax errors and so on\nif(!Numbas.parts.JMEPart.prototype.validate.apply(this)) {\n return false;\n}\n// Give a warning if the student's answer is not a list\nif(this.notAList) {\n this.giveWarning('You must enter a list, i.e. numbers separated by commas and enclosed by square brackets. For example, `[1,2]`.');\n return false;\n}\nreturn true;", "order": "instead"}, "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 = unwrap(variables.roots);\n\n// unwrap the student's list to a Javascript array of numbers\nvar list = unwrap(list);\n\n// get the coefficients of the equation\nvar ea = unwrap(variables.ea);\nvar eb = unwrap(variables.eb);\nvar ec = unwrap(variables.ec);\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(got0,[],if(det=0,[x0],[x0,x1]))", "group": "Ungrouped variables", "name": "roots"}, "ec": {"templateType": "anything", "description": "", "definition": "x0*x1*f", "group": "Ungrouped variables", "name": "ec"}, "ea": {"templateType": "anything", "description": "", "definition": "f", "group": "Ungrouped variables", "name": "ea"}}, "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Josh Lim", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2990/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Josh Lim", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2990/"}]}