// Numbas version: exam_results_page_options {"name": "Johan's copy of 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": "Johan's copy of Custom marking - answer is a set", "advice": "", "rulesets": {}, "statement": "", "functions": {}, "preamble": {"js": "", "css": ""}, "variable_groups": [], "parts": [{"marks": 2, "customMarkingAlgorithm": "", "answerSimplification": "fractionNumbers", "showFeedbackIcon": true, "checkVariableNames": false, "showPreview": true, "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 []

", "vsetRangePoints": 5, "failureRate": 1, "adaptiveMarkingPenalty": 0, "checkingAccuracy": 0.001, "type": "jme", "useCustomName": false, "checkingType": "absdiff", "unitTests": [], "extendBaseMarkingAlgorithm": true, "vsetRange": [0, 1], "showCorrectAnswer": true, "variableReplacements": [], "valuegenerators": [], "customName": "", "variableReplacementStrategy": "originalfirst", "scripts": {"mark": {"order": "instead", "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\n//var variables = this.question.scope.variables;\nvar unwrap = Numbas.jme.unwrapValue;\n\n// get the roots of the equation\nvar roots = unwrap(this.question.scope.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(got[1,2].');\n return false;\n}\nreturn true;"}}, "answer": "{roots}"}], "tags": [], "variables": {"det": {"name": "det", "definition": "random(0..3)*random(1,i)", "description": "", "templateType": "anything", "group": "Ungrouped variables"}, "x0": {"name": "x0", "definition": "(-qb+det)/2", "description": "", "templateType": "anything", "group": "Ungrouped variables"}, "ea": {"name": "ea", "definition": "f", "description": "", "templateType": "anything", "group": "Ungrouped variables"}, "ec": {"name": "ec", "definition": "x0*x1*f", "description": "", "templateType": "anything", "group": "Ungrouped variables"}, "f": {"name": "f", "definition": "if(odds=0,1,4)", "description": "", "templateType": "anything", "group": "Ungrouped variables"}, "eb": {"name": "eb", "definition": "-f*(x0+x1)", "description": "", "templateType": "anything", "group": "Ungrouped variables"}, "odds": {"name": "odds", "definition": "mod(im(qb+det),2)+mod(re(qb+det),2)", "description": "", "templateType": "anything", "group": "Ungrouped variables"}, "qb": {"name": "qb", "definition": "random(-3..3)", "description": "", "templateType": "anything", "group": "Ungrouped variables"}, "roots": {"name": "roots", "definition": "if(im(det)<>0,[],if(det=0,[x0],[x0,x1]))", "description": "", "templateType": "anything", "group": "Ungrouped variables"}, "x1": {"name": "x1", "definition": "(-qb-det)/2", "description": "", "templateType": "anything", "group": "Ungrouped variables"}}, "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": ""}, "variablesTest": {"condition": "", "maxRuns": 100}, "extensions": [], "ungrouped_variables": ["f", "ea", "odds", "det", "ec", "eb", "qb", "x0", "x1", "roots"], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Johan Eriksson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2438/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Johan Eriksson", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2438/"}]}