// Numbas version: exam_results_page_options {"name": "Pedro A.'s copy of Pattern matching - student's answer is a fraction", "extensions": [], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"rulesets": {}, "advice": "", "tags": [], "name": "Pedro A.'s copy of Pattern matching - student's answer is a fraction", "statement": "

Simplificación.

", "variablesTest": {"maxRuns": 100, "condition": ""}, "extensions": [], "preamble": {"js": "", "css": ""}, "ungrouped_variables": ["a", "b", "c"], "functions": {}, "variables": {"b": {"templateType": "anything", "name": "b", "group": "Ungrouped variables", "definition": "random(-5..5 except 0)", "description": ""}, "a": {"templateType": "anything", "name": "a", "group": "Ungrouped variables", "definition": "random(-5..5)", "description": ""}, "c": {"templateType": "anything", "name": "c", "group": "Ungrouped variables", "definition": "random(-3..3)", "description": ""}}, "parts": [{"showFeedbackIcon": true, "scripts": {"mark": {"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('(??;numerator)/(??;denominator)');\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 $\\\\frac{(\\\\dots)}{(\\\\dots)}$.');\n} else {\n var numerator = m.numerator;\n var numerator_rule = Numbas.jme.compile('x+?');\n m = Numbas.jme.display.matchTree(numerator_rule,numerator,true);\n if(!m) {\n this.multCredit(0.5,\"The numerator is not in the form $x+\\\\dots$.\");\n }\n}", "order": "after"}}, "answer": "(x+{a})/(x+{c})", "variableReplacementStrategy": "originalfirst", "checkvariablenames": false, "vsetrange": [0, 1], "prompt": "

Encuentra la fracción simplificada de $\\simplify{(x^2+{a+b}x+{a*b})/((x^2+{c+b}x+{c*b}))}$

", "showpreview": true, "variableReplacements": [], "expectedvariablenames": [], "checkingaccuracy": 0.001, "vsetrangepoints": 5, "marks": "1", "type": "jme", "showCorrectAnswer": true, "checkingtype": "absdiff"}], "metadata": {"licence": "Creative Commons Attribution 4.0 International", "description": "

The student's answer is a fraction of two polynomials. First check that the student's answer is a fraction, then check that the numerator is of the form $x+a$.

\n

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

"}, "variable_groups": [], "type": "question", "contributors": [{"name": "Pedro A. Garc\u00eda-S\u00e1nchez", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1217/"}]}]}], "contributors": [{"name": "Pedro A. Garc\u00eda-S\u00e1nchez", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1217/"}]}