// Numbas version: finer_feedback_settings {"name": "David'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": [{"extensions": [], "statement": "", "functions": {}, "variables": {"qb": {"description": "", "name": "qb", "templateType": "anything", "group": "Ungrouped variables", "definition": "random(-3..3)"}, "roots": {"description": "", "name": "roots", "templateType": "anything", "group": "Ungrouped variables", "definition": "if(im(det)<>0,[],if(det=0,[x0],[x0,x1]))"}, "det": {"description": "", "name": "det", "templateType": "anything", "group": "Ungrouped variables", "definition": "random(0..3)"}, "x1": {"description": "", "name": "x1", "templateType": "anything", "group": "Ungrouped variables", "definition": "(-qb-det)/2"}, "ea": {"description": "", "name": "ea", "templateType": "anything", "group": "Ungrouped variables", "definition": "f"}, "eb": {"description": "", "name": "eb", "templateType": "anything", "group": "Ungrouped variables", "definition": "-f*(x0+x1)"}, "x0": {"description": "", "name": "x0", "templateType": "anything", "group": "Ungrouped variables", "definition": "(-qb+det)/2"}, "odds": {"description": "", "name": "odds", "templateType": "anything", "group": "Ungrouped variables", "definition": "mod(im(qb+det),2)+mod(re(qb+det),2)"}, "ec": {"description": "", "name": "ec", "templateType": "anything", "group": "Ungrouped variables", "definition": "x0*x1*f"}, "f": {"description": "", "name": "f", "templateType": "anything", "group": "Ungrouped variables", "definition": "if(odds=0,1,4)"}}, "metadata": {"description": "", "licence": "Creative Commons Attribution 4.0 International"}, "variable_groups": [], "rulesets": {}, "tags": [], "advice": "", "ungrouped_variables": ["f", "ea", "odds", "det", "ec", "eb", "qb", "x0", "x1", "roots"], "parts": [{"checkvariablenames": false, "answersimplification": "fractionNumbers", "variableReplacements": [], "showpreview": true, "variableReplacementStrategy": "originalfirst", "checkingtype": "absdiff", "vsetrangepoints": 5, "checkingaccuracy": 0.001, "vsetrange": [0, 1], "marks": 2, "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\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(got[1,2].');\n return false;\n}\nreturn true;"}}, "showCorrectAnswer": 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 []

", "type": "jme", "answer": "{roots}", "showFeedbackIcon": true, "expectedvariablenames": []}], "name": "David's copy of Custom marking - answer is a set", "variablesTest": {"condition": "", "maxRuns": 100}, "preamble": {"js": "", "css": ""}, "type": "question", "contributors": [{"name": "David Wishart", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1461/"}]}]}], "contributors": [{"name": "David Wishart", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1461/"}]}