// Numbas version: finer_feedback_settings {"name": "Combining fractions", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"extensions": ["stats"], "tags": ["adding fractions", "combining fractions", "Fractions", "fractions", "lowest form of a fraction", "subtracting fractions"], "variables": {"a": {"definition": "random(1..11)", "group": "Ungrouped variables", "name": "a", "templateType": "anything", "description": ""}, "action1": {"definition": "switch(op=-1,'taking away',op=1,'adding')", "group": "Ungrouped variables", "name": "action1", "templateType": "anything", "description": ""}, "op": {"definition": "random(1,-1)", "group": "Ungrouped variables", "name": "op", "templateType": "anything", "description": "

Operation to perform: 1 for add, -1 for subtract

"}, "f": {"definition": "switch(\n g=2,\n random(3..11#2),\n g=3,\n random(2,4,5,7,8,10,11),\n g=4,\n random(3,5,7,9,11),\n g=5, \n random(2,3,4,6,7,8,9,11),\n g=6,\n random(5,7,11),\n g=7,\n random(2,3,4,5,6,8,9,10,11),\n g=8,\n random(3,5,7,9,11),\n g=9,\n random(2,4,5,7,8,10,11),\n g=10,\n random(3,7,9),\n g=11,\n random(2..10),\n g=12,\n random(5,7,11)\n)", "group": "Ungrouped variables", "name": "f", "templateType": "anything", "description": ""}, "dosomething": {"definition": "switch(op=-1,'Take away',op=1,'Add')", "group": "Ungrouped variables", "name": "dosomething", "templateType": "anything", "description": "

Operation to perform

"}, "action": {"definition": "switch(op=-1,'Taking away',op=1,'Adding')", "group": "Ungrouped variables", "name": "action", "templateType": "anything", "description": ""}, "g": {"definition": "switch(\n a=1, \n random(2..11),\n a=2,\n random(3..11#2),\n a=3,\n random(4,5,7,8,10,11),\n a=4,\n random(5,7,9,11),\n a=5, \n random(6,7,8,9,11),\n a=6,\n random(7,11),\n a=7,\n random(8,9,10,11),\n a=8,\n random(9,11),\n a=9,\n random(10,11),\n a=10,\n 11,\n a=11,\n 12\n)", "group": "Ungrouped variables", "name": "g", "templateType": "anything", "description": ""}, "b": {"definition": "switch(\n f=2,\n 1,\n f=3,\n random(1,2),\n f=4,\n random(1,3),\n f=5, \n random(1..4),\n f=6,\n random(1,5),\n f=7,\n random(1..6),\n f=8,\n random(1,3,5,7),\n f=9,\n random(1,2,4,5,7,8),\n f=10,\n random(1,3,7,9),\n f=11,\n random(1..10)\n)", "group": "Ungrouped variables", "name": "b", "templateType": "anything", "description": ""}}, "metadata": {"description": "

Add/subtract fractions and reduce to lowest form.

", "licence": "Creative Commons Attribution 4.0 International"}, "variable_groups": [], "preamble": {"css": "", "js": ""}, "parts": [{"variableReplacementStrategy": "originalfirst", "gaps": [{"showpreview": true, "notallowed": {"strings": ["+", ".", "(", ")", "1-", "2-", "3-", "4-", "5-", "6-", "7-", "8-", "9-"], "message": "

You must write your answer in the form p/q for integers p and q

", "partialCredit": 0, "showStrings": false}, "checkvariablenames": false, "showFeedbackIcon": true, "checkingaccuracy": 0.0001, "expectedvariablenames": [], "answersimplification": "std", "musthave": {"strings": ["/"], "message": "

You must write your answer in the form p/q for integers p and q.

", "partialCredit": 0, "showStrings": false}, "scripts": {"mark": {"order": "after", "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('m_any(m_number;a/m_number;b,-m_number;a/m_number;b)');\n\n// Check the student's answer matches the pattern. \nvar m = Numbas.jme.display.matchTree(rule,studentTree,true);\n\n// If not, take away marks\nif(!m) {\n this.setCredit(0,'Your answer is not in the form $\\\\frac{a}{b}$.');\n} else {\n var a = m.a.tok.value;\n var b = m.b.tok.value;\n if(Numbas.math.gcd(a,b)!=1) {\n this.setCredit(0,\"The fraction you gave has not been fully reduced.\");\n }\n}"}}, "checkingtype": "absdiff", "marks": 1, "vsetrangepoints": 5, "answer": "{a*f+op*b*g}/{g*f}", "type": "jme", "maxlength": {"message": "

Your answer is too long.

", "length": 7, "partialCredit": 0}, "variableReplacementStrategy": "originalfirst", "showCorrectAnswer": true, "vsetrange": [0, 1], "variableReplacements": []}], "steps": [{"variableReplacementStrategy": "originalfirst", "type": "information", "showFeedbackIcon": true, "marks": 0, "showCorrectAnswer": true, "prompt": "

The rule for {action1} fractions is \\[\\simplify{a/b+ {op}*(c/d)=(a*d+{op}*b*c)/(b*d)}.\\]

", "variableReplacements": [], "scripts": {}}], "type": "gapfill", "showFeedbackIcon": true, "stepsPenalty": 0.5, "marks": 0, "showCorrectAnswer": true, "prompt": "

$\\displaystyle \\simplify[std]{{a} / {g} + ({op*b} / {f})} = $ [[0]] 

\n

No decimal numbers allowed.

\n

Do not include brackets in your answer.

\n

You can get help by clicking on Show steps.

", "variableReplacements": [], "scripts": {}}], "functions": {}, "rulesets": {"std": ["all", "!collectNumbers", "fractionNumbers"]}, "name": "Combining fractions", "ungrouped_variables": ["a", "b", "g", "dosomething", "f", "op", "action1", "action"], "advice": "

The rule for {action1} fractions is \\[\\simplify{a/b+ {op}*(c/d)=(a*d+{op}*b*c)/(b*d)}.\\]
In this case we have:
\\[\\simplify[std,!unitFactor]{{a} / {g} + ({op*b} / {f}) = ({a} * {f} + {g} * {op*b}) / ({g} * {f}) ={a*f+op*g*b}/{g*f}}.\\]
Note that this fraction is in its lowest form as there are no common factors in the denominator and the numerator.

", "variablesTest": {"condition": "", "maxRuns": 100}, "statement": "

{dosomething} the following fractions and reduce the resulting fraction to lowest form.

", "type": "question", "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}]}], "contributors": [{"name": "Bill Foster", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/6/"}, {"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}]}