// Numbas version: exam_results_page_options {"name": "Samantha's copy of Create an algebraic expression from a word problem, simplify, and evaluate", "extensions": ["stats"], "custom_part_types": [], "resources": [], "navigation": {"allowregen": true, "showfrontpage": false, "preventleave": false, "typeendtoleave": false}, "question_groups": [{"pickingStrategy": "all-ordered", "questions": [{"variable_groups": [{"variables": ["a1", "b1", "c1"], "name": "Number of packets eaten"}], "variables": {"a1": {"description": "
Number of packets of lollipops eaten
", "definition": "random(5..10)", "templateType": "anything", "group": "Number of packets eaten", "name": "a1"}, "b1": {"description": "Number of packets of toffee eaten
", "definition": "random(2..10 except a1)", "templateType": "anything", "group": "Number of packets eaten", "name": "b1"}, "c1": {"description": "Number of packets of jelly sweets eaten.
", "definition": "random(2..5)*2", "templateType": "anything", "group": "Number of packets eaten", "name": "c1"}, "total": {"description": "The total spent.
", "definition": "(a1+b1+c1/2)*2 + b1+c1/2", "templateType": "anything", "group": "Ungrouped variables", "name": "total"}, "name": {"description": "", "definition": "random('Jerry','Jessica')", "templateType": "anything", "group": "Ungrouped variables", "name": "name"}}, "functions": {}, "advice": "We are told that the price of a packet of lollipops is represented by the letter $x$.
\nA packet of toffee costs $£1$ more than a packet of lollipops, i.e. $x+1$.
\nA packet of jelly sweets costs half as much as a packet of toffee, so $\\frac{1}{2}(x+1)$.
\nTo find the total cost, multiply the expressions above for the cost of each kind of sweet by the number of packets eaten, and add them together.
\nWithout simplifying, we obtain:
\n\\begin{align}
\\text{Cost} &= \\simplify[]{{a1}x+{b1}(x+1) + {c1}*(1/2)*(x+1)} \\\\
&= \\simplify[]{{a1}x+{b1}(x+1) + {c1/2}*(x+1)}
\\text{.}
\\end{align}
The first step in simplifying this expression is to expand both sets of brackets:
\n\\begin{align}
\\simplify[]{ {a1}x + {b1}(x+1) + {c1/2}*(x+1)} &= \\simplify[]{ {a1}x + {b1}x + {b1}*1 + {c1/2}x + {c1/2}*1} \\\\
&= \\simplify[] { {a1}x + {b1}x + {b1} + {c1/2}x + {c1/2} } \\text{.}
\\end{align}
Finally, collect like terms:
\n\\begin{align}
\\simplify[] { {a1}x + {b1}x + {b1} + {c1/2}x + {c1/2} } &= \\simplify[]{ {a1+b1+c1/2}x + {b1+c1/2} } \\text{.}
\\end{align}
Once we know that the price of a packet of lollipops is $£2$, we can substitute this for $x$ in the equation above.
\n\\begin{align}
\\text{Cost}&=\\simplify{ {a1+b1+c1/2}x+{b1+c1/2} }\\\\
&=\\var{a1+b1+c1/2} \\times 2+\\var{b1+c1/2} \\\\
&=\\var{(a1+b1+c1/2)*2+b1+c1/2} \\text{.}
\\end{align}
So {name} spent $£\\var{total}$ on sweets last week.
", "parts": [{"type": "gapfill", "showCorrectAnswer": true, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "variableReplacements": [], "marks": 0, "scripts": {}, "unitTests": [], "extendBaseMarkingAlgorithm": true, "gaps": [{"type": "jme", "showCorrectAnswer": true, "customMarkingAlgorithm": "", "checkVariableNames": false, "answer": "x", "checkingType": "absdiff", "failureRate": 1, "showFeedbackIcon": true, "variableReplacements": [], "checkingAccuracy": 0.001, "marks": 1, "scripts": {}, "unitTests": [], "vsetRange": [0, 1], "vsetRangePoints": 5, "extendBaseMarkingAlgorithm": true, "showPreview": true, "variableReplacementStrategy": "originalfirst", "expectedVariableNames": []}, {"type": "jme", "showCorrectAnswer": true, "customMarkingAlgorithm": "", "checkVariableNames": false, "answer": "x+1", "checkingType": "absdiff", "failureRate": 1, "showFeedbackIcon": true, "variableReplacements": [], "checkingAccuracy": 0.001, "marks": 1, "scripts": {}, "unitTests": [], "vsetRange": [0, 1], "vsetRangePoints": 5, "extendBaseMarkingAlgorithm": true, "showPreview": true, "variableReplacementStrategy": "originalfirst", "expectedVariableNames": []}, {"type": "jme", "showCorrectAnswer": true, "customMarkingAlgorithm": "", "checkVariableNames": false, "answer": "1/2(x+1)", "checkingType": "absdiff", "failureRate": 1, "showFeedbackIcon": true, "variableReplacements": [], "checkingAccuracy": 0.001, "marks": 1, "scripts": {}, "unitTests": [], "vsetRange": [0, 1], "vsetRangePoints": 5, "extendBaseMarkingAlgorithm": true, "showPreview": true, "variableReplacementStrategy": "originalfirst", "expectedVariableNames": []}], "sortAnswers": false, "variableReplacementStrategy": "originalfirst", "prompt": "Let the cost of a packet of lollipops be $£x$.
\nWrite an expression in terms of $x$ for the cost of each kind of sweet:
\nLollipops: £[[0]]
\nToffees: £[[1]]
\nJelly sweets: £[[2]]
Write an algebraic expression for the overall cost of the sweets {name} ate, in terms of $x$.
\n£[[0]]
"}, {"type": "gapfill", "showCorrectAnswer": true, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "variableReplacements": [], "marks": 0, "scripts": {}, "unitTests": [], "extendBaseMarkingAlgorithm": true, "gaps": [{"type": "jme", "showCorrectAnswer": true, "customMarkingAlgorithm": "", "checkVariableNames": true, "answer": "({a1}+{b1}+{c1}/2)x+({b1}+{c1}/2)", "checkingType": "absdiff", "failureRate": 1, "showFeedbackIcon": true, "variableReplacements": [], "checkingAccuracy": 0.001, "marks": 1, "scripts": {"mark": {"script": "// Check the student's answer matches the pattern. \nvar m = Numbas.jme.display.matchExpression('m_number*x+m_number',this.studentAnswer,true);\n// If not, take away marks\nif(!m) {\n this.multCredit(0,'Your answer is not fully simplified.');\n}", "order": "after"}}, "unitTests": [], "vsetRange": [0, 1], "vsetRangePoints": 5, "extendBaseMarkingAlgorithm": true, "showPreview": true, "variableReplacementStrategy": "originalfirst", "answerSimplification": "all", "expectedVariableNames": ["x"]}], "sortAnswers": false, "variableReplacementStrategy": "originalfirst", "prompt": "Now simplify your expression for the total cost.
\n£[[0]]
"}, {"type": "gapfill", "showCorrectAnswer": true, "customMarkingAlgorithm": "", "showFeedbackIcon": true, "variableReplacements": [], "marks": 0, "scripts": {}, "unitTests": [], "extendBaseMarkingAlgorithm": true, "gaps": [{"type": "jme", "showCorrectAnswer": true, "customMarkingAlgorithm": "", "checkVariableNames": true, "answer": "({a1}+{b1}+{c1}/2)2+{b1}+{c1}/2", "checkingType": "absdiff", "failureRate": 1, "showFeedbackIcon": true, "variableReplacements": [], "notallowed": {"message": "Don't use brackets
", "partialCredit": 0, "strings": ["(", ")"], "showStrings": true}, "checkingAccuracy": 0.001, "marks": 1, "scripts": {}, "unitTests": [], "vsetRange": [0, 1], "vsetRangePoints": 5, "extendBaseMarkingAlgorithm": true, "showPreview": true, "variableReplacementStrategy": "originalfirst", "answerSimplification": "all", "expectedVariableNames": ["x"]}], "sortAnswers": false, "variableReplacementStrategy": "originalfirst", "prompt": "You find out that a packet of lollipops costs $£2$.
\nCalculate {name}'s total expenditure on sweets last week.
\n£[[0]]
"}], "metadata": {"description": "Given a description in words of the costs of some items in terms of an unknown cost, write down an expression for the total cost of a selection of items. Then simplify the expression, and finally evaluate it at a given point.
\nThe word problem is about the costs of sweets in a sweet shop.
", "licence": "Creative Commons Attribution 4.0 International"}, "tags": [], "rulesets": {}, "name": "Samantha's copy of Create an algebraic expression from a word problem, simplify, and evaluate", "extensions": ["stats"], "ungrouped_variables": ["name", "total"], "preamble": {"css": "", "js": ""}, "statement": "{name} eats a lot of sweets. You are trying to work out the cost of the sweets that {name} ate last week.
\n{name} ate $\\var{a1}$ packets of lollipops, $\\var{b1}$ packets of toffee and $\\simplify{{c1}}$ packets of jelly sweets.
\nYou know that a packet of toffee costs $$1$ more than a packet of lollipops, and a packet of jelly sweets costs half as much as a packet of toffees.
", "variablesTest": {"condition": "gcd(a1,b1+c1/2)=1", "maxRuns": 100}, "type": "question", "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Bradley Bush", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1521/"}, {"name": "Samantha Konig", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2560/"}]}]}], "contributors": [{"name": "Christian Lawson-Perfect", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/7/"}, {"name": "Bradley Bush", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/1521/"}, {"name": "Samantha Konig", "profile_url": "https://numbas.mathcentre.ac.uk/accounts/profile/2560/"}]}